diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2015-08-14 12:04:51 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2015-08-14 12:04:51 -0500 |
commit | 91a84c5b3cfb888794ac0245c066a4724b9a0871 (patch) | |
tree | 79a8b41aff56655dbd187934d2709fdd7488c6ed /src/cpu/testers | |
parent | 9ea5d9cad9381e05004de28ef25309ebe94c3a79 (diff) | |
download | gem5-91a84c5b3cfb888794ac0245c066a4724b9a0871.tar.xz |
ruby: replace Address by Addr
This patch eliminates the type Address defined by the ruby memory system.
This memory system would now use the type Addr that is in use by the
rest of the system.
Diffstat (limited to 'src/cpu/testers')
-rw-r--r-- | src/cpu/testers/rubytest/Check.cc | 34 | ||||
-rw-r--r-- | src/cpu/testers/rubytest/Check.hh | 10 | ||||
-rw-r--r-- | src/cpu/testers/rubytest/CheckTable.cc | 26 | ||||
-rw-r--r-- | src/cpu/testers/rubytest/CheckTable.hh | 6 | ||||
-rw-r--r-- | src/cpu/testers/rubytest/RubyTester.hh | 2 |
5 files changed, 36 insertions, 42 deletions
diff --git a/src/cpu/testers/rubytest/Check.cc b/src/cpu/testers/rubytest/Check.cc index 5f9aa497b..4cdaf9b2f 100644 --- a/src/cpu/testers/rubytest/Check.cc +++ b/src/cpu/testers/rubytest/Check.cc @@ -34,8 +34,8 @@ typedef RubyTester::SenderState SenderState; -Check::Check(const Address& address, const Address& pc, - int _num_writers, int _num_readers, RubyTester* _tester) +Check::Check(Addr address, Addr pc, int _num_writers, int _num_readers, + RubyTester* _tester) : m_num_writers(_num_writers), m_num_readers(_num_readers), m_tester_ptr(_tester) { @@ -103,8 +103,8 @@ Check::initiatePrefetch() } // Prefetches are assumed to be 0 sized - Request *req = new Request(m_address.getAddress(), 0, flags, - m_tester_ptr->masterId(), curTick(), m_pc.getAddress()); + Request *req = new Request(m_address, 0, flags, + m_tester_ptr->masterId(), curTick(), m_pc); req->setThreadContext(index, 0); PacketPtr pkt = new Packet(req, cmd); @@ -142,8 +142,8 @@ Check::initiateFlush() Request::Flags flags; - Request *req = new Request(m_address.getAddress(), CHECK_SIZE, flags, - m_tester_ptr->masterId(), curTick(), m_pc.getAddress()); + Request *req = new Request(m_address, CHECK_SIZE, flags, + m_tester_ptr->masterId(), curTick(), m_pc); Packet::Command cmd; @@ -172,12 +172,11 @@ Check::initiateAction() Request::Flags flags; // Create the particular address for the next byte to be written - Address writeAddr(m_address.getAddress() + m_store_count); + Addr writeAddr(m_address + m_store_count); // Stores are assumed to be 1 byte-sized - Request *req = new Request(writeAddr.getAddress(), 1, flags, - m_tester_ptr->masterId(), curTick(), - m_pc.getAddress()); + Request *req = new Request(writeAddr, 1, flags, m_tester_ptr->masterId(), + curTick(), m_pc); req->setThreadContext(index, 0); Packet::Command cmd; @@ -238,8 +237,8 @@ Check::initiateCheck() } // Checks are sized depending on the number of bytes written - Request *req = new Request(m_address.getAddress(), CHECK_SIZE, flags, - m_tester_ptr->masterId(), curTick(), m_pc.getAddress()); + Request *req = new Request(m_address, CHECK_SIZE, flags, + m_tester_ptr->masterId(), curTick(), m_pc); req->setThreadContext(index, 0); PacketPtr pkt = new Packet(req, MemCmd::ReadReq); @@ -273,12 +272,12 @@ Check::initiateCheck() void Check::performCallback(NodeID proc, SubBlock* data, Cycles curTime) { - Address address = data->getAddress(); + Addr address = data->getAddress(); // This isn't exactly right since we now have multi-byte checks // assert(getAddress() == address); - assert(getAddress().getLineAddress() == address.getLineAddress()); + assert(makeLineAddress(m_address) == makeLineAddress(address)); assert(data != NULL); DPRINTF(RubyTest, "RubyTester Callback\n"); @@ -325,13 +324,13 @@ Check::performCallback(NodeID proc, SubBlock* data, Cycles curTime) } DPRINTF(RubyTest, "proc: %d, Address: 0x%x\n", proc, - getAddress().getLineAddress()); + makeLineAddress(m_address)); DPRINTF(RubyTest, "Callback done\n"); debugPrint(); } void -Check::changeAddress(const Address& address) +Check::changeAddress(Addr address) { assert(m_status == TesterStatus_Idle || m_status == TesterStatus_Ready); m_status = TesterStatus_Idle; @@ -375,7 +374,6 @@ Check::debugPrint() { DPRINTF(RubyTest, "[%#x, value: %d, status: %s, initiating node: %d, store_count: %d]\n", - m_address.getAddress(), (int)m_value, - TesterStatus_to_string(m_status).c_str(), + m_address, (int)m_value, TesterStatus_to_string(m_status).c_str(), m_initiatingNode, m_store_count); } diff --git a/src/cpu/testers/rubytest/Check.hh b/src/cpu/testers/rubytest/Check.hh index a477cefeb..f7922d71f 100644 --- a/src/cpu/testers/rubytest/Check.hh +++ b/src/cpu/testers/rubytest/Check.hh @@ -45,13 +45,13 @@ const int CHECK_SIZE = (1 << CHECK_SIZE_BITS); class Check { public: - Check(const Address& address, const Address& pc, int _num_writers, + Check(Addr address, Addr pc, int _num_writers, int _num_readers, RubyTester* _tester); void initiate(); // Does Action or Check or nether void performCallback(NodeID proc, SubBlock* data, Cycles curTime); - const Address& getAddress() { return m_address; } - void changeAddress(const Address& address); + Addr getAddress() const { return m_address; } + void changeAddress(Addr address); void print(std::ostream& out) const; @@ -70,8 +70,8 @@ class Check uint8_t m_value; int m_store_count; NodeID m_initiatingNode; - Address m_address; - Address m_pc; + Addr m_address; + Addr m_pc; RubyAccessMode m_access_mode; int m_num_writers; int m_num_readers; diff --git a/src/cpu/testers/rubytest/CheckTable.cc b/src/cpu/testers/rubytest/CheckTable.cc index df2bf864d..decdd20a2 100644 --- a/src/cpu/testers/rubytest/CheckTable.cc +++ b/src/cpu/testers/rubytest/CheckTable.cc @@ -37,8 +37,7 @@ CheckTable::CheckTable(int _num_writers, int _num_readers, RubyTester* _tester) : m_num_writers(_num_writers), m_num_readers(_num_readers), m_tester_ptr(_tester) { - physical_address_t physical = 0; - Address address; + Addr physical = 0; const int size1 = 32; const int size2 = 100; @@ -47,8 +46,7 @@ CheckTable::CheckTable(int _num_writers, int _num_readers, RubyTester* _tester) physical = 1000; for (int i = 0; i < size1; i++) { // Setup linear addresses - address.setAddress(physical); - addCheck(address); + addCheck(physical); physical += CHECK_SIZE; } @@ -57,16 +55,14 @@ CheckTable::CheckTable(int _num_writers, int _num_readers, RubyTester* _tester) physical = 1000; for (int i = 0; i < size2; i++) { // Setup linear addresses - address.setAddress(physical); - addCheck(address); + addCheck(physical); physical += 256; } physical = 1000 + CHECK_SIZE; for (int i = 0; i < size2; i++) { // Setup linear addresses - address.setAddress(physical); - addCheck(address); + addCheck(physical); physical += 256; } } @@ -79,27 +75,27 @@ CheckTable::~CheckTable() } void -CheckTable::addCheck(const Address& address) +CheckTable::addCheck(Addr address) { if (floorLog2(CHECK_SIZE) != 0) { - if (address.bitSelect(0, CHECK_SIZE_BITS - 1) != 0) { + if (bitSelect(address, 0, CHECK_SIZE_BITS - 1) != 0) { panic("Check not aligned"); } } for (int i = 0; i < CHECK_SIZE; i++) { - if (m_lookup_map.count(Address(address.getAddress()+i))) { + if (m_lookup_map.count(address+i)) { // A mapping for this byte already existed, discard the // entire check return; } } - Check* check_ptr = new Check(address, Address(100 + m_check_vector.size()), + Check* check_ptr = new Check(address, 100 + m_check_vector.size(), m_num_writers, m_num_readers, m_tester_ptr); for (int i = 0; i < CHECK_SIZE; i++) { // Insert it once per byte - m_lookup_map[Address(address.getAddress() + i)] = check_ptr; + m_lookup_map[address + i] = check_ptr; } m_check_vector.push_back(check_ptr); } @@ -112,11 +108,11 @@ CheckTable::getRandomCheck() } Check* -CheckTable::getCheck(const Address& address) +CheckTable::getCheck(const Addr address) { DPRINTF(RubyTest, "Looking for check by address: %s", address); - m5::hash_map<Address, Check*>::iterator i = m_lookup_map.find(address); + m5::hash_map<Addr, Check*>::iterator i = m_lookup_map.find(address); if (i == m_lookup_map.end()) return NULL; diff --git a/src/cpu/testers/rubytest/CheckTable.hh b/src/cpu/testers/rubytest/CheckTable.hh index f03ad067d..fe7109f26 100644 --- a/src/cpu/testers/rubytest/CheckTable.hh +++ b/src/cpu/testers/rubytest/CheckTable.hh @@ -46,7 +46,7 @@ class CheckTable ~CheckTable(); Check* getRandomCheck(); - Check* getCheck(const Address& address); + Check* getCheck(Addr address); // bool isPresent(const Address& address) const; // void removeCheckFromTable(const Address& address); @@ -56,14 +56,14 @@ class CheckTable void print(std::ostream& out) const; private: - void addCheck(const Address& address); + void addCheck(Addr address); // Private copy constructor and assignment operator CheckTable(const CheckTable& obj); CheckTable& operator=(const CheckTable& obj); std::vector<Check*> m_check_vector; - m5::hash_map<Address, Check*> m_lookup_map; + m5::hash_map<Addr, Check*> m_lookup_map; int m_num_writers; int m_num_readers; diff --git a/src/cpu/testers/rubytest/RubyTester.hh b/src/cpu/testers/rubytest/RubyTester.hh index 0603103bd..c9f0b8dfc 100644 --- a/src/cpu/testers/rubytest/RubyTester.hh +++ b/src/cpu/testers/rubytest/RubyTester.hh @@ -82,7 +82,7 @@ class RubyTester : public MemObject { SubBlock subBlock; - SenderState(Address addr, int size) : subBlock(addr, size) {} + SenderState(Addr addr, int size) : subBlock(addr, size) {} }; |