diff options
Diffstat (limited to 'src/mem/ruby')
61 files changed, 631 insertions, 876 deletions
diff --git a/src/mem/ruby/common/Address.cc b/src/mem/ruby/common/Address.cc index 5d9fa49e5..8d8800501 100644 --- a/src/mem/ruby/common/Address.cc +++ b/src/mem/ruby/common/Address.cc @@ -29,115 +29,94 @@ #include "mem/ruby/common/Address.hh" #include "mem/ruby/system/System.hh" -physical_address_t -Address::getLineAddress() const +Addr +bitSelect(Addr addr, unsigned int small, unsigned int big) { - return bitSelect(RubySystem::getBlockSizeBits(), ADDRESS_WIDTH); -} + assert(big >= small); -physical_address_t -Address::getOffset() const -{ - return bitSelect(0, RubySystem::getBlockSizeBits() - 1); + if (big >= ADDRESS_WIDTH - 1) { + return (addr >> small); + } else { + Addr mask = ~((Addr)~0 << (big + 1)); + // FIXME - this is slow to manipulate a 64-bit number using 32-bits + Addr partial = (addr & mask); + return (partial >> small); + } } -void -Address::makeLineAddress() +Addr +bitRemove(Addr addr, unsigned int small, unsigned int big) { - m_address = maskLowOrderBits(RubySystem::getBlockSizeBits()); -} + assert(big >= small); -// returns the next stride address based on line address -void -Address::makeNextStrideAddress(int stride) -{ - m_address = maskLowOrderBits(RubySystem::getBlockSizeBits()) - + RubySystem::getBlockSizeBytes()*stride; + if (small >= ADDRESS_WIDTH - 1) { + return addr; + } else if (big >= ADDRESS_WIDTH - 1) { + Addr mask = (Addr)~0 >> small; + return (addr & mask); + } else if (small == 0) { + Addr mask = (Addr)~0 << big; + return (addr & mask); + } else { + Addr mask = ~((Addr)~0 << small); + Addr lower_bits = addr & mask; + mask = (Addr)~0 << (big + 1); + Addr higher_bits = addr & mask; + + // Shift the valid high bits over the removed section + higher_bits = higher_bits >> (big - small + 1); + return (higher_bits | lower_bits); + } } -int64 -Address::memoryModuleIndex() const +Addr +maskLowOrderBits(Addr addr, unsigned int number) { - int64 index = - bitSelect(RubySystem::getBlockSizeBits() + - RubySystem::getMemorySizeBits(), ADDRESS_WIDTH); - assert (index >= 0); - return index; + Addr mask; - // int64 indexHighPortion = - // address.bitSelect(MEMORY_SIZE_BITS - 1, - // PAGE_SIZE_BITS + NUMBER_OF_MEMORY_MODULE_BITS); - // int64 indexLowPortion = - // address.bitSelect(DATA_BLOCK_BITS, PAGE_SIZE_BITS - 1); - // - // int64 index = indexLowPortion | - // (indexHighPortion << (PAGE_SIZE_BITS - DATA_BLOCK_BITS)); - - /* - Round-robin mapping of addresses, at page size granularity - -ADDRESS_WIDTH MEMORY_SIZE_BITS PAGE_SIZE_BITS DATA_BLOCK_BITS - | | | | - \ / \ / \ / \ / 0 - ----------------------------------------------------------------------- - | unused |xxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxx| | - | |xxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxx| | - ----------------------------------------------------------------------- - indexHighPortion indexLowPortion - <-------> - NUMBER_OF_MEMORY_MODULE_BITS - */ + if (number >= ADDRESS_WIDTH - 1) { + mask = ~0; + } else { + mask = (Addr)~0 << number; + } + return (addr & mask); } -void -Address::print(std::ostream& out) const +Addr +maskHighOrderBits(Addr addr, unsigned int number) { - using namespace std; - out << "[" << hex << "0x" << m_address << "," << " line 0x" - << maskLowOrderBits(RubySystem::getBlockSizeBits()) << dec << "]" - << flush; -} + Addr mask; -void -Address::output(std::ostream& out) const -{ - // Note: this outputs addresses in the form "ffff", not "0xffff". - // This code should always be able to write out addresses in a - // format that can be read in by the below input() method. Please - // don't change this without talking to Milo first. - out << std::hex << m_address << std::dec; + if (number >= ADDRESS_WIDTH - 1) { + mask = ~0; + } else { + mask = (Addr)~0 >> number; + } + return (addr & mask); } -void -Address::input(std::istream& in) +Addr +shiftLowOrderBits(Addr addr, unsigned int number) { - // Note: this only works with addresses in the form "ffff", not - // "0xffff". This code should always be able to read in addresses - // written out by the above output() method. Please don't change - // this without talking to Milo first. - in >> std::hex >> m_address >> std::dec; + return (addr >> number); } -Address::Address(const Address& obj) +Addr +getOffset(Addr addr) { - m_address = obj.m_address; + return bitSelect(addr, 0, RubySystem::getBlockSizeBits() - 1); } -Address& -Address::operator=(const Address& obj) +Addr +makeLineAddress(Addr addr) { - if (this == &obj) { - // assert(false); - } else { - m_address = obj.m_address; - } - return *this; + return maskLowOrderBits(addr, RubySystem::getBlockSizeBits()); } -Address -next_stride_address(const Address& addr, int stride) +// returns the next stride address based on line address +Addr +makeNextStrideAddress(Addr addr, int stride) { - Address temp = addr; - temp.makeNextStrideAddress(stride); - return temp; + return maskLowOrderBits(addr, RubySystem::getBlockSizeBits()) + + RubySystem::getBlockSizeBytes() * stride; } diff --git a/src/mem/ruby/common/Address.hh b/src/mem/ruby/common/Address.hh index d47ff9ac5..6210baa5c 100644 --- a/src/mem/ruby/common/Address.hh +++ b/src/mem/ruby/common/Address.hh @@ -34,193 +34,18 @@ #include <iostream> #include "base/hashmap.hh" -#include "mem/ruby/common/TypeDefines.hh" +#include "base/types.hh" const uint32_t ADDRESS_WIDTH = 64; // address width in bytes -class Address; -typedef Address PhysAddress; -typedef Address VirtAddress; - -class Address -{ - public: - Address() - : m_address(0) - { } - - explicit - Address(physical_address_t address) - : m_address(address) - { } - - Address(const Address& obj); - Address& operator=(const Address& obj); - - void setAddress(physical_address_t address) { m_address = address; } - physical_address_t getAddress() const {return m_address;} - // selects bits inclusive - physical_address_t bitSelect(unsigned int small, unsigned int big) const; - physical_address_t bitRemove(unsigned int small, unsigned int big) const; - physical_address_t maskLowOrderBits(unsigned int number) const; - physical_address_t maskHighOrderBits(unsigned int number) const; - physical_address_t shiftLowOrderBits(unsigned int number) const; - - physical_address_t getLineAddress() const; - physical_address_t getOffset() const; - void makeLineAddress(); - void makeNextStrideAddress(int stride); - - int64 memoryModuleIndex() const; - - void print(std::ostream& out) const; - void output(std::ostream& out) const; - void input(std::istream& in); - - void - setOffset(int offset) - { - // first, zero out the offset bits - makeLineAddress(); - m_address |= (physical_address_t) offset; - } - - private: - physical_address_t m_address; -}; - -inline Address -line_address(const Address& addr) -{ - Address temp(addr); - temp.makeLineAddress(); - return temp; -} - -inline bool -operator<(const Address& obj1, const Address& obj2) -{ - return obj1.getAddress() < obj2.getAddress(); -} - -inline std::ostream& -operator<<(std::ostream& out, const Address& obj) -{ - obj.print(out); - out << std::flush; - return out; -} - -inline bool -operator==(const Address& obj1, const Address& obj2) -{ - return (obj1.getAddress() == obj2.getAddress()); -} - -inline bool -operator!=(const Address& obj1, const Address& obj2) -{ - return (obj1.getAddress() != obj2.getAddress()); -} - -// rips bits inclusive -inline physical_address_t -Address::bitSelect(unsigned int small, unsigned int big) const -{ - physical_address_t mask; - assert(big >= small); - - if (big >= ADDRESS_WIDTH - 1) { - return (m_address >> small); - } else { - mask = ~((physical_address_t)~0 << (big + 1)); - // FIXME - this is slow to manipulate a 64-bit number using 32-bits - physical_address_t partial = (m_address & mask); - return (partial >> small); - } -} - -// removes bits inclusive -inline physical_address_t -Address::bitRemove(unsigned int small, unsigned int big) const -{ - physical_address_t mask; - assert(big >= small); - - if (small >= ADDRESS_WIDTH - 1) { - return m_address; - } else if (big >= ADDRESS_WIDTH - 1) { - mask = (physical_address_t)~0 >> small; - return (m_address & mask); - } else if (small == 0) { - mask = (physical_address_t)~0 << big; - return (m_address & mask); - } else { - mask = ~((physical_address_t)~0 << small); - physical_address_t lower_bits = m_address & mask; - mask = (physical_address_t)~0 << (big + 1); - physical_address_t higher_bits = m_address & mask; - - // Shift the valid high bits over the removed section - higher_bits = higher_bits >> (big - small + 1); - return (higher_bits | lower_bits); - } -} - -inline physical_address_t -Address::maskLowOrderBits(unsigned int number) const -{ - physical_address_t mask; - - if (number >= ADDRESS_WIDTH - 1) { - mask = ~0; - } else { - mask = (physical_address_t)~0 << number; - } - return (m_address & mask); -} - -inline physical_address_t -Address::maskHighOrderBits(unsigned int number) const -{ - physical_address_t mask; - - if (number >= ADDRESS_WIDTH - 1) { - mask = ~0; - } else { - mask = (physical_address_t)~0 >> number; - } - return (m_address & mask); -} - -inline physical_address_t -Address::shiftLowOrderBits(unsigned int number) const -{ - return (m_address >> number); -} - -Address next_stride_address(const Address& addr, int stride); - -__hash_namespace_begin -template <> struct hash<Address> -{ - size_t - operator()(const Address &s) const - { - return (size_t)s.getAddress(); - } -}; -__hash_namespace_end - -namespace std { -template <> struct equal_to<Address> -{ - bool - operator()(const Address& s1, const Address& s2) const - { - return s1 == s2; - } -}; -} // namespace std +// selects bits inclusive +Addr bitSelect(Addr addr, unsigned int small, unsigned int big); +Addr bitRemove(Addr addr, unsigned int small, unsigned int big); +Addr maskLowOrderBits(Addr addr, unsigned int number); +Addr maskHighOrderBits(Addr addr, unsigned int number); +Addr shiftLowOrderBits(Addr addr, unsigned int number); +Addr getOffset(Addr addr); +Addr makeLineAddress(Addr addr); +Addr makeNextStrideAddress(Addr addr, int stride); #endif // __MEM_RUBY_COMMON_ADDRESS_HH__ diff --git a/src/mem/ruby/common/SubBlock.cc b/src/mem/ruby/common/SubBlock.cc index 48485bf8b..5175cb950 100644 --- a/src/mem/ruby/common/SubBlock.cc +++ b/src/mem/ruby/common/SubBlock.cc @@ -31,7 +31,7 @@ using m5::stl_helpers::operator<<; -SubBlock::SubBlock(const Address& addr, int size) +SubBlock::SubBlock(Addr addr, int size) { m_address = addr; resize(size); @@ -45,7 +45,7 @@ SubBlock::internalMergeFrom(const DataBlock& data) { int size = getSize(); assert(size > 0); - int offset = m_address.getOffset(); + int offset = getOffset(m_address); for (int i = 0; i < size; i++) { this->setByte(i, data.getByte(offset + i)); } @@ -56,7 +56,7 @@ SubBlock::internalMergeTo(DataBlock& data) const { int size = getSize(); assert(size > 0); - int offset = m_address.getOffset(); + int offset = getOffset(m_address); for (int i = 0; i < size; i++) { // This will detect crossing a cache line boundary data.setByte(offset + i, this->getByte(i)); diff --git a/src/mem/ruby/common/SubBlock.hh b/src/mem/ruby/common/SubBlock.hh index 35e99b956..ad1d68ae1 100644 --- a/src/mem/ruby/common/SubBlock.hh +++ b/src/mem/ruby/common/SubBlock.hh @@ -39,11 +39,11 @@ class SubBlock { public: SubBlock() { } - SubBlock(const Address& addr, int size); + SubBlock(Addr addr, int size); ~SubBlock() { } - const Address& getAddress() const { return m_address; } - void setAddress(const Address& addr) { m_address = addr; } + Addr getAddress() const { return m_address; } + void setAddress(Addr addr) { m_address = addr; } int getSize() const { return m_data.size(); } void resize(int size) { m_data.resize(size); } @@ -66,7 +66,7 @@ class SubBlock void internalMergeFrom(const DataBlock& data); // Data Members (m_ prefix) - Address m_address; + Addr m_address; std::vector<uint8_t> m_data; }; diff --git a/src/mem/ruby/common/TypeDefines.hh b/src/mem/ruby/common/TypeDefines.hh index 17b30f4b3..203b63779 100644 --- a/src/mem/ruby/common/TypeDefines.hh +++ b/src/mem/ruby/common/TypeDefines.hh @@ -33,8 +33,6 @@ typedef unsigned long long uint64; typedef long long int64; -typedef uint64 physical_address_t; - typedef unsigned int LinkID; typedef unsigned int NodeID; typedef unsigned int SwitchID; diff --git a/src/mem/ruby/filters/AbstractBloomFilter.hh b/src/mem/ruby/filters/AbstractBloomFilter.hh index 3a014dd85..097e0e204 100644 --- a/src/mem/ruby/filters/AbstractBloomFilter.hh +++ b/src/mem/ruby/filters/AbstractBloomFilter.hh @@ -38,19 +38,19 @@ class AbstractBloomFilter public: virtual ~AbstractBloomFilter() {}; virtual void clear() = 0; - virtual void increment(const Address& addr) = 0; - virtual void decrement(const Address& addr) = 0; + virtual void increment(Addr addr) = 0; + virtual void decrement(Addr addr) = 0; virtual void merge(AbstractBloomFilter * other_filter) = 0; - virtual void set(const Address& addr) = 0; - virtual void unset(const Address& addr) = 0; + virtual void set(Addr addr) = 0; + virtual void unset(Addr addr) = 0; - virtual bool isSet(const Address& addr) = 0; - virtual int getCount(const Address& addr) = 0; + virtual bool isSet(Addr addr) = 0; + virtual int getCount(Addr addr) = 0; virtual int getTotalCount() = 0; virtual void print(std::ostream& out) const = 0; - virtual int getIndex(const Address& addr) = 0; + virtual int getIndex(Addr addr) = 0; virtual int readBit(const int index) = 0; virtual void writeBit(const int index, const int value) = 0; }; diff --git a/src/mem/ruby/filters/BlockBloomFilter.cc b/src/mem/ruby/filters/BlockBloomFilter.cc index d6ef9128a..c902f9f38 100644 --- a/src/mem/ruby/filters/BlockBloomFilter.cc +++ b/src/mem/ruby/filters/BlockBloomFilter.cc @@ -65,13 +65,13 @@ BlockBloomFilter::clear() } void -BlockBloomFilter::increment(const Address& addr) +BlockBloomFilter::increment(Addr addr) { // Not used } void -BlockBloomFilter::decrement(const Address& addr) +BlockBloomFilter::decrement(Addr addr) { // Not used } @@ -83,28 +83,28 @@ BlockBloomFilter::merge(AbstractBloomFilter * other_filter) } void -BlockBloomFilter::set(const Address& addr) +BlockBloomFilter::set(Addr addr) { int i = get_index(addr); m_filter[i] = 1; } void -BlockBloomFilter::unset(const Address& addr) +BlockBloomFilter::unset(Addr addr) { int i = get_index(addr); m_filter[i] = 0; } bool -BlockBloomFilter::isSet(const Address& addr) +BlockBloomFilter::isSet(Addr addr) { int i = get_index(addr); return (m_filter[i]); } int -BlockBloomFilter::getCount(const Address& addr) +BlockBloomFilter::getCount(Addr addr) { return m_filter[get_index(addr)]; } @@ -123,7 +123,7 @@ BlockBloomFilter::getTotalCount() } int -BlockBloomFilter::getIndex(const Address& addr) +BlockBloomFilter::getIndex(Addr addr) { return get_index(addr); } @@ -146,17 +146,16 @@ BlockBloomFilter::writeBit(const int index, const int value) } int -BlockBloomFilter::get_index(const Address& addr) +BlockBloomFilter::get_index(Addr addr) { // Pull out some bit field ==> B1 // Pull out additional bits, not the same as B1 ==> B2 // XOR B1 and B2 to get hash index - physical_address_t block_bits = - addr.bitSelect(RubySystem::getBlockSizeBits(), + Addr block_bits = bitSelect(addr, RubySystem::getBlockSizeBits(), 2 * RubySystem::getBlockSizeBits() - 1); int offset = 5; - physical_address_t other_bits = - addr.bitSelect(2 * RubySystem::getBlockSizeBits() + offset, + Addr other_bits = bitSelect(addr, + 2 * RubySystem::getBlockSizeBits() + offset, 2 * RubySystem::getBlockSizeBits() + offset + m_filter_size_bits - 1); int index = block_bits ^ other_bits; diff --git a/src/mem/ruby/filters/BlockBloomFilter.hh b/src/mem/ruby/filters/BlockBloomFilter.hh index fc7ea1d33..d45dd236b 100644 --- a/src/mem/ruby/filters/BlockBloomFilter.hh +++ b/src/mem/ruby/filters/BlockBloomFilter.hh @@ -43,23 +43,23 @@ class BlockBloomFilter : public AbstractBloomFilter ~BlockBloomFilter(); void clear(); - void increment(const Address& addr); - void decrement(const Address& addr); + void increment(Addr addr); + void decrement(Addr addr); void merge(AbstractBloomFilter * other_filter); - void set(const Address& addr); - void unset(const Address& addr); + void set(Addr addr); + void unset(Addr addr); - bool isSet(const Address& addr); - int getCount(const Address& addr); + bool isSet(Addr addr); + int getCount(Addr addr); int getTotalCount(); - int getIndex(const Address& addr); + int getIndex(Addr addr); int readBit(const int index); void writeBit(const int index, const int value); void print(std::ostream& out) const; private: - int get_index(const Address& addr); + int get_index(Addr addr); std::vector<int> m_filter; int m_filter_size; diff --git a/src/mem/ruby/filters/BulkBloomFilter.cc b/src/mem/ruby/filters/BulkBloomFilter.cc index 8b8f3c42d..953add219 100644 --- a/src/mem/ruby/filters/BulkBloomFilter.cc +++ b/src/mem/ruby/filters/BulkBloomFilter.cc @@ -73,13 +73,13 @@ BulkBloomFilter::clear() } void -BulkBloomFilter::increment(const Address& addr) +BulkBloomFilter::increment(Addr addr) { // Not used } void -BulkBloomFilter::decrement(const Address& addr) +BulkBloomFilter::decrement(Addr addr) { // Not used } @@ -91,16 +91,16 @@ BulkBloomFilter::merge(AbstractBloomFilter * other_filter) } void -BulkBloomFilter::set(const Address& addr) +BulkBloomFilter::set(Addr addr) { // c0 contains the cache index bits int set_bits = m_sector_bits; int block_bits = RubySystem::getBlockSizeBits(); - int c0 = addr.bitSelect( block_bits, block_bits + set_bits - 1); + int c0 = bitSelect(addr, block_bits, block_bits + set_bits - 1); // c1 contains the lower m_sector_bits permuted bits //Address permuted_bits = permute(addr); //int c1 = permuted_bits.bitSelect(0, set_bits-1); - int c1 = addr.bitSelect( block_bits+set_bits, (block_bits+2*set_bits) - 1); + int c1 = bitSelect(addr, block_bits+set_bits, (block_bits+2*set_bits) - 1); //assert(c0 < (m_filter_size/2)); //assert(c0 + (m_filter_size/2) < m_filter_size); //assert(c1 < (m_filter_size/2)); @@ -111,22 +111,22 @@ BulkBloomFilter::set(const Address& addr) } void -BulkBloomFilter::unset(const Address& addr) +BulkBloomFilter::unset(Addr addr) { // not used } bool -BulkBloomFilter::isSet(const Address& addr) +BulkBloomFilter::isSet(Addr addr) { // c0 contains the cache index bits int set_bits = m_sector_bits; int block_bits = RubySystem::getBlockSizeBits(); - int c0 = addr.bitSelect( block_bits, block_bits + set_bits - 1); + int c0 = bitSelect(addr, block_bits, block_bits + set_bits - 1); // c1 contains the lower 10 permuted bits //Address permuted_bits = permute(addr); //int c1 = permuted_bits.bitSelect(0, set_bits-1); - int c1 = addr.bitSelect( block_bits+set_bits, (block_bits+2*set_bits) - 1); + int c1 = bitSelect(addr, block_bits+set_bits, (block_bits+2*set_bits) - 1); //assert(c0 < (m_filter_size/2)); //assert(c0 + (m_filter_size/2) < m_filter_size); //assert(c1 < (m_filter_size/2)); @@ -173,7 +173,7 @@ BulkBloomFilter::isSet(const Address& addr) } int -BulkBloomFilter::getCount(const Address& addr) +BulkBloomFilter::getCount(Addr addr) { // not used return 0; @@ -192,7 +192,7 @@ BulkBloomFilter::getTotalCount() } int -BulkBloomFilter::getIndex(const Address& addr) +BulkBloomFilter::getIndex(Addr addr) { return get_index(addr); } @@ -216,40 +216,40 @@ BulkBloomFilter::print(ostream& out) const } int -BulkBloomFilter::get_index(const Address& addr) +BulkBloomFilter::get_index(Addr addr) { - return addr.bitSelect(RubySystem::getBlockSizeBits(), - RubySystem::getBlockSizeBits() + - m_filter_size_bits - 1); + return bitSelect(addr, RubySystem::getBlockSizeBits(), + RubySystem::getBlockSizeBits() + + m_filter_size_bits - 1); } -Address -BulkBloomFilter::permute(const Address & addr) +Addr +BulkBloomFilter::permute(Addr addr) { // permutes the original address bits according to Table 5 int block_offset = RubySystem::getBlockSizeBits(); - physical_address_t part1 = addr.bitSelect(block_offset, block_offset + 6), - part2 = addr.bitSelect(block_offset + 9, block_offset + 9), - part3 = addr.bitSelect(block_offset + 11, block_offset + 11), - part4 = addr.bitSelect(block_offset + 17, block_offset + 17), - part5 = addr.bitSelect(block_offset + 7, block_offset + 8), - part6 = addr.bitSelect(block_offset + 10, block_offset + 10), - part7 = addr.bitSelect(block_offset + 12, block_offset + 12), - part8 = addr.bitSelect(block_offset + 13, block_offset + 13), - part9 = addr.bitSelect(block_offset + 15, block_offset + 16), - part10 = addr.bitSelect(block_offset + 18, block_offset + 20), - part11 = addr.bitSelect(block_offset + 14, block_offset + 14); - - physical_address_t result = + Addr part1 = bitSelect(addr, block_offset, block_offset + 6), + part2 = bitSelect(addr, block_offset + 9, block_offset + 9), + part3 = bitSelect(addr, block_offset + 11, block_offset + 11), + part4 = bitSelect(addr, block_offset + 17, block_offset + 17), + part5 = bitSelect(addr, block_offset + 7, block_offset + 8), + part6 = bitSelect(addr, block_offset + 10, block_offset + 10), + part7 = bitSelect(addr, block_offset + 12, block_offset + 12), + part8 = bitSelect(addr, block_offset + 13, block_offset + 13), + part9 = bitSelect(addr, block_offset + 15, block_offset + 16), + part10 = bitSelect(addr, block_offset + 18, block_offset + 20), + part11 = bitSelect(addr, block_offset + 14, block_offset + 14); + + Addr result = (part1 << 14) | (part2 << 13) | (part3 << 12) | (part4 << 11) | (part5 << 9) | (part6 << 8) | (part7 << 7) | (part8 << 6) | (part9 << 4) | (part10 << 1) | (part11); // assume 32 bit addresses (both virtual and physical) // select the remaining high-order 11 bits - physical_address_t remaining_bits = - addr.bitSelect(block_offset + 21, 31) << 21; + Addr remaining_bits = + bitSelect(addr, block_offset + 21, 31) << 21; result = result | remaining_bits; - return Address(result); + return result; } diff --git a/src/mem/ruby/filters/BulkBloomFilter.hh b/src/mem/ruby/filters/BulkBloomFilter.hh index 9c10bfc6f..8b67c718e 100644 --- a/src/mem/ruby/filters/BulkBloomFilter.hh +++ b/src/mem/ruby/filters/BulkBloomFilter.hh @@ -43,24 +43,24 @@ class BulkBloomFilter : public AbstractBloomFilter ~BulkBloomFilter(); void clear(); - void increment(const Address& addr); - void decrement(const Address& addr); + void increment(Addr addr); + void decrement(Addr addr); void merge(AbstractBloomFilter * other_filter); - void set(const Address& addr); - void unset(const Address& addr); + void set(Addr addr); + void unset(Addr addr); - bool isSet(const Address& addr); - int getCount(const Address& addr); + bool isSet(Addr addr); + int getCount(Addr addr); int getTotalCount(); - int getIndex(const Address& addr); + int getIndex(Addr addr); int readBit(const int index); void writeBit(const int index, const int value); void print(std::ostream& out) const; private: - int get_index(const Address& addr); - Address permute(const Address & addr); + int get_index(Addr addr); + Addr permute(Addr addr); std::vector<int> m_filter; std::vector<int> m_temp_filter; diff --git a/src/mem/ruby/filters/GenericBloomFilter.cc b/src/mem/ruby/filters/GenericBloomFilter.cc index 0f53a9712..3d4cb9ed3 100644 --- a/src/mem/ruby/filters/GenericBloomFilter.cc +++ b/src/mem/ruby/filters/GenericBloomFilter.cc @@ -79,13 +79,13 @@ GenericBloomFilter::clear() } void -GenericBloomFilter::increment(const Address& addr) +GenericBloomFilter::increment(Addr addr) { m_filter->increment(addr); } void -GenericBloomFilter::decrement(const Address& addr) +GenericBloomFilter::decrement(Addr addr) { m_filter->decrement(addr); } @@ -97,25 +97,25 @@ GenericBloomFilter::merge(GenericBloomFilter * other_filter) } void -GenericBloomFilter::set(const Address& addr) +GenericBloomFilter::set(Addr addr) { m_filter->set(addr); } void -GenericBloomFilter::unset(const Address& addr) +GenericBloomFilter::unset(Addr addr) { m_filter->unset(addr); } bool -GenericBloomFilter::isSet(const Address& addr) +GenericBloomFilter::isSet(Addr addr) { return m_filter->isSet(addr); } int -GenericBloomFilter::getCount(const Address& addr) +GenericBloomFilter::getCount(Addr addr) { return m_filter->getCount(addr); } @@ -127,7 +127,7 @@ GenericBloomFilter::getTotalCount() } int -GenericBloomFilter::getIndex(const Address& addr) +GenericBloomFilter::getIndex(Addr addr) { return m_filter->getIndex(addr); } diff --git a/src/mem/ruby/filters/GenericBloomFilter.hh b/src/mem/ruby/filters/GenericBloomFilter.hh index 38f9d370e..869c40ba7 100644 --- a/src/mem/ruby/filters/GenericBloomFilter.hh +++ b/src/mem/ruby/filters/GenericBloomFilter.hh @@ -42,24 +42,24 @@ class GenericBloomFilter ~GenericBloomFilter(); void clear(); - void increment(const Address& addr); - void decrement(const Address& addr); + void increment(Addr addr); + void decrement(Addr addr); void merge(GenericBloomFilter * other_filter); - void set(const Address& addr); - void unset(const Address& addr); + void set(Addr addr); + void unset(Addr addr); AbstractBloomFilter * getFilter() { return m_filter; } - bool isSet(const Address& addr); + bool isSet(Addr addr); - int getCount(const Address& addr); + int getCount(Addr addr); int getTotalCount(); - int getIndex(const Address& addr); + int getIndex(Addr addr); int readBit(const int index); void writeBit(const int index, const int value); diff --git a/src/mem/ruby/filters/H3BloomFilter.cc b/src/mem/ruby/filters/H3BloomFilter.cc index a4521d223..21b9152be 100644 --- a/src/mem/ruby/filters/H3BloomFilter.cc +++ b/src/mem/ruby/filters/H3BloomFilter.cc @@ -416,13 +416,13 @@ H3BloomFilter::clear() } void -H3BloomFilter::increment(const Address& addr) +H3BloomFilter::increment(Addr addr) { // Not used } void -H3BloomFilter::decrement(const Address& addr) +H3BloomFilter::decrement(Addr addr) { // Not used } @@ -438,7 +438,7 @@ H3BloomFilter::merge(AbstractBloomFilter *other_filter) } void -H3BloomFilter::set(const Address& addr) +H3BloomFilter::set(Addr addr) { for (int i = 0; i < m_num_hashes; i++) { int idx = get_index(addr, i); @@ -447,14 +447,14 @@ H3BloomFilter::set(const Address& addr) } void -H3BloomFilter::unset(const Address& addr) +H3BloomFilter::unset(Addr addr) { cout << "ERROR: Unset should never be called in a Bloom filter"; assert(0); } bool -H3BloomFilter::isSet(const Address& addr) +H3BloomFilter::isSet(Addr addr) { bool res = true; @@ -466,13 +466,13 @@ H3BloomFilter::isSet(const Address& addr) } int -H3BloomFilter::getCount(const Address& addr) +H3BloomFilter::getCount(Addr addr) { return isSet(addr)? 1: 0; } int -H3BloomFilter::getIndex(const Address& addr) +H3BloomFilter::getIndex(Addr addr) { return 0; } @@ -505,9 +505,9 @@ H3BloomFilter::print(ostream& out) const } int -H3BloomFilter::get_index(const Address& addr, int i) +H3BloomFilter::get_index(Addr addr, int i) { - uint64 x = addr.getLineAddress(); + uint64 x = makeLineAddress(addr); // uint64 y = (x*mults_list[i] + adds_list[i]) % primes_list[i]; int y = hash_H3(x,i); diff --git a/src/mem/ruby/filters/H3BloomFilter.hh b/src/mem/ruby/filters/H3BloomFilter.hh index c63477b9a..8596d6acb 100644 --- a/src/mem/ruby/filters/H3BloomFilter.hh +++ b/src/mem/ruby/filters/H3BloomFilter.hh @@ -34,6 +34,7 @@ #include <vector> #include "mem/ruby/common/Address.hh" +#include "mem/ruby/common/TypeDefines.hh" #include "mem/ruby/filters/AbstractBloomFilter.hh" class H3BloomFilter : public AbstractBloomFilter @@ -43,18 +44,18 @@ class H3BloomFilter : public AbstractBloomFilter ~H3BloomFilter(); void clear(); - void increment(const Address& addr); - void decrement(const Address& addr); + void increment(Addr addr); + void decrement(Addr addr); void merge(AbstractBloomFilter * other_filter); - void set(const Address& addr); - void unset(const Address& addr); + void set(Addr addr); + void unset(Addr addr); - bool isSet(const Address& addr); - int getCount(const Address& addr); + bool isSet(Addr addr); + int getCount(Addr addr); int getTotalCount(); void print(std::ostream& out) const; - int getIndex(const Address& addr); + int getIndex(Addr addr); int readBit(const int index); void writeBit(const int index, const int value); @@ -65,7 +66,7 @@ class H3BloomFilter : public AbstractBloomFilter } private: - int get_index(const Address& addr, int hashNumber); + int get_index(Addr addr, int hashNumber); int hash_H3(uint64 value, int index); diff --git a/src/mem/ruby/filters/LSB_CountingBloomFilter.cc b/src/mem/ruby/filters/LSB_CountingBloomFilter.cc index 833680fb7..265e58625 100644 --- a/src/mem/ruby/filters/LSB_CountingBloomFilter.cc +++ b/src/mem/ruby/filters/LSB_CountingBloomFilter.cc @@ -65,7 +65,7 @@ LSB_CountingBloomFilter::clear() } void -LSB_CountingBloomFilter::increment(const Address& addr) +LSB_CountingBloomFilter::increment(Addr addr) { int i = get_index(addr); if (m_filter[i] < m_count) @@ -74,7 +74,7 @@ LSB_CountingBloomFilter::increment(const Address& addr) void -LSB_CountingBloomFilter::decrement(const Address& addr) +LSB_CountingBloomFilter::decrement(Addr addr) { int i = get_index(addr); if (m_filter[i] > 0) @@ -88,26 +88,26 @@ LSB_CountingBloomFilter::merge(AbstractBloomFilter * other_filter) } void -LSB_CountingBloomFilter::set(const Address& addr) +LSB_CountingBloomFilter::set(Addr addr) { // TODO } void -LSB_CountingBloomFilter::unset(const Address& addr) +LSB_CountingBloomFilter::unset(Addr addr) { // TODO } bool -LSB_CountingBloomFilter::isSet(const Address& addr) +LSB_CountingBloomFilter::isSet(Addr addr) { // TODO return false; } int -LSB_CountingBloomFilter::getCount(const Address& addr) +LSB_CountingBloomFilter::getCount(Addr addr) { return m_filter[get_index(addr)]; } @@ -124,7 +124,7 @@ LSB_CountingBloomFilter::getTotalCount() } int -LSB_CountingBloomFilter::getIndex(const Address& addr) +LSB_CountingBloomFilter::getIndex(Addr addr) { return get_index(addr); } @@ -148,11 +148,11 @@ LSB_CountingBloomFilter::writeBit(const int index, const int value) } int -LSB_CountingBloomFilter::get_index(const Address& addr) +LSB_CountingBloomFilter::get_index(Addr addr) { - return addr.bitSelect(RubySystem::getBlockSizeBits(), - RubySystem::getBlockSizeBits() + - m_filter_size_bits - 1); + return bitSelect(addr, RubySystem::getBlockSizeBits(), + RubySystem::getBlockSizeBits() + + m_filter_size_bits - 1); } diff --git a/src/mem/ruby/filters/LSB_CountingBloomFilter.hh b/src/mem/ruby/filters/LSB_CountingBloomFilter.hh index e6bb5cf19..2f23896e2 100644 --- a/src/mem/ruby/filters/LSB_CountingBloomFilter.hh +++ b/src/mem/ruby/filters/LSB_CountingBloomFilter.hh @@ -43,23 +43,23 @@ class LSB_CountingBloomFilter : public AbstractBloomFilter ~LSB_CountingBloomFilter(); void clear(); - void increment(const Address& addr); - void decrement(const Address& addr); + void increment(Addr addr); + void decrement(Addr addr); void merge(AbstractBloomFilter * other_filter); - void set(const Address& addr); - void unset(const Address& addr); + void set(Addr addr); + void unset(Addr addr); - bool isSet(const Address& addr); - int getCount(const Address& addr); + bool isSet(Addr addr); + int getCount(Addr addr); int getTotalCount(); - int getIndex(const Address& addr); + int getIndex(Addr addr); int readBit(const int index); void writeBit(const int index, const int value); void print(std::ostream& out) const; private: - int get_index(const Address& addr); + int get_index(Addr addr); std::vector<int> m_filter; int m_filter_size; diff --git a/src/mem/ruby/filters/MultiBitSelBloomFilter.cc b/src/mem/ruby/filters/MultiBitSelBloomFilter.cc index 0f3ea8e2f..3cdca7e3b 100644 --- a/src/mem/ruby/filters/MultiBitSelBloomFilter.cc +++ b/src/mem/ruby/filters/MultiBitSelBloomFilter.cc @@ -76,14 +76,14 @@ MultiBitSelBloomFilter::clear() } void -MultiBitSelBloomFilter::increment(const Address& addr) +MultiBitSelBloomFilter::increment(Addr addr) { // Not used } void -MultiBitSelBloomFilter::decrement(const Address& addr) +MultiBitSelBloomFilter::decrement(Addr addr) { // Not used } @@ -99,7 +99,7 @@ MultiBitSelBloomFilter::merge(AbstractBloomFilter *other_filter) } void -MultiBitSelBloomFilter::set(const Address& addr) +MultiBitSelBloomFilter::set(Addr addr) { for (int i = 0; i < m_num_hashes; i++) { int idx = get_index(addr, i); @@ -108,14 +108,14 @@ MultiBitSelBloomFilter::set(const Address& addr) } void -MultiBitSelBloomFilter::unset(const Address& addr) +MultiBitSelBloomFilter::unset(Addr addr) { cout << "ERROR: Unset should never be called in a Bloom filter"; assert(0); } bool -MultiBitSelBloomFilter::isSet(const Address& addr) +MultiBitSelBloomFilter::isSet(Addr addr) { bool res = true; @@ -127,13 +127,13 @@ MultiBitSelBloomFilter::isSet(const Address& addr) } int -MultiBitSelBloomFilter::getCount(const Address& addr) +MultiBitSelBloomFilter::getCount(Addr addr) { return isSet(addr)? 1: 0; } int -MultiBitSelBloomFilter::getIndex(const Address& addr) +MultiBitSelBloomFilter::getIndex(Addr addr) { return 0; } @@ -166,12 +166,12 @@ MultiBitSelBloomFilter::print(ostream& out) const } int -MultiBitSelBloomFilter::get_index(const Address& addr, int i) +MultiBitSelBloomFilter::get_index(Addr addr, int i) { // m_skip_bits is used to perform BitSelect after skipping some // bits. Used to simulate BitSel hashing on larger than cache-line // granularities - uint64 x = (addr.getLineAddress()) >> m_skip_bits; + uint64 x = (makeLineAddress(addr) >> m_skip_bits); int y = hash_bitsel(x, i, m_num_hashes, 30, m_filter_size_bits); //36-bit addresses, 6-bit cache lines diff --git a/src/mem/ruby/filters/MultiBitSelBloomFilter.hh b/src/mem/ruby/filters/MultiBitSelBloomFilter.hh index 7edb45953..e43dcd6f1 100644 --- a/src/mem/ruby/filters/MultiBitSelBloomFilter.hh +++ b/src/mem/ruby/filters/MultiBitSelBloomFilter.hh @@ -34,6 +34,7 @@ #include <vector> #include "mem/ruby/common/Address.hh" +#include "mem/ruby/common/TypeDefines.hh" #include "mem/ruby/filters/AbstractBloomFilter.hh" class MultiBitSelBloomFilter : public AbstractBloomFilter @@ -43,18 +44,18 @@ class MultiBitSelBloomFilter : public AbstractBloomFilter ~MultiBitSelBloomFilter(); void clear(); - void increment(const Address& addr); - void decrement(const Address& addr); + void increment(Addr addr); + void decrement(Addr addr); void merge(AbstractBloomFilter * other_filter); - void set(const Address& addr); - void unset(const Address& addr); + void set(Addr addr); + void unset(Addr addr); - bool isSet(const Address& addr); - int getCount(const Address& addr); + bool isSet(Addr addr); + int getCount(Addr addr); int getTotalCount(); void print(std::ostream& out) const; - int getIndex(const Address& addr); + int getIndex(Addr addr); int readBit(const int index); void writeBit(const int index, const int value); @@ -65,7 +66,7 @@ class MultiBitSelBloomFilter : public AbstractBloomFilter } private: - int get_index(const Address& addr, int hashNumber); + int get_index(Addr addr, int hashNumber); int hash_bitsel(uint64 value, int index, int jump, int maxBits, int numBits); diff --git a/src/mem/ruby/filters/MultiGrainBloomFilter.cc b/src/mem/ruby/filters/MultiGrainBloomFilter.cc index 4f8775853..33d80f0c4 100644 --- a/src/mem/ruby/filters/MultiGrainBloomFilter.cc +++ b/src/mem/ruby/filters/MultiGrainBloomFilter.cc @@ -72,14 +72,14 @@ MultiGrainBloomFilter::clear() } void -MultiGrainBloomFilter::increment(const Address& addr) +MultiGrainBloomFilter::increment(Addr addr) { // Not used } void -MultiGrainBloomFilter::decrement(const Address& addr) +MultiGrainBloomFilter::decrement(Addr addr) { // Not used } @@ -91,7 +91,7 @@ MultiGrainBloomFilter::merge(AbstractBloomFilter *other_filter) } void -MultiGrainBloomFilter::set(const Address& addr) +MultiGrainBloomFilter::set(Addr addr) { int i = get_block_index(addr); assert(i < m_filter_size); @@ -102,13 +102,13 @@ MultiGrainBloomFilter::set(const Address& addr) } void -MultiGrainBloomFilter::unset(const Address& addr) +MultiGrainBloomFilter::unset(Addr addr) { // not used } bool -MultiGrainBloomFilter::isSet(const Address& addr) +MultiGrainBloomFilter::isSet(Addr addr) { int i = get_block_index(addr); assert(i < m_filter_size); @@ -118,7 +118,7 @@ MultiGrainBloomFilter::isSet(const Address& addr) } int -MultiGrainBloomFilter::getCount(const Address& addr) +MultiGrainBloomFilter::getCount(Addr addr) { // not used return 0; @@ -141,7 +141,7 @@ MultiGrainBloomFilter::getTotalCount() } int -MultiGrainBloomFilter::getIndex(const Address& addr) +MultiGrainBloomFilter::getIndex(Addr addr) { return 0; // TODO @@ -166,21 +166,21 @@ MultiGrainBloomFilter::print(ostream& out) const } int -MultiGrainBloomFilter::get_block_index(const Address& addr) +MultiGrainBloomFilter::get_block_index(Addr addr) { // grap a chunk of bits after byte offset - return addr.bitSelect(RubySystem::getBlockSizeBits(), - RubySystem::getBlockSizeBits() + - m_filter_size_bits - 1); + return bitSelect(addr, RubySystem::getBlockSizeBits(), + RubySystem::getBlockSizeBits() + + m_filter_size_bits - 1); } int -MultiGrainBloomFilter::get_page_index(const Address & addr) +MultiGrainBloomFilter::get_page_index(Addr addr) { int bits = RubySystem::getBlockSizeBits() + m_filter_size_bits - 1; // grap a chunk of bits after first chunk - return addr.bitSelect(bits, bits + m_page_filter_size_bits - 1); + return bitSelect(addr, bits, bits + m_page_filter_size_bits - 1); } diff --git a/src/mem/ruby/filters/MultiGrainBloomFilter.hh b/src/mem/ruby/filters/MultiGrainBloomFilter.hh index 26a8113cb..ceb364a49 100644 --- a/src/mem/ruby/filters/MultiGrainBloomFilter.hh +++ b/src/mem/ruby/filters/MultiGrainBloomFilter.hh @@ -43,24 +43,24 @@ class MultiGrainBloomFilter : public AbstractBloomFilter ~MultiGrainBloomFilter(); void clear(); - void increment(const Address& addr); - void decrement(const Address& addr); + void increment(Addr addr); + void decrement(Addr addr); void merge(AbstractBloomFilter * other_filter); - void set(const Address& addr); - void unset(const Address& addr); + void set(Addr addr); + void unset(Addr addr); - bool isSet(const Address& addr); - int getCount(const Address& addr); + bool isSet(Addr addr); + int getCount(Addr addr); int getTotalCount(); - int getIndex(const Address& addr); + int getIndex(Addr addr); int readBit(const int index); void writeBit(const int index, const int value); void print(std::ostream& out) const; private: - int get_block_index(const Address& addr); - int get_page_index(const Address & addr); + int get_block_index(Addr addr); + int get_page_index(Addr addr); // The block filter std::vector<int> m_filter; diff --git a/src/mem/ruby/filters/NonCountingBloomFilter.cc b/src/mem/ruby/filters/NonCountingBloomFilter.cc index 246189357..14bb3a245 100644 --- a/src/mem/ruby/filters/NonCountingBloomFilter.cc +++ b/src/mem/ruby/filters/NonCountingBloomFilter.cc @@ -64,13 +64,13 @@ NonCountingBloomFilter::clear() } void -NonCountingBloomFilter::increment(const Address& addr) +NonCountingBloomFilter::increment(Addr addr) { // Not used } void -NonCountingBloomFilter::decrement(const Address& addr) +NonCountingBloomFilter::decrement(Addr addr) { // Not used } @@ -86,21 +86,21 @@ NonCountingBloomFilter::merge(AbstractBloomFilter *other_filter) } void -NonCountingBloomFilter::set(const Address& addr) +NonCountingBloomFilter::set(Addr addr) { int i = get_index(addr); m_filter[i] = 1; } void -NonCountingBloomFilter::unset(const Address& addr) +NonCountingBloomFilter::unset(Addr addr) { int i = get_index(addr); m_filter[i] = 0; } bool -NonCountingBloomFilter::isSet(const Address& addr) +NonCountingBloomFilter::isSet(Addr addr) { int i = get_index(addr); return (m_filter[i]); @@ -108,7 +108,7 @@ NonCountingBloomFilter::isSet(const Address& addr) int -NonCountingBloomFilter::getCount(const Address& addr) +NonCountingBloomFilter::getCount(Addr addr) { return m_filter[get_index(addr)]; } @@ -130,7 +130,7 @@ NonCountingBloomFilter::print(ostream& out) const } int -NonCountingBloomFilter::getIndex(const Address& addr) +NonCountingBloomFilter::getIndex(Addr addr) { return get_index(addr); } @@ -148,11 +148,11 @@ NonCountingBloomFilter::writeBit(const int index, const int value) } int -NonCountingBloomFilter::get_index(const Address& addr) +NonCountingBloomFilter::get_index(Addr addr) { - return addr.bitSelect(RubySystem::getBlockSizeBits() + m_offset, - RubySystem::getBlockSizeBits() + m_offset + - m_filter_size_bits - 1); + return bitSelect(addr, RubySystem::getBlockSizeBits() + m_offset, + RubySystem::getBlockSizeBits() + m_offset + + m_filter_size_bits - 1); } diff --git a/src/mem/ruby/filters/NonCountingBloomFilter.hh b/src/mem/ruby/filters/NonCountingBloomFilter.hh index 9eec25528..a092cd667 100644 --- a/src/mem/ruby/filters/NonCountingBloomFilter.hh +++ b/src/mem/ruby/filters/NonCountingBloomFilter.hh @@ -43,17 +43,17 @@ class NonCountingBloomFilter : public AbstractBloomFilter ~NonCountingBloomFilter(); void clear(); - void increment(const Address& addr); - void decrement(const Address& addr); + void increment(Addr addr); + void decrement(Addr addr); void merge(AbstractBloomFilter * other_filter); - void set(const Address& addr); - void unset(const Address& addr); + void set(Addr addr); + void unset(Addr addr); - bool isSet(const Address& addr); - int getCount(const Address& addr); + bool isSet(Addr addr); + int getCount(Addr addr); int getTotalCount(); - int getIndex(const Address& addr); + int getIndex(Addr addr); int readBit(const int index); void writeBit(const int index, const int value); @@ -66,7 +66,7 @@ class NonCountingBloomFilter : public AbstractBloomFilter } private: - int get_index(const Address& addr); + int get_index(Addr addr); std::vector<int> m_filter; int m_filter_size; diff --git a/src/mem/ruby/network/MessageBuffer.cc b/src/mem/ruby/network/MessageBuffer.cc index e9bbd0059..a72d8509e 100644 --- a/src/mem/ruby/network/MessageBuffer.cc +++ b/src/mem/ruby/network/MessageBuffer.cc @@ -289,7 +289,7 @@ MessageBuffer::reanalyzeList(list<MsgPtr> <, Tick schdTick) } void -MessageBuffer::reanalyzeMessages(const Address& addr) +MessageBuffer::reanalyzeMessages(Addr addr) { DPRINTF(RubyQueue, "ReanalyzeMessages %s\n", addr); assert(m_stall_msg_map.count(addr) > 0); @@ -325,11 +325,11 @@ MessageBuffer::reanalyzeAllMessages() } void -MessageBuffer::stallMessage(const Address& addr) +MessageBuffer::stallMessage(Addr addr) { DPRINTF(RubyQueue, "Stalling due to %s\n", addr); assert(isReady()); - assert(addr.getOffset() == 0); + assert(getOffset(addr) == 0); MsgPtr message = m_prio_heap.front(); dequeue(); diff --git a/src/mem/ruby/network/MessageBuffer.hh b/src/mem/ruby/network/MessageBuffer.hh index d47284eb1..732b7ec6c 100644 --- a/src/mem/ruby/network/MessageBuffer.hh +++ b/src/mem/ruby/network/MessageBuffer.hh @@ -55,9 +55,9 @@ class MessageBuffer : public SimObject typedef MessageBufferParams Params; MessageBuffer(const Params *p); - void reanalyzeMessages(const Address& addr); + void reanalyzeMessages(Addr addr); void reanalyzeAllMessages(); - void stallMessage(const Address& addr); + void stallMessage(Addr addr); // TRUE if head of queue timestamp <= SystemTime bool isReady() const; @@ -165,7 +165,7 @@ class MessageBuffer : public SimObject // use a std::map for the stalled messages as this container is // sorted and ensures a well-defined iteration order - typedef std::map< Address, std::list<MsgPtr> > StallMsgMapType; + typedef std::map<Addr, std::list<MsgPtr> > StallMsgMapType; StallMsgMapType m_stall_msg_map; diff --git a/src/mem/ruby/profiler/AccessTraceForAddress.hh b/src/mem/ruby/profiler/AccessTraceForAddress.hh index acd03a3fa..af42489bc 100644 --- a/src/mem/ruby/profiler/AccessTraceForAddress.hh +++ b/src/mem/ruby/profiler/AccessTraceForAddress.hh @@ -47,13 +47,13 @@ class AccessTraceForAddress { } ~AccessTraceForAddress(); - void setAddress(const Address& addr) { m_addr = addr; } + void setAddress(Addr addr) { m_addr = addr; } void update(RubyRequestType type, RubyAccessMode access_mode, NodeID cpu, bool sharing_miss); int getTotal() const; int getSharing() const { return m_sharing; } int getTouchedBy() const { return m_touched_by.count(); } - const Address& getAddress() const { return m_addr; } + Addr getAddress() const { return m_addr; } void addSample(int value); void print(std::ostream& out) const; @@ -66,7 +66,7 @@ class AccessTraceForAddress } private: - Address m_addr; + Addr m_addr; uint64 m_loads; uint64 m_stores; uint64 m_atomics; diff --git a/src/mem/ruby/profiler/AddressProfiler.cc b/src/mem/ruby/profiler/AddressProfiler.cc index a2e41ee76..0e7ea7e36 100644 --- a/src/mem/ruby/profiler/AddressProfiler.cc +++ b/src/mem/ruby/profiler/AddressProfiler.cc @@ -40,7 +40,7 @@ using m5::stl_helpers::operator<<; // Helper functions AccessTraceForAddress& -lookupTraceForAddress(const Address& addr, AddressMap& record_map) +lookupTraceForAddress(Addr addr, AddressMap& record_map) { // we create a static default object here that is used to insert // since the insertion will create a copy of the object in the @@ -244,7 +244,7 @@ AddressProfiler::clearStats() } void -AddressProfiler::profileGetX(const Address& datablock, const Address& PC, +AddressProfiler::profileGetX(Addr datablock, Addr PC, const Set& owner, const Set& sharers, NodeID requestor) { @@ -262,7 +262,7 @@ AddressProfiler::profileGetX(const Address& datablock, const Address& PC, } void -AddressProfiler::profileGetS(const Address& datablock, const Address& PC, +AddressProfiler::profileGetS(Addr datablock, Addr PC, const Set& owner, const Set& sharers, NodeID requestor) { @@ -279,7 +279,7 @@ AddressProfiler::profileGetS(const Address& datablock, const Address& PC, } void -AddressProfiler::addTraceSample(Address data_addr, Address pc_addr, +AddressProfiler::addTraceSample(Addr data_addr, Addr pc_addr, RubyRequestType type, RubyAccessMode access_mode, NodeID id, bool sharing_miss) @@ -290,14 +290,14 @@ AddressProfiler::addTraceSample(Address data_addr, Address pc_addr, } // record data address trace info - data_addr.makeLineAddress(); + data_addr = makeLineAddress(data_addr); lookupTraceForAddress(data_addr, m_dataAccessTrace). update(type, access_mode, id, sharing_miss); // record macro data address trace info // 6 for datablock, 4 to make it 16x more coarse - Address macro_addr(data_addr.maskLowOrderBits(10)); + Addr macro_addr = maskLowOrderBits(data_addr, 10); lookupTraceForAddress(macro_addr, m_macroBlockAccessTrace). update(type, access_mode, id, sharing_miss); @@ -316,8 +316,7 @@ AddressProfiler::addTraceSample(Address data_addr, Address pc_addr, } void -AddressProfiler::profileRetry(const Address& data_addr, AccessType type, - int count) +AddressProfiler::profileRetry(Addr data_addr, AccessType type, int count) { m_retryProfileHisto.add(count); if (type == AccessType_Read) { diff --git a/src/mem/ruby/profiler/AddressProfiler.hh b/src/mem/ruby/profiler/AddressProfiler.hh index ff9b39e81..39544c0a2 100644 --- a/src/mem/ruby/profiler/AddressProfiler.hh +++ b/src/mem/ruby/profiler/AddressProfiler.hh @@ -44,7 +44,7 @@ class Set; class AddressProfiler { public: - typedef m5::hash_map<Address, AccessTraceForAddress> AddressMap; + typedef m5::hash_map<Addr, AccessTraceForAddress> AddressMap; public: AddressProfiler(int num_of_sequencers, Profiler *profiler); @@ -53,13 +53,13 @@ class AddressProfiler void printStats(std::ostream& out) const; void clearStats(); - void addTraceSample(Address data_addr, Address pc_addr, + void addTraceSample(Addr data_addr, Addr pc_addr, RubyRequestType type, RubyAccessMode access_mode, NodeID id, bool sharing_miss); - void profileRetry(const Address& data_addr, AccessType type, int count); - void profileGetX(const Address& datablock, const Address& PC, + void profileRetry(Addr data_addr, AccessType type, int count); + void profileGetX(Addr datablock, Addr PC, const Set& owner, const Set& sharers, NodeID requestor); - void profileGetS(const Address& datablock, const Address& PC, + void profileGetS(Addr datablock, Addr PC, const Set& owner, const Set& sharers, NodeID requestor); void print(std::ostream& out) const; @@ -96,7 +96,7 @@ class AddressProfiler int m_num_of_sequencers; }; -AccessTraceForAddress& lookupTraceForAddress(const Address& addr, +AccessTraceForAddress& lookupTraceForAddress(Addr addr, AddressProfiler::AddressMap& record_map); diff --git a/src/mem/ruby/profiler/StoreTrace.cc b/src/mem/ruby/profiler/StoreTrace.cc index 1c462dd25..40bf2e7b6 100644 --- a/src/mem/ruby/profiler/StoreTrace.cc +++ b/src/mem/ruby/profiler/StoreTrace.cc @@ -40,7 +40,7 @@ Histogram* StoreTrace::s_store_first_to_stolen_ptr = NULL; Histogram* StoreTrace::s_store_last_to_stolen_ptr = NULL; Histogram* StoreTrace::s_store_first_to_last_ptr = NULL; -StoreTrace::StoreTrace(const Address& addr) +StoreTrace::StoreTrace(Addr addr) : m_store_count(-1), m_store_first_to_stolen(-1), m_store_last_to_stolen(-1), m_store_first_to_last(-1) { diff --git a/src/mem/ruby/profiler/StoreTrace.hh b/src/mem/ruby/profiler/StoreTrace.hh index ac38a420b..9c1b83cd6 100644 --- a/src/mem/ruby/profiler/StoreTrace.hh +++ b/src/mem/ruby/profiler/StoreTrace.hh @@ -39,7 +39,7 @@ class StoreTrace { public: StoreTrace() { } - explicit StoreTrace(const Address& addr); + explicit StoreTrace(Addr addr); ~StoreTrace(); void store(NodeID node); @@ -60,7 +60,7 @@ class StoreTrace static Histogram* s_store_last_to_stolen_ptr; static Histogram* s_store_first_to_last_ptr; - Address m_addr; + Addr m_addr; NodeID m_last_writer; Tick m_first_store; Tick m_last_store; diff --git a/src/mem/ruby/slicc_interface/AbstractCacheEntry.cc b/src/mem/ruby/slicc_interface/AbstractCacheEntry.cc index 137a6c950..01fd3f522 100644 --- a/src/mem/ruby/slicc_interface/AbstractCacheEntry.cc +++ b/src/mem/ruby/slicc_interface/AbstractCacheEntry.cc @@ -31,7 +31,7 @@ AbstractCacheEntry::AbstractCacheEntry() { m_Permission = AccessPermission_NotPresent; - m_Address.setAddress(0); + m_Address = 0; m_locked = -1; } diff --git a/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh b/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh index 2ba128493..6c7a4a008 100644 --- a/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh +++ b/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh @@ -57,7 +57,7 @@ class AbstractCacheEntry : public AbstractEntry { panic("getDataBlk() not implemented!"); } - Address m_Address; // Address of this block, required by CacheMemory + Addr m_Address; // Address of this block, required by CacheMemory int m_locked; // Holds info whether the address is locked, // required for implementing LL/SC }; diff --git a/src/mem/ruby/slicc_interface/AbstractController.cc b/src/mem/ruby/slicc_interface/AbstractController.cc index 64d581359..9ed8b08d0 100644 --- a/src/mem/ruby/slicc_interface/AbstractController.cc +++ b/src/mem/ruby/slicc_interface/AbstractController.cc @@ -93,7 +93,7 @@ AbstractController::profileMsgDelay(uint32_t virtualNetwork, Cycles delay) } void -AbstractController::stallBuffer(MessageBuffer* buf, Address addr) +AbstractController::stallBuffer(MessageBuffer* buf, Addr addr) { if (m_waiting_buffers.count(addr) == 0) { MsgVecType* msgVec = new MsgVecType; @@ -107,7 +107,7 @@ AbstractController::stallBuffer(MessageBuffer* buf, Address addr) } void -AbstractController::wakeUpBuffers(Address addr) +AbstractController::wakeUpBuffers(Addr addr) { if (m_waiting_buffers.count(addr) > 0) { // @@ -127,7 +127,7 @@ AbstractController::wakeUpBuffers(Address addr) } void -AbstractController::wakeUpAllBuffers(Address addr) +AbstractController::wakeUpAllBuffers(Addr addr) { if (m_waiting_buffers.count(addr) > 0) { // @@ -186,14 +186,14 @@ AbstractController::wakeUpAllBuffers() } void -AbstractController::blockOnQueue(Address addr, MessageBuffer* port) +AbstractController::blockOnQueue(Addr addr, MessageBuffer* port) { m_is_blocking = true; m_block_map[addr] = port; } void -AbstractController::unblock(Address addr) +AbstractController::unblock(Addr addr) { m_block_map.erase(addr); if (m_block_map.size() == 0) { @@ -209,11 +209,10 @@ AbstractController::getMasterPort(const std::string &if_name, } void -AbstractController::queueMemoryRead(const MachineID &id, Address addr, +AbstractController::queueMemoryRead(const MachineID &id, Addr addr, Cycles latency) { - RequestPtr req = new Request(addr.getAddress(), - RubySystem::getBlockSizeBytes(), 0, + RequestPtr req = new Request(addr, RubySystem::getBlockSizeBytes(), 0, m_masterId); PacketPtr pkt = Packet::createRead(req); @@ -234,11 +233,10 @@ AbstractController::queueMemoryRead(const MachineID &id, Address addr, } void -AbstractController::queueMemoryWrite(const MachineID &id, Address addr, +AbstractController::queueMemoryWrite(const MachineID &id, Addr addr, Cycles latency, const DataBlock &block) { - RequestPtr req = new Request(addr.getAddress(), - RubySystem::getBlockSizeBytes(), 0, + RequestPtr req = new Request(addr, RubySystem::getBlockSizeBytes(), 0, m_masterId); PacketPtr pkt = Packet::createWrite(req); @@ -262,18 +260,17 @@ AbstractController::queueMemoryWrite(const MachineID &id, Address addr, } void -AbstractController::queueMemoryWritePartial(const MachineID &id, Address addr, +AbstractController::queueMemoryWritePartial(const MachineID &id, Addr addr, Cycles latency, const DataBlock &block, int size) { - RequestPtr req = new Request(addr.getAddress(), - RubySystem::getBlockSizeBytes(), 0, + RequestPtr req = new Request(addr, RubySystem::getBlockSizeBytes(), 0, m_masterId); PacketPtr pkt = Packet::createWrite(req); uint8_t *newData = new uint8_t[size]; pkt->dataDynamic(newData); - memcpy(newData, block.getData(addr.getOffset(), size), size); + memcpy(newData, block.getData(getOffset(addr), size), size); SenderState *s = new SenderState(id); pkt->pushSenderState(s); @@ -310,7 +307,7 @@ AbstractController::recvTimingResp(PacketPtr pkt) assert(pkt->isResponse()); std::shared_ptr<MemoryMsg> msg = std::make_shared<MemoryMsg>(clockEdge()); - (*msg).m_addr.setAddress(pkt->getAddr()); + (*msg).m_addr = pkt->getAddr(); (*msg).m_Sender = m_machineID; SenderState *s = dynamic_cast<SenderState *>(pkt->senderState); diff --git a/src/mem/ruby/slicc_interface/AbstractController.hh b/src/mem/ruby/slicc_interface/AbstractController.hh index afde97b1f..94361034a 100644 --- a/src/mem/ruby/slicc_interface/AbstractController.hh +++ b/src/mem/ruby/slicc_interface/AbstractController.hh @@ -71,12 +71,12 @@ class AbstractController : public MemObject, public Consumer void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; } // return instance name - void blockOnQueue(Address, MessageBuffer*); - void unblock(Address); + void blockOnQueue(Addr, MessageBuffer*); + void unblock(Addr); virtual MessageBuffer* getMandatoryQueue() const = 0; virtual MessageBuffer* getMemoryQueue() const = 0; - virtual AccessPermission getAccessPermission(const Address& addr) = 0; + virtual AccessPermission getAccessPermission(const Addr &addr) = 0; virtual void print(std::ostream & out) const = 0; virtual void wakeup() = 0; @@ -88,16 +88,16 @@ class AbstractController : public MemObject, public Consumer //! These functions are used by ruby system to read/write the data blocks //! that exist with in the controller. - virtual void functionalRead(const Address &addr, PacketPtr) = 0; + virtual void functionalRead(const Addr &addr, PacketPtr) = 0; void functionalMemoryRead(PacketPtr); //! The return value indicates the number of messages written with the //! data from the packet. virtual int functionalWriteBuffers(PacketPtr&) = 0; - virtual int functionalWrite(const Address &addr, PacketPtr) = 0; + virtual int functionalWrite(const Addr &addr, PacketPtr) = 0; int functionalMemoryWrite(PacketPtr); //! Function for enqueuing a prefetch request - virtual void enqueuePrefetch(const Address&, const RubyRequestType&) + virtual void enqueuePrefetch(const Addr &, const RubyRequestType&) { fatal("Prefetches not implemented!");} //! Function for collating statistics from all the controllers of this @@ -113,10 +113,10 @@ class AbstractController : public MemObject, public Consumer BaseMasterPort& getMasterPort(const std::string& if_name, PortID idx = InvalidPortID); - void queueMemoryRead(const MachineID &id, Address addr, Cycles latency); - void queueMemoryWrite(const MachineID &id, Address addr, Cycles latency, + void queueMemoryRead(const MachineID &id, Addr addr, Cycles latency); + void queueMemoryWrite(const MachineID &id, Addr addr, Cycles latency, const DataBlock &block); - void queueMemoryWritePartial(const MachineID &id, Address addr, Cycles latency, + void queueMemoryWritePartial(const MachineID &id, Addr addr, Cycles latency, const DataBlock &block, int size); void recvTimingResp(PacketPtr pkt); @@ -133,9 +133,9 @@ class AbstractController : public MemObject, public Consumer //! Profiles the delay associated with messages. void profileMsgDelay(uint32_t virtualNetwork, Cycles delay); - void stallBuffer(MessageBuffer* buf, Address addr); - void wakeUpBuffers(Address addr); - void wakeUpAllBuffers(Address addr); + void stallBuffer(MessageBuffer* buf, Addr addr); + void wakeUpBuffers(Addr addr); + void wakeUpAllBuffers(Addr addr); void wakeUpAllBuffers(); protected: @@ -148,11 +148,11 @@ class AbstractController : public MemObject, public Consumer Network* m_net_ptr; bool m_is_blocking; - std::map<Address, MessageBuffer*> m_block_map; + std::map<Addr, MessageBuffer*> m_block_map; typedef std::vector<MessageBuffer*> MsgVecType; typedef std::set<MessageBuffer*> MsgBufType; - typedef std::map< Address, MsgVecType* > WaitingBufType; + typedef std::map<Addr, MsgVecType* > WaitingBufType; WaitingBufType m_waiting_buffers; unsigned int m_in_ports; diff --git a/src/mem/ruby/slicc_interface/RubyRequest.cc b/src/mem/ruby/slicc_interface/RubyRequest.cc index e2f275006..350508671 100644 --- a/src/mem/ruby/slicc_interface/RubyRequest.cc +++ b/src/mem/ruby/slicc_interface/RubyRequest.cc @@ -69,7 +69,7 @@ RubyRequest::functionalWrite(Packet *pkt) Addr wBase = pkt->getAddr(); Addr wTail = wBase + pkt->getSize(); - Addr mBase = m_PhysicalAddress.getAddress(); + Addr mBase = m_PhysicalAddress; Addr mTail = mBase + m_Size; const uint8_t * pktData = pkt->getConstPtr<uint8_t>(); diff --git a/src/mem/ruby/slicc_interface/RubyRequest.hh b/src/mem/ruby/slicc_interface/RubyRequest.hh index cdb04bceb..b17269a78 100644 --- a/src/mem/ruby/slicc_interface/RubyRequest.hh +++ b/src/mem/ruby/slicc_interface/RubyRequest.hh @@ -40,10 +40,10 @@ class RubyRequest : public Message { public: - Address m_PhysicalAddress; - Address m_LineAddress; + Addr m_PhysicalAddress; + Addr m_LineAddress; RubyRequestType m_Type; - Address m_ProgramCounter; + Addr m_ProgramCounter; RubyAccessMode m_AccessMode; int m_Size; PrefetchBit m_Prefetch; @@ -66,18 +66,17 @@ class RubyRequest : public Message pkt(_pkt), m_contextId(_proc_id) { - m_LineAddress = m_PhysicalAddress; - m_LineAddress.makeLineAddress(); + m_LineAddress = makeLineAddress(m_PhysicalAddress); } RubyRequest(Tick curTime) : Message(curTime) {} MsgPtr clone() const { return std::shared_ptr<Message>(new RubyRequest(*this)); } - const Address& getLineAddress() const { return m_LineAddress; } - const Address& getPhysicalAddress() const { return m_PhysicalAddress; } + Addr getLineAddress() const { return m_LineAddress; } + Addr getPhysicalAddress() const { return m_PhysicalAddress; } const RubyRequestType& getType() const { return m_Type; } - const Address& getProgramCounter() const { return m_ProgramCounter; } + Addr getProgramCounter() const { return m_ProgramCounter; } const RubyAccessMode& getAccessMode() const { return m_AccessMode; } const int& getSize() const { return m_Size; } const PrefetchBit& getPrefetch() const { return m_Prefetch; } @@ -95,4 +94,4 @@ operator<<(std::ostream& out, const RubyRequest& obj) return out; } -#endif +#endif // __MEM_RUBY_SLICC_INTERFACE_RUBY_REQUEST_HH__ diff --git a/src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh b/src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh index 14d24f028..46071335e 100644 --- a/src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh +++ b/src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh @@ -38,7 +38,7 @@ // used to determine the home directory // returns a value between 0 and total_directories_within_the_system inline NodeID -map_Address_to_DirectoryNode(const Address& addr) +map_Address_to_DirectoryNode(Addr addr) { return DirectoryMemory::mapAddressToDirectoryVersion(addr); } @@ -46,7 +46,7 @@ map_Address_to_DirectoryNode(const Address& addr) // used to determine the home directory // returns a value between 0 and total_directories_within_the_system inline MachineID -map_Address_to_Directory(const Address &addr) +map_Address_to_Directory(Addr addr) { MachineID mach = {MachineType_Directory, map_Address_to_DirectoryNode(addr)}; @@ -65,14 +65,14 @@ broadcast(MachineType type) } inline MachineID -mapAddressToRange(const Address & addr, MachineType type, int low_bit, +mapAddressToRange(Addr addr, MachineType type, int low_bit, int num_bits, int cluster_id = 0) { MachineID mach = {type, 0}; if (num_bits == 0) mach.num = cluster_id; else - mach.num = addr.bitSelect(low_bit, low_bit + num_bits - 1) + mach.num = bitSelect(addr, low_bit, low_bit + num_bits - 1) + (1 << num_bits) * cluster_id; return mach; } diff --git a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh index 6318d8e33..61813bb30 100644 --- a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh +++ b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh @@ -36,9 +36,10 @@ #include <cassert> #include "debug/RubySlicc.hh" +#include "mem/packet.hh" #include "mem/ruby/common/Address.hh" #include "mem/ruby/common/DataBlock.hh" -#include "mem/packet.hh" +#include "mem/ruby/common/TypeDefines.hh" inline Cycles zero_time() { return Cycles(0); } @@ -57,35 +58,10 @@ IDToInt(NodeID id) } inline int -addressToInt(Address addr) -{ - assert(!(addr.getAddress() & 0xffffffff00000000)); - - return (int)addr.getAddress(); -} - -// Appends an offset to an address -inline Address -setOffset(Address addr, int offset) +addressToInt(Addr addr) { - Address result = addr; - result.setOffset(offset); - return result; -} - -// Makes an address into a line address -inline Address -makeLineAddress(Address addr) -{ - Address result = addr; - result.makeLineAddress(); - return result; -} - -inline int -addressOffset(Address addr) -{ - return addr.getOffset(); + assert(!(addr & 0xffffffff00000000)); + return addr; } inline int @@ -106,18 +82,15 @@ inline int max_tokens() * returned if the data block was read, otherwise false is returned. */ inline bool -testAndRead(Address addr, DataBlock& blk, Packet *pkt) +testAndRead(Addr addr, DataBlock& blk, Packet *pkt) { - Address pktLineAddr(pkt->getAddr()); - pktLineAddr.makeLineAddress(); - - Address lineAddr = addr; - lineAddr.makeLineAddress(); + Addr pktLineAddr = makeLineAddress(pkt->getAddr()); + Addr lineAddr = makeLineAddress(addr); if (pktLineAddr == lineAddr) { uint8_t *data = pkt->getPtr<uint8_t>(); unsigned int size_in_bytes = pkt->getSize(); - unsigned startByte = pkt->getAddr() - lineAddr.getAddress(); + unsigned startByte = pkt->getAddr() - lineAddr; for (unsigned i = 0; i < size_in_bytes; ++i) { data[i] = blk.getByte(i + startByte); @@ -134,18 +107,15 @@ testAndRead(Address addr, DataBlock& blk, Packet *pkt) * returned if the data block was written, otherwise false is returned. */ inline bool -testAndWrite(Address addr, DataBlock& blk, Packet *pkt) +testAndWrite(Addr addr, DataBlock& blk, Packet *pkt) { - Address pktLineAddr(pkt->getAddr()); - pktLineAddr.makeLineAddress(); - - Address lineAddr = addr; - lineAddr.makeLineAddress(); + Addr pktLineAddr = makeLineAddress(pkt->getAddr()); + Addr lineAddr = makeLineAddress(addr); if (pktLineAddr == lineAddr) { const uint8_t *data = pkt->getConstPtr<uint8_t>(); unsigned int size_in_bytes = pkt->getSize(); - unsigned startByte = pkt->getAddr() - lineAddr.getAddress(); + unsigned startByte = pkt->getAddr() - lineAddr; for (unsigned i = 0; i < size_in_bytes; ++i) { blk.setByte(i + startByte, data[i]); diff --git a/src/mem/ruby/structures/CacheMemory.cc b/src/mem/ruby/structures/CacheMemory.cc index 64a8e9e8a..7eba450c1 100644 --- a/src/mem/ruby/structures/CacheMemory.cc +++ b/src/mem/ruby/structures/CacheMemory.cc @@ -99,21 +99,21 @@ CacheMemory::~CacheMemory() // convert a Address to its location in the cache int64 -CacheMemory::addressToCacheSet(const Address& address) const +CacheMemory::addressToCacheSet(Addr address) const { - assert(address == line_address(address)); - return address.bitSelect(m_start_index_bit, - m_start_index_bit + m_cache_num_set_bits - 1); + assert(address == makeLineAddress(address)); + return bitSelect(address, m_start_index_bit, + m_start_index_bit + m_cache_num_set_bits - 1); } // Given a cache index: returns the index of the tag in a set. // returns -1 if the tag is not found. int -CacheMemory::findTagInSet(int64 cacheSet, const Address& tag) const +CacheMemory::findTagInSet(int64 cacheSet, Addr tag) const { - assert(tag == line_address(tag)); + assert(tag == makeLineAddress(tag)); // search the set for the tags - m5::hash_map<Address, int>::const_iterator it = m_tag_index.find(tag); + m5::hash_map<Addr, int>::const_iterator it = m_tag_index.find(tag); if (it != m_tag_index.end()) if (m_cache[cacheSet][it->second]->m_Permission != AccessPermission_NotPresent) @@ -125,11 +125,11 @@ CacheMemory::findTagInSet(int64 cacheSet, const Address& tag) const // returns -1 if the tag is not found. int CacheMemory::findTagInSetIgnorePermissions(int64 cacheSet, - const Address& tag) const + Addr tag) const { - assert(tag == line_address(tag)); + assert(tag == makeLineAddress(tag)); // search the set for the tags - m5::hash_map<Address, int>::const_iterator it = m_tag_index.find(tag); + m5::hash_map<Addr, int>::const_iterator it = m_tag_index.find(tag); if (it != m_tag_index.end()) return it->second; return -1; // Not found @@ -138,10 +138,10 @@ CacheMemory::findTagInSetIgnorePermissions(int64 cacheSet, // Given an unique cache block identifier (idx): return the valid address // stored by the cache block. If the block is invalid/notpresent, the // function returns the 0 address -Address +Addr CacheMemory::getAddressAtIdx(int idx) const { - Address tmp(0); + Addr tmp(0); int set = idx / m_cache_assoc; assert(set < m_cache_num_sets); @@ -159,10 +159,10 @@ CacheMemory::getAddressAtIdx(int idx) const } bool -CacheMemory::tryCacheAccess(const Address& address, RubyRequestType type, +CacheMemory::tryCacheAccess(Addr address, RubyRequestType type, DataBlock*& data_ptr) { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); DPRINTF(RubyCache, "address: %s\n", address); int64 cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); @@ -186,10 +186,10 @@ CacheMemory::tryCacheAccess(const Address& address, RubyRequestType type, } bool -CacheMemory::testCacheAccess(const Address& address, RubyRequestType type, +CacheMemory::testCacheAccess(Addr address, RubyRequestType type, DataBlock*& data_ptr) { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); DPRINTF(RubyCache, "address: %s\n", address); int64 cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); @@ -210,9 +210,9 @@ CacheMemory::testCacheAccess(const Address& address, RubyRequestType type, // tests to see if an address is present in the cache bool -CacheMemory::isTagPresent(const Address& address) const +CacheMemory::isTagPresent(Addr address) const { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); int64 cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); @@ -229,9 +229,9 @@ CacheMemory::isTagPresent(const Address& address) const // a) a tag match on this address or there is // b) an unused line in the same cache "way" bool -CacheMemory::cacheAvail(const Address& address) const +CacheMemory::cacheAvail(Addr address) const { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); int64 cacheSet = addressToCacheSet(address); @@ -251,9 +251,9 @@ CacheMemory::cacheAvail(const Address& address) const } AbstractCacheEntry* -CacheMemory::allocate(const Address& address, AbstractCacheEntry* entry, bool touch) +CacheMemory::allocate(Addr address, AbstractCacheEntry* entry, bool touch) { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); assert(!isTagPresent(address)); assert(cacheAvail(address)); DPRINTF(RubyCache, "address: %s\n", address); @@ -282,9 +282,9 @@ CacheMemory::allocate(const Address& address, AbstractCacheEntry* entry, bool to } void -CacheMemory::deallocate(const Address& address) +CacheMemory::deallocate(Addr address) { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); assert(isTagPresent(address)); DPRINTF(RubyCache, "address: %s\n", address); int64 cacheSet = addressToCacheSet(address); @@ -297,10 +297,10 @@ CacheMemory::deallocate(const Address& address) } // Returns with the physical address of the conflicting cache line -Address -CacheMemory::cacheProbe(const Address& address) const +Addr +CacheMemory::cacheProbe(Addr address) const { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); assert(!cacheAvail(address)); int64 cacheSet = addressToCacheSet(address); @@ -310,9 +310,9 @@ CacheMemory::cacheProbe(const Address& address) const // looks an address up in the cache AbstractCacheEntry* -CacheMemory::lookup(const Address& address) +CacheMemory::lookup(Addr address) { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); int64 cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); if(loc == -1) return NULL; @@ -321,9 +321,9 @@ CacheMemory::lookup(const Address& address) // looks an address up in the cache const AbstractCacheEntry* -CacheMemory::lookup(const Address& address) const +CacheMemory::lookup(Addr address) const { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); int64 cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); if(loc == -1) return NULL; @@ -332,7 +332,7 @@ CacheMemory::lookup(const Address& address) const // Sets the most recently used bit for a cache block void -CacheMemory::setMRU(const Address& address) +CacheMemory::setMRU(Addr address) { int64 cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); @@ -364,7 +364,7 @@ CacheMemory::recordCacheContents(int cntrl, CacheRecorder* tr) const } if (request_type != RubyRequestType_NULL) { - tr->addRecord(cntrl, m_cache[i][j]->m_Address.getAddress(), + tr->addRecord(cntrl, m_cache[i][j]->m_Address, 0, request_type, m_replacementPolicy_ptr->getLastAccess(i, j), m_cache[i][j]->getDataBlk()); @@ -406,10 +406,10 @@ CacheMemory::printData(ostream& out) const } void -CacheMemory::setLocked(const Address& address, int context) +CacheMemory::setLocked(Addr address, int context) { DPRINTF(RubyCache, "Setting Lock for addr: %x to %d\n", address, context); - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); int64 cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); assert(loc != -1); @@ -417,10 +417,10 @@ CacheMemory::setLocked(const Address& address, int context) } void -CacheMemory::clearLocked(const Address& address) +CacheMemory::clearLocked(Addr address) { DPRINTF(RubyCache, "Clear Lock for addr: %x\n", address); - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); int64 cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); assert(loc != -1); @@ -428,9 +428,9 @@ CacheMemory::clearLocked(const Address& address) } bool -CacheMemory::isLocked(const Address& address, int context) +CacheMemory::isLocked(Addr address, int context) { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); int64 cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); assert(loc != -1); @@ -531,7 +531,7 @@ CacheMemory::regStats() // assumption: SLICC generated files will only call this function // once **all** resources are granted void -CacheMemory::recordRequestType(CacheRequestType requestType, Address addr) +CacheMemory::recordRequestType(CacheRequestType requestType, Addr addr) { DPRINTF(RubyStats, "Recorded statistic: %s\n", CacheRequestType_to_string(requestType)); @@ -563,7 +563,7 @@ CacheMemory::recordRequestType(CacheRequestType requestType, Address addr) } bool -CacheMemory::checkResourceAvailable(CacheResourceType res, Address addr) +CacheMemory::checkResourceAvailable(CacheResourceType res, Addr addr) { if (!m_resource_stalls) { return true; diff --git a/src/mem/ruby/structures/CacheMemory.hh b/src/mem/ruby/structures/CacheMemory.hh index 792d8fd93..08551ab87 100644 --- a/src/mem/ruby/structures/CacheMemory.hh +++ b/src/mem/ruby/structures/CacheMemory.hh @@ -58,43 +58,42 @@ class CacheMemory : public SimObject // Public Methods // perform a cache access and see if we hit or not. Return true on a hit. - bool tryCacheAccess(const Address& address, RubyRequestType type, + bool tryCacheAccess(Addr address, RubyRequestType type, DataBlock*& data_ptr); // similar to above, but doesn't require full access check - bool testCacheAccess(const Address& address, RubyRequestType type, + bool testCacheAccess(Addr address, RubyRequestType type, DataBlock*& data_ptr); // tests to see if an address is present in the cache - bool isTagPresent(const Address& address) const; + bool isTagPresent(Addr address) const; // Returns true if there is: // a) a tag match on this address or there is // b) an unused line in the same cache "way" - bool cacheAvail(const Address& address) const; + bool cacheAvail(Addr address) const; // find an unused entry and sets the tag appropriate for the address - AbstractCacheEntry* allocate(const Address& address, + AbstractCacheEntry* allocate(Addr address, AbstractCacheEntry* new_entry, bool touch); - AbstractCacheEntry* allocate(const Address& address, - AbstractCacheEntry* new_entry) + AbstractCacheEntry* allocate(Addr address, AbstractCacheEntry* new_entry) { return allocate(address, new_entry, true); } - void allocateVoid(const Address& address, AbstractCacheEntry* new_entry) + void allocateVoid(Addr address, AbstractCacheEntry* new_entry) { allocate(address, new_entry, true); } // Explicitly free up this address - void deallocate(const Address& address); + void deallocate(Addr address); // Returns with the physical address of the conflicting cache line - Address cacheProbe(const Address& address) const; + Addr cacheProbe(Addr address) const; // looks an address up in the cache - AbstractCacheEntry* lookup(const Address& address); - const AbstractCacheEntry* lookup(const Address& address) const; + AbstractCacheEntry* lookup(Addr address); + const AbstractCacheEntry* lookup(Addr address) const; Cycles getTagLatency() const { return tagArray.getLatency(); } Cycles getDataLatency() const { return dataArray.getLatency(); } @@ -106,19 +105,19 @@ class CacheMemory : public SimObject void recordCacheContents(int cntrl, CacheRecorder* tr) const; // Set this address to most recently used - void setMRU(const Address& address); + void setMRU(Addr address); - void setLocked (const Address& addr, int context); - void clearLocked (const Address& addr); - bool isLocked (const Address& addr, int context); + void setLocked (Addr addr, int context); + void clearLocked (Addr addr); + bool isLocked (Addr addr, int context); // Print cache contents void print(std::ostream& out) const; void printData(std::ostream& out) const; void regStats(); - bool checkResourceAvailable(CacheResourceType res, Address addr); - void recordRequestType(CacheRequestType requestType, Address addr); + bool checkResourceAvailable(CacheResourceType res, Addr addr); + void recordRequestType(CacheRequestType requestType, Addr addr); public: Stats::Scalar m_demand_hits; @@ -141,17 +140,16 @@ class CacheMemory : public SimObject int getCacheSize() const { return m_cache_size; } int getNumBlocks() const { return m_cache_num_sets * m_cache_assoc; } - Address getAddressAtIdx(int idx) const; + Addr getAddressAtIdx(int idx) const; private: // convert a Address to its location in the cache - int64 addressToCacheSet(const Address& address) const; + int64 addressToCacheSet(Addr address) const; // Given a cache tag: returns the index of the tag in a set. // returns -1 if the tag is not found. - int findTagInSet(int64 line, const Address& tag) const; - int findTagInSetIgnorePermissions(int64 cacheSet, - const Address& tag) const; + int findTagInSet(int64 line, Addr tag) const; + int findTagInSetIgnorePermissions(int64 cacheSet, Addr tag) const; // Private copy constructor and assignment operator CacheMemory(const CacheMemory& obj); @@ -163,7 +161,7 @@ class CacheMemory : public SimObject // The first index is the # of cache lines. // The second index is the the amount associativity. - m5::hash_map<Address, int> m_tag_index; + m5::hash_map<Addr, int> m_tag_index; std::vector<std::vector<AbstractCacheEntry*> > m_cache; AbstractReplacementPolicy *m_replacementPolicy_ptr; diff --git a/src/mem/ruby/structures/DirectoryMemory.cc b/src/mem/ruby/structures/DirectoryMemory.cc index 04849e31f..b840349e1 100644 --- a/src/mem/ruby/structures/DirectoryMemory.cc +++ b/src/mem/ruby/structures/DirectoryMemory.cc @@ -71,7 +71,7 @@ DirectoryMemory::init() DirectoryMemory::~DirectoryMemory() { // free up all the directory entries - for (uint64 i = 0; i < m_num_entries; i++) { + for (uint64_t i = 0; i < m_num_entries; i++) { if (m_entries[i] != NULL) { delete m_entries[i]; } @@ -79,40 +79,41 @@ DirectoryMemory::~DirectoryMemory() delete [] m_entries; } -uint64 -DirectoryMemory::mapAddressToDirectoryVersion(PhysAddress address) +uint64_t +DirectoryMemory::mapAddressToDirectoryVersion(Addr address) { if (m_num_directories_bits == 0) return 0; - uint64 ret = address.bitSelect(m_numa_high_bit - m_num_directories_bits + 1, - m_numa_high_bit); + uint64_t ret = bitSelect(address, + m_numa_high_bit - m_num_directories_bits + 1, + m_numa_high_bit); return ret; } bool -DirectoryMemory::isPresent(PhysAddress address) +DirectoryMemory::isPresent(Addr address) { bool ret = (mapAddressToDirectoryVersion(address) == m_version); return ret; } -uint64 -DirectoryMemory::mapAddressToLocalIdx(PhysAddress address) +uint64_t +DirectoryMemory::mapAddressToLocalIdx(Addr address) { - uint64 ret; + uint64_t ret; if (m_num_directories_bits > 0) { - ret = address.bitRemove(m_numa_high_bit - m_num_directories_bits + 1, - m_numa_high_bit); + ret = bitRemove(address, m_numa_high_bit - m_num_directories_bits + 1, + m_numa_high_bit); } else { - ret = address.getAddress(); + ret = address; } return ret >> (RubySystem::getBlockSizeBits()); } AbstractEntry* -DirectoryMemory::lookup(PhysAddress address) +DirectoryMemory::lookup(Addr address) { assert(isPresent(address)); DPRINTF(RubyCache, "Looking up address: %s\n", address); @@ -123,10 +124,10 @@ DirectoryMemory::lookup(PhysAddress address) } AbstractEntry* -DirectoryMemory::allocate(const PhysAddress& address, AbstractEntry* entry) +DirectoryMemory::allocate(Addr address, AbstractEntry *entry) { assert(isPresent(address)); - uint64 idx; + uint64_t idx; DPRINTF(RubyCache, "Looking up address: %s\n", address); idx = mapAddressToLocalIdx(address); diff --git a/src/mem/ruby/structures/DirectoryMemory.hh b/src/mem/ruby/structures/DirectoryMemory.hh index b75e6ab72..a549366d0 100644 --- a/src/mem/ruby/structures/DirectoryMemory.hh +++ b/src/mem/ruby/structures/DirectoryMemory.hh @@ -47,15 +47,14 @@ class DirectoryMemory : public SimObject void init(); - uint64 mapAddressToLocalIdx(PhysAddress address); - static uint64 mapAddressToDirectoryVersion(PhysAddress address); + uint64_t mapAddressToLocalIdx(Addr address); + static uint64_t mapAddressToDirectoryVersion(Addr address); - uint64 getSize() { return m_size_bytes; } + uint64_t getSize() { return m_size_bytes; } - bool isPresent(PhysAddress address); - AbstractEntry* lookup(PhysAddress address); - AbstractEntry* allocate(const PhysAddress& address, - AbstractEntry* new_entry); + bool isPresent(Addr address); + AbstractEntry *lookup(Addr address); + AbstractEntry *allocate(Addr address, AbstractEntry* new_entry); void print(std::ostream& out) const; void recordRequestType(DirectoryRequestType requestType); @@ -70,9 +69,9 @@ class DirectoryMemory : public SimObject AbstractEntry **m_entries; // int m_size; // # of memory module blocks this directory is // responsible for - uint64 m_size_bytes; - uint64 m_size_bits; - uint64 m_num_entries; + uint64_t m_size_bytes; + uint64_t m_size_bits; + uint64_t m_num_entries; int m_version; static int m_num_directories; diff --git a/src/mem/ruby/structures/MemoryNode.hh b/src/mem/ruby/structures/MemoryNode.hh index b48f64704..558457e23 100644 --- a/src/mem/ruby/structures/MemoryNode.hh +++ b/src/mem/ruby/structures/MemoryNode.hh @@ -48,7 +48,7 @@ class MemoryNode public: // old constructor MemoryNode(const Cycles& time, int counter, const PacketPtr p, - const physical_address_t addr, const bool is_mem_read) + Addr addr, const bool is_mem_read) : m_time(time), pkt(p) { m_msg_counter = counter; @@ -59,7 +59,7 @@ class MemoryNode // new constructor MemoryNode(const Cycles& time, const PacketPtr p, - const physical_address_t addr, const bool is_mem_read, + Addr addr, const bool is_mem_read, const bool is_dirty_wb) : m_time(time), pkt(p) { @@ -74,7 +74,7 @@ class MemoryNode Cycles m_time; int m_msg_counter; PacketPtr pkt; - physical_address_t m_addr; + Addr m_addr; bool m_is_mem_read; bool m_is_dirty_wb; }; diff --git a/src/mem/ruby/structures/PerfectCacheMemory.hh b/src/mem/ruby/structures/PerfectCacheMemory.hh index 413a0f471..2b8b87628 100644 --- a/src/mem/ruby/structures/PerfectCacheMemory.hh +++ b/src/mem/ruby/structures/PerfectCacheMemory.hh @@ -55,28 +55,28 @@ class PerfectCacheMemory PerfectCacheMemory(); // tests to see if an address is present in the cache - bool isTagPresent(const Address& address) const; + bool isTagPresent(Addr address) const; // Returns true if there is: // a) a tag match on this address or there is // b) an Invalid line in the same cache "way" - bool cacheAvail(const Address& address) const; + bool cacheAvail(Addr address) const; // find an Invalid entry and sets the tag appropriate for the address - void allocate(const Address& address); + void allocate(Addr address); - void deallocate(const Address& address); + void deallocate(Addr address); // Returns with the physical address of the conflicting cache line - Address cacheProbe(const Address& newAddress) const; + Addr cacheProbe(Addr newAddress) const; // looks an address up in the cache - ENTRY* lookup(const Address& address); - const ENTRY* lookup(const Address& address) const; + ENTRY* lookup(Addr address); + const ENTRY* lookup(Addr address) const; // Get/Set permission of cache block - AccessPermission getPermission(const Address& address) const; - void changePermission(const Address& address, AccessPermission new_perm); + AccessPermission getPermission(Addr address) const; + void changePermission(Addr address, AccessPermission new_perm); // Print cache contents void print(std::ostream& out) const; @@ -87,7 +87,7 @@ class PerfectCacheMemory PerfectCacheMemory& operator=(const PerfectCacheMemory& obj); // Data Members (m_prefix) - m5::hash_map<Address, PerfectCacheLineState<ENTRY> > m_map; + m5::hash_map<Addr, PerfectCacheLineState<ENTRY> > m_map; }; template<class ENTRY> @@ -108,14 +108,14 @@ PerfectCacheMemory<ENTRY>::PerfectCacheMemory() // tests to see if an address is present in the cache template<class ENTRY> inline bool -PerfectCacheMemory<ENTRY>::isTagPresent(const Address& address) const +PerfectCacheMemory<ENTRY>::isTagPresent(Addr address) const { - return m_map.count(line_address(address)) > 0; + return m_map.count(makeLineAddress(address)) > 0; } template<class ENTRY> inline bool -PerfectCacheMemory<ENTRY>::cacheAvail(const Address& address) const +PerfectCacheMemory<ENTRY>::cacheAvail(Addr address) const { return true; } @@ -124,26 +124,26 @@ PerfectCacheMemory<ENTRY>::cacheAvail(const Address& address) const // appropriate for the address template<class ENTRY> inline void -PerfectCacheMemory<ENTRY>::allocate(const Address& address) +PerfectCacheMemory<ENTRY>::allocate(Addr address) { PerfectCacheLineState<ENTRY> line_state; line_state.m_permission = AccessPermission_Invalid; line_state.m_entry = ENTRY(); - m_map[line_address(address)] = line_state; + m_map[makeLineAddress(address)] = line_state; } // deallocate entry template<class ENTRY> inline void -PerfectCacheMemory<ENTRY>::deallocate(const Address& address) +PerfectCacheMemory<ENTRY>::deallocate(Addr address) { - m_map.erase(line_address(address)); + m_map.erase(makeLineAddress(address)); } // Returns with the physical address of the conflicting cache line template<class ENTRY> -inline Address -PerfectCacheMemory<ENTRY>::cacheProbe(const Address& newAddress) const +inline Addr +PerfectCacheMemory<ENTRY>::cacheProbe(Addr newAddress) const { panic("cacheProbe called in perfect cache"); return newAddress; @@ -152,33 +152,32 @@ PerfectCacheMemory<ENTRY>::cacheProbe(const Address& newAddress) const // looks an address up in the cache template<class ENTRY> inline ENTRY* -PerfectCacheMemory<ENTRY>::lookup(const Address& address) +PerfectCacheMemory<ENTRY>::lookup(Addr address) { - return &m_map[line_address(address)].m_entry; + return &m_map[makeLineAddress(address)].m_entry; } // looks an address up in the cache template<class ENTRY> inline const ENTRY* -PerfectCacheMemory<ENTRY>::lookup(const Address& address) const +PerfectCacheMemory<ENTRY>::lookup(Addr address) const { - return &m_map[line_address(address)].m_entry; + return &m_map[makeLineAddress(address)].m_entry; } template<class ENTRY> inline AccessPermission -PerfectCacheMemory<ENTRY>::getPermission(const Address& address) const +PerfectCacheMemory<ENTRY>::getPermission(Addr address) const { - return m_map[line_address(address)].m_permission; + return m_map[makeLineAddress(address)].m_permission; } template<class ENTRY> inline void -PerfectCacheMemory<ENTRY>::changePermission(const Address& address, +PerfectCacheMemory<ENTRY>::changePermission(Addr address, AccessPermission new_perm) { - Address line_address = address; - line_address.makeLineAddress(); + Addr line_address = makeLineAddress(address); PerfectCacheLineState<ENTRY>& line_state = m_map[line_address]; line_state.m_permission = new_perm; } diff --git a/src/mem/ruby/structures/PersistentTable.cc b/src/mem/ruby/structures/PersistentTable.cc index 57b06946e..1e4e0f555 100644 --- a/src/mem/ruby/structures/PersistentTable.cc +++ b/src/mem/ruby/structures/PersistentTable.cc @@ -47,7 +47,7 @@ PersistentTable::~PersistentTable() } void -PersistentTable::persistentRequestLock(const Address& address, +PersistentTable::persistentRequestLock(Addr address, MachineID locker, AccessType type) { @@ -59,7 +59,7 @@ PersistentTable::persistentRequestLock(const Address& address, MachineID locker = (MachineID) persistent_randomize[llocker]; #endif - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); static const PersistentTableEntry dflt; pair<AddressMap::iterator, bool> r = @@ -82,7 +82,7 @@ PersistentTable::persistentRequestLock(const Address& address, } void -PersistentTable::persistentRequestUnlock(const Address& address, +PersistentTable::persistentRequestUnlock(Addr address, MachineID unlocker) { #if 0 @@ -93,7 +93,7 @@ PersistentTable::persistentRequestUnlock(const Address& address, MachineID unlocker = (MachineID) persistent_randomize[uunlocker]; #endif - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); assert(m_map.count(address)); PersistentTableEntry& entry = m_map[address]; @@ -115,10 +115,10 @@ PersistentTable::persistentRequestUnlock(const Address& address, } bool -PersistentTable::okToIssueStarving(const Address& address, +PersistentTable::okToIssueStarving(Addr address, MachineID machId) const { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); AddressMap::const_iterator i = m_map.find(address); if (i == m_map.end()) { @@ -138,9 +138,9 @@ PersistentTable::okToIssueStarving(const Address& address, } MachineID -PersistentTable::findSmallest(const Address& address) const +PersistentTable::findSmallest(Addr address) const { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); AddressMap::const_iterator i = m_map.find(address); assert(i != m_map.end()); const PersistentTableEntry& entry = i->second; @@ -148,9 +148,9 @@ PersistentTable::findSmallest(const Address& address) const } AccessType -PersistentTable::typeOfSmallest(const Address& address) const +PersistentTable::typeOfSmallest(Addr address) const { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); AddressMap::const_iterator i = m_map.find(address); assert(i != m_map.end()); const PersistentTableEntry& entry = i->second; @@ -163,9 +163,9 @@ PersistentTable::typeOfSmallest(const Address& address) const } void -PersistentTable::markEntries(const Address& address) +PersistentTable::markEntries(Addr address) { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); AddressMap::iterator i = m_map.find(address); if (i == m_map.end()) return; @@ -180,18 +180,18 @@ PersistentTable::markEntries(const Address& address) } bool -PersistentTable::isLocked(const Address& address) const +PersistentTable::isLocked(Addr address) const { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); // If an entry is present, it must be locked return m_map.count(address) > 0; } int -PersistentTable::countStarvingForAddress(const Address& address) const +PersistentTable::countStarvingForAddress(Addr address) const { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); AddressMap::const_iterator i = m_map.find(address); if (i == m_map.end()) return 0; @@ -201,9 +201,9 @@ PersistentTable::countStarvingForAddress(const Address& address) const } int -PersistentTable::countReadStarvingForAddress(const Address& address) const +PersistentTable::countReadStarvingForAddress(Addr address) const { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); AddressMap::const_iterator i = m_map.find(address); if (i == m_map.end()) return 0; diff --git a/src/mem/ruby/structures/PersistentTable.hh b/src/mem/ruby/structures/PersistentTable.hh index 7e10b328c..a4604fce8 100644 --- a/src/mem/ruby/structures/PersistentTable.hh +++ b/src/mem/ruby/structures/PersistentTable.hh @@ -58,16 +58,16 @@ class PersistentTable ~PersistentTable(); // Public Methods - void persistentRequestLock(const Address& address, MachineID locker, + void persistentRequestLock(Addr address, MachineID locker, AccessType type); - void persistentRequestUnlock(const Address& address, MachineID unlocker); - bool okToIssueStarving(const Address& address, MachineID machID) const; - MachineID findSmallest(const Address& address) const; - AccessType typeOfSmallest(const Address& address) const; - void markEntries(const Address& address); - bool isLocked(const Address& addr) const; - int countStarvingForAddress(const Address& addr) const; - int countReadStarvingForAddress(const Address& addr) const; + void persistentRequestUnlock(Addr address, MachineID unlocker); + bool okToIssueStarving(Addr address, MachineID machID) const; + MachineID findSmallest(Addr address) const; + AccessType typeOfSmallest(Addr address) const; + void markEntries(Addr address); + bool isLocked(Addr addr) const; + int countStarvingForAddress(Addr addr) const; + int countReadStarvingForAddress(Addr addr) const; void print(std::ostream& out) const; @@ -77,7 +77,7 @@ class PersistentTable PersistentTable& operator=(const PersistentTable& obj); // Data Members (m_prefix) - typedef m5::hash_map<Address, PersistentTableEntry> AddressMap; + typedef m5::hash_map<Addr, PersistentTableEntry> AddressMap; AddressMap m_map; }; diff --git a/src/mem/ruby/structures/Prefetcher.cc b/src/mem/ruby/structures/Prefetcher.cc index 306174c2c..fbf027bef 100644 --- a/src/mem/ruby/structures/Prefetcher.cc +++ b/src/mem/ruby/structures/Prefetcher.cc @@ -42,9 +42,9 @@ Prefetcher::Prefetcher(const Params *p) m_array(p->num_streams), m_train_misses(p->train_misses), m_num_startup_pfs(p->num_startup_pfs), m_num_unit_filters(p->unit_filter), m_num_nonunit_filters(p->nonunit_filter), - m_unit_filter(p->unit_filter, Address(0)), - m_negative_filter(p->unit_filter, Address(0)), - m_nonunit_filter(p->nonunit_filter, Address(0)), + m_unit_filter(p->unit_filter, 0), + m_negative_filter(p->unit_filter, 0), + m_nonunit_filter(p->nonunit_filter, 0), m_prefetch_cross_pages(p->cross_page), m_page_shift(p->sys->getPageShift()) { @@ -133,10 +133,10 @@ Prefetcher::regStats() } void -Prefetcher::observeMiss(const Address& address, const RubyRequestType& type) +Prefetcher::observeMiss(Addr address, const RubyRequestType& type) { DPRINTF(RubyPrefetcher, "Observed miss for %s\n", address); - Address line_addr = line_address(address); + Addr line_addr = makeLineAddress(address); numMissObserved++; // check to see if we have already issued a prefetch for this block @@ -201,7 +201,7 @@ Prefetcher::observeMiss(const Address& address, const RubyRequestType& type) } void -Prefetcher::observePfMiss(const Address& address) +Prefetcher::observePfMiss(Addr address) { numPartialHits++; DPRINTF(RubyPrefetcher, "Observed partial hit for %s\n", address); @@ -209,7 +209,7 @@ Prefetcher::observePfMiss(const Address& address) } void -Prefetcher::observePfHit(const Address& address) +Prefetcher::observePfHit(Addr address) { numHits++; DPRINTF(RubyPrefetcher, "Observed hit for %s\n", address); @@ -217,7 +217,7 @@ Prefetcher::observePfHit(const Address& address) } void -Prefetcher::issueNextPrefetch(const Address &address, PrefetchEntry *stream) +Prefetcher::issueNextPrefetch(Addr address, PrefetchEntry *stream) { // get our corresponding stream fetcher if (stream == NULL) { @@ -232,9 +232,9 @@ Prefetcher::issueNextPrefetch(const Address &address, PrefetchEntry *stream) } // extend this prefetching stream by 1 (or more) - Address page_addr = pageAddress(stream->m_address); - Address line_addr = next_stride_address(stream->m_address, - stream->m_stride); + Addr page_addr = pageAddress(stream->m_address); + Addr line_addr = makeNextStrideAddress(stream->m_address, + stream->m_stride); // possibly stop prefetching at page boundaries if (page_addr != pageAddress(line_addr)) { @@ -276,33 +276,32 @@ Prefetcher::getLRUindex(void) void Prefetcher::clearNonunitEntry(uint32_t index) { - m_nonunit_filter[index].setAddress(0); + m_nonunit_filter[index] = 0; m_nonunit_stride[index] = 0; m_nonunit_hit[index] = 0; } void -Prefetcher::initializeStream(const Address& address, int stride, +Prefetcher::initializeStream(Addr address, int stride, uint32_t index, const RubyRequestType& type) { numAllocatedStreams++; // initialize the stream prefetcher PrefetchEntry *mystream = &(m_array[index]); - mystream->m_address = line_address(address); + mystream->m_address = makeLineAddress(address); mystream->m_stride = stride; mystream->m_use_time = m_controller->curCycle(); mystream->m_is_valid = true; mystream->m_type = type; // create a number of initial prefetches for this stream - Address page_addr = pageAddress(mystream->m_address); - Address line_addr = line_address(mystream->m_address); - Address prev_addr = line_addr; + Addr page_addr = pageAddress(mystream->m_address); + Addr line_addr = makeLineAddress(mystream->m_address); // insert a number of prefetches into the prefetch table for (int k = 0; k < m_num_startup_pfs; k++) { - line_addr = next_stride_address(line_addr, stride); + line_addr = makeNextStrideAddress(line_addr, stride); // possibly stop prefetching at page boundaries if (page_addr != pageAddress(line_addr)) { numPagesCrossed++; @@ -317,7 +316,6 @@ Prefetcher::initializeStream(const Address& address, int stride, numPrefetchRequested++; DPRINTF(RubyPrefetcher, "Requesting prefetch for %s\n", line_addr); m_controller->enqueuePrefetch(line_addr, m_array[index].m_type); - prev_addr = line_addr; } // update the address to be the last address prefetched @@ -325,14 +323,14 @@ Prefetcher::initializeStream(const Address& address, int stride, } PrefetchEntry * -Prefetcher::getPrefetchEntry(const Address &address, uint32_t &index) +Prefetcher::getPrefetchEntry(Addr address, uint32_t &index) { // search all streams for a match for (int i = 0; i < m_num_streams; i++) { // search all the outstanding prefetches for this stream if (m_array[i].m_is_valid) { for (int j = 0; j < m_num_startup_pfs; j++) { - if (next_stride_address(m_array[i].m_address, + if (makeNextStrideAddress(m_array[i].m_address, -(m_array[i].m_stride*j)) == address) { return &(m_array[i]); } @@ -343,17 +341,17 @@ Prefetcher::getPrefetchEntry(const Address &address, uint32_t &index) } bool -Prefetcher::accessUnitFilter(std::vector<Address>& filter_table, - uint32_t *filter_hit, uint32_t &index, const Address &address, +Prefetcher::accessUnitFilter(std::vector<Addr>& filter_table, + uint32_t *filter_hit, uint32_t &index, Addr address, int stride, bool &alloc) { //reset the alloc flag alloc = false; - Address line_addr = line_address(address); + Addr line_addr = makeLineAddress(address); for (int i = 0; i < m_num_unit_filters; i++) { if (filter_table[i] == line_addr) { - filter_table[i] = next_stride_address(filter_table[i], stride); + filter_table[i] = makeNextStrideAddress(filter_table[i], stride); filter_hit[i]++; if (filter_hit[i] >= m_train_misses) { alloc = true; @@ -364,7 +362,7 @@ Prefetcher::accessUnitFilter(std::vector<Address>& filter_table, // enter this address in the table int local_index = index; - filter_table[local_index] = next_stride_address(line_addr, stride); + filter_table[local_index] = makeNextStrideAddress(line_addr, stride); filter_hit[local_index] = 0; local_index = local_index + 1; if (local_index >= m_num_unit_filters) { @@ -376,21 +374,21 @@ Prefetcher::accessUnitFilter(std::vector<Address>& filter_table, } bool -Prefetcher::accessNonunitFilter(const Address& address, int *stride, +Prefetcher::accessNonunitFilter(Addr address, int *stride, bool &alloc) { //reset the alloc flag alloc = false; /// look for non-unit strides based on a (user-defined) page size - Address page_addr = pageAddress(address); - Address line_addr = line_address(address); + Addr page_addr = pageAddress(address); + Addr line_addr = makeLineAddress(address); for (uint32_t i = 0; i < m_num_nonunit_filters; i++) { if (pageAddress(m_nonunit_filter[i]) == page_addr) { // hit in the non-unit filter // compute the actual stride (for this reference) - int delta = line_addr.getAddress() - m_nonunit_filter[i].getAddress(); + int delta = line_addr - m_nonunit_filter[i]; if (delta != 0) { // no zero stride prefetches @@ -400,17 +398,19 @@ Prefetcher::accessNonunitFilter(const Address& address, int *stride, // increment count (if > 2) allocate stream m_nonunit_hit[i]++; if (m_nonunit_hit[i] > m_train_misses) { - //This stride HAS to be the multiplicative constant of - //dataBlockBytes (bc next_stride_address is calculated based - //on this multiplicative constant!) - *stride = m_nonunit_stride[i]/RubySystem::getBlockSizeBytes(); + // This stride HAS to be the multiplicative constant of + // dataBlockBytes (bc makeNextStrideAddress is + // calculated based on this multiplicative constant!) + *stride = m_nonunit_stride[i] / + RubySystem::getBlockSizeBytes(); // clear this filter entry clearNonunitEntry(i); alloc = true; } } else { - // delta didn't match ... reset m_nonunit_hit count for this entry + // delta didn't match ... reset m_nonunit_hit count for + // this entry m_nonunit_hit[i] = 0; } @@ -469,10 +469,8 @@ Prefetcher::print(std::ostream& out) const } } -Address -Prefetcher::pageAddress(const Address& addr) const +Addr +Prefetcher::pageAddress(Addr addr) const { - Address temp = addr; - temp.maskLowOrderBits(m_page_shift); - return temp; + return maskLowOrderBits(addr, m_page_shift); } diff --git a/src/mem/ruby/structures/Prefetcher.hh b/src/mem/ruby/structures/Prefetcher.hh index 6ed945b9e..d5c3d4b58 100644 --- a/src/mem/ruby/structures/Prefetcher.hh +++ b/src/mem/ruby/structures/Prefetcher.hh @@ -26,8 +26,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PREFETCHER_H -#define PREFETCHER_H +#ifndef __MEM_RUBY_STRUCTURES_PREFETCHER_HH__ +#define __MEM_RUBY_STRUCTURES_PREFETCHER_HH__ // Implements Power 4 like prefetching @@ -58,7 +58,7 @@ class PrefetchEntry } //! The base address for the stream prefetch - Address m_address; + Addr m_address; //! stride distance to get next address from int m_stride; @@ -85,22 +85,22 @@ class Prefetcher : public SimObject Prefetcher(const Params *p); ~Prefetcher(); - void issueNextPrefetch(const Address &address, PrefetchEntry *stream); + void issueNextPrefetch(Addr address, PrefetchEntry *stream); /** * Implement the prefetch hit(miss) callback interface. * These functions are called by the cache when it hits(misses) * on a line with the line's prefetch bit set. If this address * hits in m_array we will continue prefetching the stream. */ - void observePfHit(const Address& address); - void observePfMiss(const Address& address); + void observePfHit(Addr address); + void observePfMiss(Addr address); /** * Observe a memory miss from the cache. * * @param address The physical address that missed out of the cache. */ - void observeMiss(const Address& address, const RubyRequestType& type); + void observeMiss(Addr address, const RubyRequestType& type); /** * Print out some statistics @@ -123,25 +123,25 @@ class Prefetcher : public SimObject void clearNonunitEntry(uint32_t index); //! allocate a new stream buffer at a specific index - void initializeStream(const Address& address, int stride, + void initializeStream(Addr address, int stride, uint32_t index, const RubyRequestType& type); //! get pointer to the matching stream entry, returns NULL if not found //! index holds the multiple of the stride this address is. - PrefetchEntry* getPrefetchEntry(const Address &address, + PrefetchEntry* getPrefetchEntry(Addr address, uint32_t &index); /// access a unit stride filter to determine if there is a hit - bool accessUnitFilter(std::vector<Address>& filter_table, - uint32_t *hit_table, uint32_t &index, const Address &address, + bool accessUnitFilter(std::vector<Addr>& filter_table, + uint32_t *hit_table, uint32_t &index, Addr address, int stride, bool &alloc); /// access a unit stride filter to determine if there is a hit - bool accessNonunitFilter(const Address& address, int *stride, + bool accessNonunitFilter(Addr address, int *stride, bool &alloc); /// determine the page aligned address - Address pageAddress(const Address& addr) const; + Addr pageAddress(Addr addr) const; //! number of prefetch streams available uint32_t m_num_streams; @@ -159,7 +159,7 @@ class Prefetcher : public SimObject /// a unit stride filter array: helps reduce BW requirement of /// prefetching - std::vector<Address> m_unit_filter; + std::vector<Addr> m_unit_filter; /// a round robin pointer into the unit filter group uint32_t m_unit_filter_index; //! An array used to count the of times particular filter entries @@ -168,7 +168,7 @@ class Prefetcher : public SimObject //! a negative nit stride filter array: helps reduce BW requirement //! of prefetching - std::vector<Address> m_negative_filter; + std::vector<Addr> m_negative_filter; /// a round robin pointer into the negative filter group uint32_t m_negative_filter_index; /// An array used to count the of times particular filter entries @@ -177,7 +177,7 @@ class Prefetcher : public SimObject /// a non-unit stride filter array: helps reduce BW requirement of /// prefetching - std::vector<Address> m_nonunit_filter; + std::vector<Addr> m_nonunit_filter; /// An array of strides (in # of cache lines) for the filter entries int *m_nonunit_stride; /// An array used to count the of times particular filter entries @@ -213,4 +213,4 @@ class Prefetcher : public SimObject Stats::Scalar numMissedPrefetchedBlocks; }; -#endif // PREFETCHER_H +#endif // __MEM_RUBY_STRUCTURES_PREFETCHER_HH__ diff --git a/src/mem/ruby/structures/RubyMemoryControl.cc b/src/mem/ruby/structures/RubyMemoryControl.cc index 9cf8673a2..0521aac06 100644 --- a/src/mem/ruby/structures/RubyMemoryControl.cc +++ b/src/mem/ruby/structures/RubyMemoryControl.cc @@ -289,7 +289,7 @@ bool RubyMemoryControl::recvTimingReq(PacketPtr pkt) { Cycles arrival_time = curCycle(); - physical_address_t addr = pkt->getAddr(); + Addr addr = pkt->getAddr(); bool is_mem_read = pkt->isRead(); access(pkt); @@ -306,7 +306,7 @@ RubyMemoryControl::enqueueMemRef(MemoryNode *memRef) { m_msg_counter++; memRef->m_msg_counter = m_msg_counter; - physical_address_t addr = memRef->m_addr; + Addr addr = memRef->m_addr; int bank = getBank(addr); m_profiler_ptr->profileMemReq(bank); @@ -343,7 +343,7 @@ RubyMemoryControl::enqueueToDirectory(MemoryNode *req, Cycles latency) // getBank returns an integer that is unique for each // bank across this memory controller. const int -RubyMemoryControl::getBank(const physical_address_t addr) const +RubyMemoryControl::getBank(const Addr addr) const { int dimm = (addr >> m_dimm_bit_0) & (m_dimms_per_channel - 1); int rank = (addr >> m_rank_bit_0) & (m_ranks_per_dimm - 1); @@ -354,7 +354,7 @@ RubyMemoryControl::getBank(const physical_address_t addr) const } const int -RubyMemoryControl::getRank(const physical_address_t addr) const +RubyMemoryControl::getRank(const Addr addr) const { int bank = getBank(addr); int rank = (bank / m_banks_per_rank); @@ -374,7 +374,7 @@ RubyMemoryControl::getRank(int bank) const // Not used! const int -RubyMemoryControl::getChannel(const physical_address_t addr) const +RubyMemoryControl::getChannel(const Addr addr) const { assert(false); return -1; @@ -382,7 +382,7 @@ RubyMemoryControl::getChannel(const physical_address_t addr) const // Not used! const int -RubyMemoryControl::getRow(const physical_address_t addr) const +RubyMemoryControl::getRow(const Addr addr) const { assert(false); return -1; diff --git a/src/mem/ruby/structures/RubyMemoryControl.hh b/src/mem/ruby/structures/RubyMemoryControl.hh index c7bebc447..c68a2da6c 100644 --- a/src/mem/ruby/structures/RubyMemoryControl.hh +++ b/src/mem/ruby/structures/RubyMemoryControl.hh @@ -75,12 +75,12 @@ class RubyMemoryControl : public AbstractMemory, public Consumer void print(std::ostream& out) const; void regStats(); - const int getBank(const physical_address_t addr) const; - const int getRank(const physical_address_t addr) const; + const int getBank(const Addr addr) const; + const int getRank(const Addr addr) const; // not used in Ruby memory controller - const int getChannel(const physical_address_t addr) const; - const int getRow(const physical_address_t addr) const; + const int getChannel(const Addr addr) const; + const int getRow(const Addr addr) const; //added by SS int getBanksPerRank() { return m_banks_per_rank; }; diff --git a/src/mem/ruby/structures/TBETable.hh b/src/mem/ruby/structures/TBETable.hh index a3282af7d..cbc51dae5 100644 --- a/src/mem/ruby/structures/TBETable.hh +++ b/src/mem/ruby/structures/TBETable.hh @@ -43,16 +43,16 @@ class TBETable { } - bool isPresent(const Address& address) const; - void allocate(const Address& address); - void deallocate(const Address& address); + bool isPresent(Addr address) const; + void allocate(Addr address); + void deallocate(Addr address); bool areNSlotsAvailable(int n) const { return (m_number_of_TBEs - m_map.size()) >= n; } - ENTRY* lookup(const Address& address); + ENTRY* lookup(Addr address); // Print cache contents void print(std::ostream& out) const; @@ -63,7 +63,7 @@ class TBETable TBETable& operator=(const TBETable& obj); // Data Members (m_prefix) - m5::hash_map<Address, ENTRY> m_map; + m5::hash_map<Addr, ENTRY> m_map; private: int m_number_of_TBEs; @@ -80,16 +80,16 @@ operator<<(std::ostream& out, const TBETable<ENTRY>& obj) template<class ENTRY> inline bool -TBETable<ENTRY>::isPresent(const Address& address) const +TBETable<ENTRY>::isPresent(Addr address) const { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); assert(m_map.size() <= m_number_of_TBEs); return !!m_map.count(address); } template<class ENTRY> inline void -TBETable<ENTRY>::allocate(const Address& address) +TBETable<ENTRY>::allocate(Addr address) { assert(!isPresent(address)); assert(m_map.size() < m_number_of_TBEs); @@ -98,7 +98,7 @@ TBETable<ENTRY>::allocate(const Address& address) template<class ENTRY> inline void -TBETable<ENTRY>::deallocate(const Address& address) +TBETable<ENTRY>::deallocate(Addr address) { assert(isPresent(address)); assert(m_map.size() > 0); @@ -108,7 +108,7 @@ TBETable<ENTRY>::deallocate(const Address& address) // looks an address up in the cache template<class ENTRY> inline ENTRY* -TBETable<ENTRY>::lookup(const Address& address) +TBETable<ENTRY>::lookup(Addr address) { if(m_map.find(address) != m_map.end()) return &(m_map.find(address)->second); return NULL; diff --git a/src/mem/ruby/structures/TimerTable.cc b/src/mem/ruby/structures/TimerTable.cc index d40ae2b79..7d0dd3c01 100644 --- a/src/mem/ruby/structures/TimerTable.cc +++ b/src/mem/ruby/structures/TimerTable.cc @@ -36,7 +36,7 @@ TimerTable::TimerTable() m_clockobj_ptr = NULL; m_next_valid = false; - m_next_address = Address(0); + m_next_address = 0; } bool @@ -52,7 +52,7 @@ TimerTable::isReady() const return (m_clockobj_ptr->curCycle() >= m_next_time); } -const Address& +Addr TimerTable::readyAddress() const { assert(isReady()); @@ -65,9 +65,9 @@ TimerTable::readyAddress() const } void -TimerTable::set(const Address& address, Cycles relative_latency) +TimerTable::set(Addr address, Cycles relative_latency) { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); assert(relative_latency > 0); assert(!m_map.count(address)); @@ -85,9 +85,9 @@ TimerTable::set(const Address& address, Cycles relative_latency) } void -TimerTable::unset(const Address& address) +TimerTable::unset(Addr address) { - assert(address == line_address(address)); + assert(address == makeLineAddress(address)); assert(m_map.count(address)); m_map.erase(address); diff --git a/src/mem/ruby/structures/TimerTable.hh b/src/mem/ruby/structures/TimerTable.hh index c5277818b..606201eb4 100644 --- a/src/mem/ruby/structures/TimerTable.hh +++ b/src/mem/ruby/structures/TimerTable.hh @@ -62,13 +62,13 @@ class TimerTable } bool isReady() const; - const Address& readyAddress() const; - bool isSet(const Address& address) const { return !!m_map.count(address); } - void set(const Address& address, Cycles relative_latency); - void set(const Address& address, uint64_t relative_latency) + Addr readyAddress() const; + bool isSet(Addr address) const { return !!m_map.count(address); } + void set(Addr address, Cycles relative_latency); + void set(Addr address, uint64_t relative_latency) { set(address, Cycles(relative_latency)); } - void unset(const Address& address); + void unset(Addr address); void print(std::ostream& out) const; private: @@ -82,11 +82,11 @@ class TimerTable // use a std::map for the address map as this container is sorted // and ensures a well-defined iteration order - typedef std::map<Address, Cycles> AddressMap; + typedef std::map<Addr, Cycles> AddressMap; AddressMap m_map; mutable bool m_next_valid; mutable Cycles m_next_time; // Only valid if m_next_valid is true - mutable Address m_next_address; // Only valid if m_next_valid is true + mutable Addr m_next_address; // Only valid if m_next_valid is true //! Object used for querying time. ClockedObject* m_clockobj_ptr; diff --git a/src/mem/ruby/system/CacheRecorder.cc b/src/mem/ruby/system/CacheRecorder.cc index 8e8757967..a2ac6bdf8 100644 --- a/src/mem/ruby/system/CacheRecorder.cc +++ b/src/mem/ruby/system/CacheRecorder.cc @@ -145,8 +145,7 @@ CacheRecorder::enqueueNextFetchRequest() } void -CacheRecorder::addRecord(int cntrl, const physical_address_t data_addr, - const physical_address_t pc_addr, +CacheRecorder::addRecord(int cntrl, Addr data_addr, Addr pc_addr, RubyRequestType type, Tick time, DataBlock& data) { TraceRecord* rec = (TraceRecord*)malloc(sizeof(TraceRecord) + diff --git a/src/mem/ruby/system/CacheRecorder.hh b/src/mem/ruby/system/CacheRecorder.hh index ad1223dce..a4a7261f4 100644 --- a/src/mem/ruby/system/CacheRecorder.hh +++ b/src/mem/ruby/system/CacheRecorder.hh @@ -56,8 +56,8 @@ class TraceRecord { public: int m_cntrl_id; Tick m_time; - physical_address_t m_data_address; - physical_address_t m_pc_address; + Addr m_data_address; + Addr m_pc_address; RubyRequestType m_type; uint8_t m_data[0]; @@ -74,9 +74,8 @@ class CacheRecorder uint64_t uncompressed_trace_size, std::vector<Sequencer*>& SequencerMap, uint64_t block_size_bytes); - void addRecord(int cntrl, const physical_address_t data_addr, - const physical_address_t pc_addr, RubyRequestType type, - Tick time, DataBlock& data); + void addRecord(int cntrl, Addr data_addr, Addr pc_addr, + RubyRequestType type, Tick time, DataBlock& data); uint64 aggregateRecords(uint8_t** data, uint64 size); diff --git a/src/mem/ruby/system/DMASequencer.cc b/src/mem/ruby/system/DMASequencer.cc index 49e986d76..e263fefdb 100644 --- a/src/mem/ruby/system/DMASequencer.cc +++ b/src/mem/ruby/system/DMASequencer.cc @@ -94,7 +94,7 @@ DMASequencer::MemSlavePort::recvTimingReq(PacketPtr pkt) panic("DMASequencer should never see an inhibited request\n"); assert(isPhysMemAddress(pkt->getAddr())); - assert(Address(pkt->getAddr()).getOffset() + pkt->getSize() <= + assert(getOffset(pkt->getAddr()) + pkt->getSize() <= RubySystem::getBlockSizeBytes()); // Submit the ruby request @@ -223,7 +223,7 @@ DMASequencer::makeRequest(PacketPtr pkt) return RequestStatus_BufferFull; } - uint64_t paddr = pkt->getAddr(); + Addr paddr = pkt->getAddr(); uint8_t* data = pkt->getPtr<uint8_t>(); int len = pkt->getSize(); bool write = pkt->isWrite(); @@ -241,8 +241,8 @@ DMASequencer::makeRequest(PacketPtr pkt) std::shared_ptr<SequencerMsg> msg = std::make_shared<SequencerMsg>(clockEdge()); - msg->getPhysicalAddress() = Address(paddr); - msg->getLineAddress() = line_address(msg->getPhysicalAddress()); + msg->getPhysicalAddress() = paddr; + msg->getLineAddress() = makeLineAddress(msg->getPhysicalAddress()); msg->getType() = write ? SequencerRequestType_ST : SequencerRequestType_LD; int offset = paddr & m_data_block_mask; @@ -280,11 +280,11 @@ DMASequencer::issueNext() std::shared_ptr<SequencerMsg> msg = std::make_shared<SequencerMsg>(clockEdge()); - msg->getPhysicalAddress() = Address(active_request.start_paddr + - active_request.bytes_completed); + msg->getPhysicalAddress() = active_request.start_paddr + + active_request.bytes_completed; - assert((msg->getPhysicalAddress().getAddress() & m_data_block_mask) == 0); - msg->getLineAddress() = line_address(msg->getPhysicalAddress()); + assert((msg->getPhysicalAddress() & m_data_block_mask) == 0); + msg->getLineAddress() = makeLineAddress(msg->getPhysicalAddress()); msg->getType() = (active_request.write ? SequencerRequestType_ST : SequencerRequestType_LD); diff --git a/src/mem/ruby/system/DMASequencer.hh b/src/mem/ruby/system/DMASequencer.hh index ee7d578e0..1539c3999 100644 --- a/src/mem/ruby/system/DMASequencer.hh +++ b/src/mem/ruby/system/DMASequencer.hh @@ -76,7 +76,7 @@ class DMASequencer : public MemObject PortID id, RubySystem *_ruby_system, bool _access_backing_store); void hitCallback(PacketPtr pkt); - void evictionCallback(const Address& address); + void evictionCallback(Addr address); protected: bool recvTimingReq(PacketPtr pkt); diff --git a/src/mem/ruby/system/RubyPort.cc b/src/mem/ruby/system/RubyPort.cc index 83be9337a..c13aed97e 100644 --- a/src/mem/ruby/system/RubyPort.cc +++ b/src/mem/ruby/system/RubyPort.cc @@ -249,7 +249,7 @@ RubyPort::MemSlavePort::recvTimingReq(PacketPtr pkt) return true; } - assert(Address(pkt->getAddr()).getOffset() + pkt->getSize() <= + assert(getOffset(pkt->getAddr()) + pkt->getSize() <= RubySystem::getBlockSizeBytes()); // Submit the ruby request @@ -299,8 +299,7 @@ RubyPort::MemSlavePort::recvFunctional(PacketPtr pkt) } assert(pkt->getAddr() + pkt->getSize() <= - line_address(Address(pkt->getAddr())).getAddress() + - RubySystem::getBlockSizeBytes()); + makeLineAddress(pkt->getAddr()) + RubySystem::getBlockSizeBytes()); if (access_backing_store) { // The attached physmem contains the official version of data. @@ -504,14 +503,13 @@ RubyPort::MemSlavePort::isPhysMemAddress(Addr addr) const } void -RubyPort::ruby_eviction_callback(const Address& address) +RubyPort::ruby_eviction_callback(Addr address) { DPRINTF(RubyPort, "Sending invalidations.\n"); // This request is deleted in the stack-allocated packet destructor // when this function exits // TODO: should this really be using funcMasterId? - RequestPtr req = - new Request(address.getAddress(), 0, 0, Request::funcMasterId); + RequestPtr req = new Request(address, 0, 0, Request::funcMasterId); // Use a single packet to signal all snooping ports of the invalidation. // This assumes that snooping ports do NOT modify the packet/request Packet pkt(req, MemCmd::InvalidateReq); diff --git a/src/mem/ruby/system/RubyPort.hh b/src/mem/ruby/system/RubyPort.hh index 07fca5916..f2841e561 100644 --- a/src/mem/ruby/system/RubyPort.hh +++ b/src/mem/ruby/system/RubyPort.hh @@ -81,7 +81,7 @@ class RubyPort : public MemObject MemSlavePort(const std::string &_name, RubyPort *_port, bool _access_backing_store, PortID id); void hitCallback(PacketPtr pkt); - void evictionCallback(const Address& address); + void evictionCallback(Addr address); protected: bool recvTimingReq(PacketPtr pkt); @@ -166,7 +166,7 @@ class RubyPort : public MemObject protected: void ruby_hit_callback(PacketPtr pkt); void testDrainComplete(); - void ruby_eviction_callback(const Address& address); + void ruby_eviction_callback(Addr address); /** * Called by the PIO port when receiving a timing response. diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc index 36bd9cd62..305758798 100644 --- a/src/mem/ruby/system/Sequencer.cc +++ b/src/mem/ruby/system/Sequencer.cc @@ -96,9 +96,9 @@ Sequencer::wakeup() continue; panic("Possible Deadlock detected. Aborting!\n" - "version: %d request.paddr: 0x%x m_readRequestTable: %d " - "current time: %u issue_time: %d difference: %d\n", m_version, - Address(request->pkt->getAddr()), m_readRequestTable.size(), + "version: %d request.paddr: 0x%x m_readRequestTable: %d " + "current time: %u issue_time: %d difference: %d\n", m_version, + request->pkt->getAddr(), m_readRequestTable.size(), current_time * clockPeriod(), request->issue_time * clockPeriod(), (current_time * clockPeriod()) - (request->issue_time * clockPeriod())); } @@ -111,9 +111,9 @@ Sequencer::wakeup() continue; panic("Possible Deadlock detected. Aborting!\n" - "version: %d request.paddr: 0x%x m_writeRequestTable: %d " - "current time: %u issue_time: %d difference: %d\n", m_version, - Address(request->pkt->getAddr()), m_writeRequestTable.size(), + "version: %d request.paddr: 0x%x m_writeRequestTable: %d " + "current time: %u issue_time: %d difference: %d\n", m_version, + request->pkt->getAddr(), m_writeRequestTable.size(), current_time * clockPeriod(), request->issue_time * clockPeriod(), (current_time * clockPeriod()) - (request->issue_time * clockPeriod())); } @@ -222,8 +222,7 @@ Sequencer::insertRequest(PacketPtr pkt, RubyRequestType request_type) schedule(deadlockCheckEvent, clockEdge(m_deadlock_threshold)); } - Address line_addr(pkt->getAddr()); - line_addr.makeLineAddress(); + Addr line_addr = makeLineAddress(pkt->getAddr()); // Create a default entry, mapping the address to NULL, the cast is // there to make gcc 4.4 happy RequestTable::value_type default_entry(line_addr, @@ -299,8 +298,7 @@ Sequencer::removeRequest(SequencerRequest* srequest) assert(m_outstanding_count == m_writeRequestTable.size() + m_readRequestTable.size()); - Address line_addr(srequest->pkt->getAddr()); - line_addr.makeLineAddress(); + Addr line_addr = makeLineAddress(srequest->pkt->getAddr()); if ((srequest->m_type == RubyRequestType_ST) || (srequest->m_type == RubyRequestType_RMW_Read) || (srequest->m_type == RubyRequestType_RMW_Write) || @@ -317,7 +315,7 @@ Sequencer::removeRequest(SequencerRequest* srequest) } void -Sequencer::invalidateSC(const Address& address) +Sequencer::invalidateSC(Addr address) { RequestTable::iterator i = m_writeRequestTable.find(address); if (i != m_writeRequestTable.end()) { @@ -331,7 +329,7 @@ Sequencer::invalidateSC(const Address& address) } bool -Sequencer::handleLlsc(const Address& address, SequencerRequest* request) +Sequencer::handleLlsc(Addr address, SequencerRequest* request) { // // The success flag indicates whether the LLSC operation was successful. @@ -422,14 +420,14 @@ Sequencer::recordMissLatency(const Cycles cycles, const RubyRequestType type, } void -Sequencer::writeCallback(const Address& address, DataBlock& data, +Sequencer::writeCallback(Addr address, DataBlock& data, const bool externalHit, const MachineType mach, const Cycles initialRequestTime, const Cycles forwardRequestTime, const Cycles firstResponseTime) { - assert(address == line_address(address)); - assert(m_writeRequestTable.count(line_address(address))); + assert(address == makeLineAddress(address)); + assert(m_writeRequestTable.count(makeLineAddress(address))); RequestTable::iterator i = m_writeRequestTable.find(address); assert(i != m_writeRequestTable.end()); @@ -469,14 +467,14 @@ Sequencer::writeCallback(const Address& address, DataBlock& data, } void -Sequencer::readCallback(const Address& address, DataBlock& data, +Sequencer::readCallback(Addr address, DataBlock& data, bool externalHit, const MachineType mach, Cycles initialRequestTime, Cycles forwardRequestTime, Cycles firstResponseTime) { - assert(address == line_address(address)); - assert(m_readRequestTable.count(line_address(address))); + assert(address == makeLineAddress(address)); + assert(m_readRequestTable.count(makeLineAddress(address))); RequestTable::iterator i = m_readRequestTable.find(address); assert(i != m_readRequestTable.end()); @@ -501,9 +499,8 @@ Sequencer::hitCallback(SequencerRequest* srequest, DataBlock& data, const Cycles firstResponseTime) { PacketPtr pkt = srequest->pkt; - Address request_address(pkt->getAddr()); - Address request_line_address(pkt->getAddr()); - request_line_address.makeLineAddress(); + Addr request_address(pkt->getAddr()); + Addr request_line_address = makeLineAddress(pkt->getAddr()); RubyRequestType type = srequest->m_type; Cycles issued_time = srequest->issue_time; @@ -522,7 +519,7 @@ Sequencer::hitCallback(SequencerRequest* srequest, DataBlock& data, initialRequestTime, forwardRequestTime, firstResponseTime, curCycle()); - DPRINTFR(ProtocolTrace, "%15s %3s %10s%20s %6s>%-6s %s %d cycles\n", + DPRINTFR(ProtocolTrace, "%15s %3s %10s%20s %6s>%-6s %#x %d cycles\n", curTick(), m_version, "Seq", llscSuccess ? "Done" : "SC_Failed", "", "", request_address, total_latency); @@ -530,7 +527,7 @@ Sequencer::hitCallback(SequencerRequest* srequest, DataBlock& data, // update the data unless it is a non-data-carrying flush if (RubySystem::getWarmupEnabled()) { data.setData(pkt->getConstPtr<uint8_t>(), - request_address.getOffset(), pkt->getSize()); + getOffset(request_address), pkt->getSize()); } else if (!pkt->isFlush()) { if ((type == RubyRequestType_LD) || (type == RubyRequestType_IFETCH) || @@ -538,12 +535,12 @@ Sequencer::hitCallback(SequencerRequest* srequest, DataBlock& data, (type == RubyRequestType_Locked_RMW_Read) || (type == RubyRequestType_Load_Linked)) { memcpy(pkt->getPtr<uint8_t>(), - data.getData(request_address.getOffset(), pkt->getSize()), + data.getData(getOffset(request_address), pkt->getSize()), pkt->getSize()); DPRINTF(RubySequencer, "read data %s\n", data); } else { data.setData(pkt->getConstPtr<uint8_t>(), - request_address.getOffset(), pkt->getSize()); + getOffset(request_address), pkt->getSize()); DPRINTF(RubySequencer, "set data %s\n", data); } } @@ -690,7 +687,7 @@ Sequencer::issueRequest(PacketPtr pkt, RubyRequestType secondary_type) RubyAccessMode_Supervisor, pkt, PrefetchBit_No, proc_id); - DPRINTFR(ProtocolTrace, "%15s %3s %10s%20s %6s>%-6s %s %s\n", + DPRINTFR(ProtocolTrace, "%15s %3s %10s%20s %6s>%-6s %#x %s\n", curTick(), m_version, "Seq", "Begin", "", "", msg->getPhysicalAddress(), RubyRequestType_to_string(secondary_type)); @@ -743,7 +740,7 @@ Sequencer::print(ostream& out) const // upgraded when invoked, coherence violations will be checked for the // given block void -Sequencer::checkCoherence(const Address& addr) +Sequencer::checkCoherence(Addr addr) { #ifdef CHECK_COHERENCE m_ruby_system->checkGlobalCoherenceInvariant(addr); @@ -758,7 +755,7 @@ Sequencer::recordRequestType(SequencerRequestType requestType) { void -Sequencer::evictionCallback(const Address& address) +Sequencer::evictionCallback(Addr address) { ruby_eviction_callback(address); } diff --git a/src/mem/ruby/system/Sequencer.hh b/src/mem/ruby/system/Sequencer.hh index 505b3f3bc..c4ed6f21e 100644 --- a/src/mem/ruby/system/Sequencer.hh +++ b/src/mem/ruby/system/Sequencer.hh @@ -68,7 +68,7 @@ class Sequencer : public RubyPort void collateStats(); void regStats(); - void writeCallback(const Address& address, + void writeCallback(Addr address, DataBlock& data, const bool externalHit = false, const MachineType mach = MachineType_NUM, @@ -76,7 +76,7 @@ class Sequencer : public RubyPort const Cycles forwardRequestTime = Cycles(0), const Cycles firstResponseTime = Cycles(0)); - void readCallback(const Address& address, + void readCallback(Addr address, DataBlock& data, const bool externalHit = false, const MachineType mach = MachineType_NUM, @@ -95,12 +95,12 @@ class Sequencer : public RubyPort { deschedule(deadlockCheckEvent); } void print(std::ostream& out) const; - void checkCoherence(const Address& address); + void checkCoherence(Addr address); void markRemoved(); void removeRequest(SequencerRequest* request); - void evictionCallback(const Address& address); - void invalidateSC(const Address& address); + void evictionCallback(Addr address); + void invalidateSC(Addr address); void recordRequestType(SequencerRequestType requestType); Stats::Histogram& getOutstandReqHist() { return m_outstandReqHist; } @@ -167,7 +167,7 @@ class Sequencer : public RubyPort Cycles completionTime); RequestStatus insertRequest(PacketPtr pkt, RubyRequestType request_type); - bool handleLlsc(const Address& address, SequencerRequest* request); + bool handleLlsc(Addr address, SequencerRequest* request); // Private copy constructor and assignment operator Sequencer(const Sequencer& obj); @@ -187,7 +187,7 @@ class Sequencer : public RubyPort Cycles m_data_cache_hit_latency; Cycles m_inst_cache_hit_latency; - typedef m5::hash_map<Address, SequencerRequest*> RequestTable; + typedef m5::hash_map<Addr, SequencerRequest*> RequestTable; RequestTable m_writeRequestTable; RequestTable m_readRequestTable; // Global outstanding request count, across all request tables diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc index 98cf50e9c..c00082010 100644 --- a/src/mem/ruby/system/System.cc +++ b/src/mem/ruby/system/System.cc @@ -393,14 +393,13 @@ RubySystem::resetStats() bool RubySystem::functionalRead(PacketPtr pkt) { - Address address(pkt->getAddr()); - Address line_address(address); - line_address.makeLineAddress(); + Addr address(pkt->getAddr()); + Addr line_address = makeLineAddress(address); AccessPermission access_perm = AccessPermission_NotPresent; int num_controllers = m_abs_cntrl_vec.size(); - DPRINTF(RubySystem, "Functional Read request for %s\n",address); + DPRINTF(RubySystem, "Functional Read request for %s\n", address); unsigned int num_ro = 0; unsigned int num_rw = 0; @@ -477,12 +476,12 @@ RubySystem::functionalRead(PacketPtr pkt) bool RubySystem::functionalWrite(PacketPtr pkt) { - Address addr(pkt->getAddr()); - Address line_addr = line_address(addr); + Addr addr(pkt->getAddr()); + Addr line_addr = makeLineAddress(addr); AccessPermission access_perm = AccessPermission_NotPresent; int num_controllers = m_abs_cntrl_vec.size(); - DPRINTF(RubySystem, "Functional Write request for %s\n",addr); + DPRINTF(RubySystem, "Functional Write request for %s\n", addr); uint32_t M5_VAR_USED num_functional_writes = 0; |