diff --git a/DRAMSys/library/src/common/jsonAddressDecoder.cpp b/DRAMSys/library/src/common/jsonAddressDecoder.cpp index 3f32cb79..333c200d 100644 --- a/DRAMSys/library/src/common/jsonAddressDecoder.cpp +++ b/DRAMSys/library/src/common/jsonAddressDecoder.cpp @@ -146,8 +146,11 @@ DecodedAddress JSONAddressDecoder::decodeAddress(sc_dt::uint64 addr) // Get the bank bit and row bit. Apply a bitwise xor operator and save it back to the bank bit. for(auto it = m_vXor.begin(); it != m_vXor.end(); it++) { + unsigned new_bank_bit; + // Bank Row + new_bank_bit = (((addr >> it->first) & 1) ^ ((addr >> it->second) & 1)); addr &= ~(1 << it->first); - addr |= (((addr >> it->first) & 1) ^ ((addr >> it->second) & 1)) << it->first; + addr |= new_bank_bit << it->first; } // Unsed @@ -234,8 +237,10 @@ sc_dt::uint64 JSONAddressDecoder::encodeAddress(DecodedAddress n) // Get the bank bit and row bit. Apply a bitwise xor operator and save it back to the bank bit. for(auto it = m_vXor.begin(); it != m_vXor.end(); it++) { - address &= ~(1 << it->first); - address |= (((address >> it->first) & 1) ^ ((address >> it->second) & 1)) << it->first; + unsigned new_bank_bit; + new_bank_bit = (((address >> it->first) & 1) ^ ((address >> it->second) & 1)); + address &= ~(1 << it->first); + address |= new_bank_bit << it->first; } return address;