diff options
Diffstat (limited to 'src/mem/ruby/system/Sequencer.cc')
-rw-r--r-- | src/mem/ruby/system/Sequencer.cc | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc index a030fc7c2..780c1128e 100644 --- a/src/mem/ruby/system/Sequencer.cc +++ b/src/mem/ruby/system/Sequencer.cc @@ -61,6 +61,8 @@ void Sequencer::init(const vector<string> & argv) m_instCache_ptr = NULL; m_dataCache_ptr = NULL; m_controller = NULL; + m_servicing_atomic = -1; + m_atomics_counter = 0; for (size_t i=0; i<argv.size(); i+=2) { if ( argv[i] == "controller") { m_controller = RubySystem::getController(argv[i+1]); // args[i] = "L1Cache" @@ -272,6 +274,12 @@ void Sequencer::writeCallback(const Address& address, DataBlock& data) { if (request->ruby_request.type == RubyRequestType_Locked_Read) { m_dataCache_ptr->setLocked(address, m_version); } + else if (request->ruby_request.type == RubyRequestType_RMW_Read) { + m_controller->set_atomic(address); + } + else if (request->ruby_request.type == RubyRequestType_RMW_Write) { + m_controller->clear_atomic(); + } hitCallback(request, data); } @@ -342,7 +350,7 @@ void Sequencer::hitCallback(SequencerRequest* srequest, DataBlock& data) { } // Returns true if the sequencer already has a load or store outstanding -bool Sequencer::isReady(const RubyRequest& request) const { +bool Sequencer::isReady(const RubyRequest& request) { // POLINA: check if we are currently flushing the write buffer, if so Ruby is returned as not ready // to simulate stalling of the front-end // Do we stall all the sequencers? If it is atomic instruction - yes! @@ -357,6 +365,31 @@ bool Sequencer::isReady(const RubyRequest& request) const { return false; } + if (m_servicing_atomic != -1 && m_servicing_atomic != (int)request.proc_id) { + assert(m_atomics_counter > 0); + return false; + } + else { + if (request.type == RubyRequestType_RMW_Read) { + if (m_servicing_atomic == -1) { + assert(m_atomics_counter == 0); + m_servicing_atomic = (int)request.proc_id; + } + else { + assert(m_servicing_atomic == (int)request.proc_id); + } + m_atomics_counter++; + } + else if (request.type == RubyRequestType_RMW_Write) { + assert(m_servicing_atomic == (int)request.proc_id); + assert(m_atomics_counter > 0); + m_atomics_counter--; + if (m_atomics_counter == 0) { + m_servicing_atomic = -1; + } + } + } + return true; } @@ -383,6 +416,9 @@ int64_t Sequencer::makeRequest(const RubyRequest & request) m_dataCache_ptr->clearLocked(line_address(Address(request.paddr))); } } + if (request.type == RubyRequestType_RMW_Write) { + m_controller->started_writes(); + } issueRequest(request); // TODO: issue hardware prefetches here @@ -438,7 +474,7 @@ void Sequencer::issueRequest(const RubyRequest& request) { } Address line_addr(request.paddr); line_addr.makeLineAddress(); - CacheMsg msg(line_addr, Address(request.paddr), ctype, Address(request.pc), amtype, request.len, PrefetchBit_No); + CacheMsg msg(line_addr, Address(request.paddr), ctype, Address(request.pc), amtype, request.len, PrefetchBit_No, request.proc_id); if (Debug::getProtocolTrace()) { g_system_ptr->getProfiler()->profileTransition("Seq", m_version, Address(request.paddr), |