Sequencer.cc revision 8174
16145Snate@binkert.org/*
26145Snate@binkert.org * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
36145Snate@binkert.org * All rights reserved.
46145Snate@binkert.org *
56145Snate@binkert.org * Redistribution and use in source and binary forms, with or without
66145Snate@binkert.org * modification, are permitted provided that the following conditions are
76145Snate@binkert.org * met: redistributions of source code must retain the above copyright
86145Snate@binkert.org * notice, this list of conditions and the following disclaimer;
96145Snate@binkert.org * redistributions in binary form must reproduce the above copyright
106145Snate@binkert.org * notice, this list of conditions and the following disclaimer in the
116145Snate@binkert.org * documentation and/or other materials provided with the distribution;
126145Snate@binkert.org * neither the name of the copyright holders nor the names of its
136145Snate@binkert.org * contributors may be used to endorse or promote products derived from
146145Snate@binkert.org * this software without specific prior written permission.
156145Snate@binkert.org *
166145Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
176145Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
186145Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
196145Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
206145Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
216145Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
226145Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
236145Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
246145Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
256145Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
266145Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
276145Snate@binkert.org */
286145Snate@binkert.org
297056Snate@binkert.org#include "base/str.hh"
307805Snilay@cs.wisc.edu#include "base/misc.hh"
317632SBrad.Beckmann@amd.com#include "cpu/testers/rubytest/RubyTester.hh"
327039Snate@binkert.org#include "mem/protocol/Protocol.hh"
337039Snate@binkert.org#include "mem/protocol/Protocol.hh"
347039Snate@binkert.org#include "mem/ruby/buffers/MessageBuffer.hh"
357039Snate@binkert.org#include "mem/ruby/common/Global.hh"
367039Snate@binkert.org#include "mem/ruby/common/SubBlock.hh"
378092Snilay@cs.wisc.edu#include "mem/ruby/slicc_interface/RubyRequest.hh"
387039Snate@binkert.org#include "mem/ruby/profiler/Profiler.hh"
397039Snate@binkert.org#include "mem/ruby/recorder/Tracer.hh"
407039Snate@binkert.org#include "mem/ruby/slicc_interface/AbstractController.hh"
417039Snate@binkert.org#include "mem/ruby/system/CacheMemory.hh"
426154Snate@binkert.org#include "mem/ruby/system/Sequencer.hh"
436154Snate@binkert.org#include "mem/ruby/system/System.hh"
447550SBrad.Beckmann@amd.com#include "mem/packet.hh"
456876Ssteve.reinhardt@amd.com#include "params/RubySequencer.hh"
466876Ssteve.reinhardt@amd.com
477055Snate@binkert.orgusing namespace std;
487055Snate@binkert.org
496876Ssteve.reinhardt@amd.comSequencer *
506876Ssteve.reinhardt@amd.comRubySequencerParams::create()
516285Snate@binkert.org{
526876Ssteve.reinhardt@amd.com    return new Sequencer(this);
536285Snate@binkert.org}
547039Snate@binkert.org
556876Ssteve.reinhardt@amd.comSequencer::Sequencer(const Params *p)
566886SBrad.Beckmann@amd.com    : RubyPort(p), deadlockCheckEvent(this)
576876Ssteve.reinhardt@amd.com{
586876Ssteve.reinhardt@amd.com    m_store_waiting_on_load_cycles = 0;
596876Ssteve.reinhardt@amd.com    m_store_waiting_on_store_cycles = 0;
606876Ssteve.reinhardt@amd.com    m_load_waiting_on_store_cycles = 0;
616876Ssteve.reinhardt@amd.com    m_load_waiting_on_load_cycles = 0;
627039Snate@binkert.org
636876Ssteve.reinhardt@amd.com    m_outstanding_count = 0;
646285Snate@binkert.org
656876Ssteve.reinhardt@amd.com    m_max_outstanding_requests = 0;
666876Ssteve.reinhardt@amd.com    m_deadlock_threshold = 0;
676876Ssteve.reinhardt@amd.com    m_instCache_ptr = NULL;
686876Ssteve.reinhardt@amd.com    m_dataCache_ptr = NULL;
696145Snate@binkert.org
706876Ssteve.reinhardt@amd.com    m_instCache_ptr = p->icache;
716876Ssteve.reinhardt@amd.com    m_dataCache_ptr = p->dcache;
726876Ssteve.reinhardt@amd.com    m_max_outstanding_requests = p->max_outstanding_requests;
736876Ssteve.reinhardt@amd.com    m_deadlock_threshold = p->deadlock_threshold;
746899SBrad.Beckmann@amd.com
756876Ssteve.reinhardt@amd.com    assert(m_max_outstanding_requests > 0);
766876Ssteve.reinhardt@amd.com    assert(m_deadlock_threshold > 0);
776876Ssteve.reinhardt@amd.com    assert(m_instCache_ptr != NULL);
786876Ssteve.reinhardt@amd.com    assert(m_dataCache_ptr != NULL);
798171Stushar@csail.mit.edu
808171Stushar@csail.mit.edu    m_usingNetworkTester = p->using_network_tester;
816145Snate@binkert.org}
826145Snate@binkert.org
837039Snate@binkert.orgSequencer::~Sequencer()
847039Snate@binkert.org{
856145Snate@binkert.org}
866145Snate@binkert.org
877039Snate@binkert.orgvoid
887039Snate@binkert.orgSequencer::wakeup()
897039Snate@binkert.org{
907039Snate@binkert.org    // Check for deadlock of any of the requests
917039Snate@binkert.org    Time current_time = g_eventQueue_ptr->getTime();
926145Snate@binkert.org
937039Snate@binkert.org    // Check across all outstanding requests
947039Snate@binkert.org    int total_outstanding = 0;
956285Snate@binkert.org
967455Snate@binkert.org    RequestTable::iterator read = m_readRequestTable.begin();
977455Snate@binkert.org    RequestTable::iterator read_end = m_readRequestTable.end();
987455Snate@binkert.org    for (; read != read_end; ++read) {
997455Snate@binkert.org        SequencerRequest* request = read->second;
1007455Snate@binkert.org        if (current_time - request->issue_time < m_deadlock_threshold)
1017455Snate@binkert.org            continue;
1027455Snate@binkert.org
1037805Snilay@cs.wisc.edu        panic("Possible Deadlock detected. Aborting!\n"
1047921SBrad.Beckmann@amd.com             "version: %d request.paddr: 0x%x m_readRequestTable: %d "
1057805Snilay@cs.wisc.edu             "current time: %u issue_time: %d difference: %d\n", m_version,
1068174Snilay@cs.wisc.edu             request->ruby_request.m_PhysicalAddress, m_readRequestTable.size(),
1077805Snilay@cs.wisc.edu             current_time, request->issue_time,
1087805Snilay@cs.wisc.edu             current_time - request->issue_time);
1096145Snate@binkert.org    }
1106145Snate@binkert.org
1117455Snate@binkert.org    RequestTable::iterator write = m_writeRequestTable.begin();
1127455Snate@binkert.org    RequestTable::iterator write_end = m_writeRequestTable.end();
1137455Snate@binkert.org    for (; write != write_end; ++write) {
1147455Snate@binkert.org        SequencerRequest* request = write->second;
1157455Snate@binkert.org        if (current_time - request->issue_time < m_deadlock_threshold)
1167455Snate@binkert.org            continue;
1177455Snate@binkert.org
1187805Snilay@cs.wisc.edu        panic("Possible Deadlock detected. Aborting!\n"
1197921SBrad.Beckmann@amd.com             "version: %d request.paddr: 0x%x m_writeRequestTable: %d "
1207805Snilay@cs.wisc.edu             "current time: %u issue_time: %d difference: %d\n", m_version,
1218174Snilay@cs.wisc.edu             request->ruby_request.m_PhysicalAddress, m_writeRequestTable.size(),
1227805Snilay@cs.wisc.edu             current_time, request->issue_time,
1237805Snilay@cs.wisc.edu             current_time - request->issue_time);
1246145Snate@binkert.org    }
1256285Snate@binkert.org
1267039Snate@binkert.org    total_outstanding += m_writeRequestTable.size();
1277039Snate@binkert.org    total_outstanding += m_readRequestTable.size();
1286145Snate@binkert.org
1297039Snate@binkert.org    assert(m_outstanding_count == total_outstanding);
1307039Snate@binkert.org
1317039Snate@binkert.org    if (m_outstanding_count > 0) {
1327039Snate@binkert.org        // If there are still outstanding requests, keep checking
1337039Snate@binkert.org        schedule(deadlockCheckEvent,
1347039Snate@binkert.org                 m_deadlock_threshold * g_eventQueue_ptr->getClock() +
1357823Ssteve.reinhardt@amd.com                 curTick());
1367039Snate@binkert.org    }
1376145Snate@binkert.org}
1386145Snate@binkert.org
1397039Snate@binkert.orgvoid
1407039Snate@binkert.orgSequencer::printStats(ostream & out) const
1417039Snate@binkert.org{
1427039Snate@binkert.org    out << "Sequencer: " << m_name << endl
1437039Snate@binkert.org        << "  store_waiting_on_load_cycles: "
1447039Snate@binkert.org        << m_store_waiting_on_load_cycles << endl
1457039Snate@binkert.org        << "  store_waiting_on_store_cycles: "
1467039Snate@binkert.org        << m_store_waiting_on_store_cycles << endl
1477039Snate@binkert.org        << "  load_waiting_on_load_cycles: "
1487039Snate@binkert.org        << m_load_waiting_on_load_cycles << endl
1497039Snate@binkert.org        << "  load_waiting_on_store_cycles: "
1507039Snate@binkert.org        << m_load_waiting_on_store_cycles << endl;
1516859Sdrh5@cs.wisc.edu}
1526859Sdrh5@cs.wisc.edu
1537039Snate@binkert.orgvoid
1547039Snate@binkert.orgSequencer::printProgress(ostream& out) const
1557039Snate@binkert.org{
1567039Snate@binkert.org#if 0
1577039Snate@binkert.org    int total_demand = 0;
1587039Snate@binkert.org    out << "Sequencer Stats Version " << m_version << endl;
1597039Snate@binkert.org    out << "Current time = " << g_eventQueue_ptr->getTime() << endl;
1607039Snate@binkert.org    out << "---------------" << endl;
1617039Snate@binkert.org    out << "outstanding requests" << endl;
1626145Snate@binkert.org
1637455Snate@binkert.org    out << "proc " << m_Read
1647455Snate@binkert.org        << " version Requests = " << m_readRequestTable.size() << endl;
1656145Snate@binkert.org
1667039Snate@binkert.org    // print the request table
1677455Snate@binkert.org    RequestTable::iterator read = m_readRequestTable.begin();
1687455Snate@binkert.org    RequestTable::iterator read_end = m_readRequestTable.end();
1697455Snate@binkert.org    for (; read != read_end; ++read) {
1707455Snate@binkert.org        SequencerRequest* request = read->second;
1717039Snate@binkert.org        out << "\tRequest[ " << i << " ] = " << request->type
1727039Snate@binkert.org            << " Address " << rkeys[i]
1737039Snate@binkert.org            << " Posted " << request->issue_time
1747039Snate@binkert.org            << " PF " << PrefetchBit_No << endl;
1756145Snate@binkert.org        total_demand++;
1767039Snate@binkert.org    }
1776145Snate@binkert.org
1787455Snate@binkert.org    out << "proc " << m_version
1797455Snate@binkert.org        << " Write Requests = " << m_writeRequestTable.size << endl;
1806285Snate@binkert.org
1817039Snate@binkert.org    // print the request table
1827455Snate@binkert.org    RequestTable::iterator write = m_writeRequestTable.begin();
1837455Snate@binkert.org    RequestTable::iterator write_end = m_writeRequestTable.end();
1847455Snate@binkert.org    for (; write != write_end; ++write) {
1857455Snate@binkert.org        SequencerRequest* request = write->second;
1867039Snate@binkert.org        out << "\tRequest[ " << i << " ] = " << request.getType()
1877039Snate@binkert.org            << " Address " << wkeys[i]
1887039Snate@binkert.org            << " Posted " << request.getTime()
1897039Snate@binkert.org            << " PF " << request.getPrefetch() << endl;
1907039Snate@binkert.org        if (request.getPrefetch() == PrefetchBit_No) {
1917039Snate@binkert.org            total_demand++;
1927039Snate@binkert.org        }
1937039Snate@binkert.org    }
1947039Snate@binkert.org
1957039Snate@binkert.org    out << endl;
1967039Snate@binkert.org
1977039Snate@binkert.org    out << "Total Number Outstanding: " << m_outstanding_count << endl
1987039Snate@binkert.org        << "Total Number Demand     : " << total_demand << endl
1997039Snate@binkert.org        << "Total Number Prefetches : " << m_outstanding_count - total_demand
2007039Snate@binkert.org        << endl << endl << endl;
2017039Snate@binkert.org#endif
2026145Snate@binkert.org}
2036145Snate@binkert.org
2047039Snate@binkert.orgvoid
2057039Snate@binkert.orgSequencer::printConfig(ostream& out) const
2067039Snate@binkert.org{
2077039Snate@binkert.org    out << "Seqeuncer config: " << m_name << endl
2087039Snate@binkert.org        << "  controller: " << m_controller->getName() << endl
2097039Snate@binkert.org        << "  version: " << m_version << endl
2107039Snate@binkert.org        << "  max_outstanding_requests: " << m_max_outstanding_requests << endl
2117039Snate@binkert.org        << "  deadlock_threshold: " << m_deadlock_threshold << endl;
2126145Snate@binkert.org}
2136145Snate@binkert.org
2146145Snate@binkert.org// Insert the request on the correct request table.  Return true if
2156145Snate@binkert.org// the entry was already present.
2167039Snate@binkert.orgbool
2177039Snate@binkert.orgSequencer::insertRequest(SequencerRequest* request)
2187039Snate@binkert.org{
2197039Snate@binkert.org    int total_outstanding =
2207039Snate@binkert.org        m_writeRequestTable.size() + m_readRequestTable.size();
2216285Snate@binkert.org
2227039Snate@binkert.org    assert(m_outstanding_count == total_outstanding);
2236145Snate@binkert.org
2247039Snate@binkert.org    // See if we should schedule a deadlock check
2257039Snate@binkert.org    if (deadlockCheckEvent.scheduled() == false) {
2267823Ssteve.reinhardt@amd.com        schedule(deadlockCheckEvent, m_deadlock_threshold + curTick());
2277039Snate@binkert.org    }
2286145Snate@binkert.org
2298174Snilay@cs.wisc.edu    Address line_addr(request->ruby_request.m_PhysicalAddress);
2307039Snate@binkert.org    line_addr.makeLineAddress();
2318174Snilay@cs.wisc.edu    if ((request->ruby_request.m_Type == RubyRequestType_ST) ||
2328174Snilay@cs.wisc.edu        (request->ruby_request.m_Type == RubyRequestType_RMW_Read) ||
2338174Snilay@cs.wisc.edu        (request->ruby_request.m_Type == RubyRequestType_RMW_Write) ||
2348174Snilay@cs.wisc.edu        (request->ruby_request.m_Type == RubyRequestType_Load_Linked) ||
2358174Snilay@cs.wisc.edu        (request->ruby_request.m_Type == RubyRequestType_Store_Conditional) ||
2368174Snilay@cs.wisc.edu        (request->ruby_request.m_Type == RubyRequestType_Locked_RMW_Read) ||
2378174Snilay@cs.wisc.edu        (request->ruby_request.m_Type == RubyRequestType_Locked_RMW_Write)) {
2387455Snate@binkert.org        pair<RequestTable::iterator, bool> r =
2397455Snate@binkert.org            m_writeRequestTable.insert(RequestTable::value_type(line_addr, 0));
2407455Snate@binkert.org        bool success = r.second;
2417455Snate@binkert.org        RequestTable::iterator i = r.first;
2427455Snate@binkert.org        if (!success) {
2437455Snate@binkert.org            i->second = request;
2447039Snate@binkert.org            // return true;
2457039Snate@binkert.org
2467039Snate@binkert.org            // drh5: isn't this an error?  do you lose the initial request?
2477039Snate@binkert.org            assert(0);
2487039Snate@binkert.org        }
2497455Snate@binkert.org        i->second = request;
2507039Snate@binkert.org        m_outstanding_count++;
2517039Snate@binkert.org    } else {
2527455Snate@binkert.org        pair<RequestTable::iterator, bool> r =
2537455Snate@binkert.org            m_readRequestTable.insert(RequestTable::value_type(line_addr, 0));
2547455Snate@binkert.org        bool success = r.second;
2557455Snate@binkert.org        RequestTable::iterator i = r.first;
2567455Snate@binkert.org        if (!success) {
2577455Snate@binkert.org            i->second = request;
2587039Snate@binkert.org            // return true;
2597039Snate@binkert.org
2607039Snate@binkert.org            // drh5: isn't this an error?  do you lose the initial request?
2617039Snate@binkert.org            assert(0);
2627039Snate@binkert.org        }
2637455Snate@binkert.org        i->second = request;
2647039Snate@binkert.org        m_outstanding_count++;
2656145Snate@binkert.org    }
2666145Snate@binkert.org
2677039Snate@binkert.org    g_system_ptr->getProfiler()->sequencerRequests(m_outstanding_count);
2686145Snate@binkert.org
2697039Snate@binkert.org    total_outstanding = m_writeRequestTable.size() + m_readRequestTable.size();
2707039Snate@binkert.org    assert(m_outstanding_count == total_outstanding);
2716145Snate@binkert.org
2727039Snate@binkert.org    return false;
2736145Snate@binkert.org}
2746145Snate@binkert.org
2757039Snate@binkert.orgvoid
2767455Snate@binkert.orgSequencer::markRemoved()
2777455Snate@binkert.org{
2787455Snate@binkert.org    m_outstanding_count--;
2797455Snate@binkert.org    assert(m_outstanding_count ==
2807455Snate@binkert.org           m_writeRequestTable.size() + m_readRequestTable.size());
2817455Snate@binkert.org}
2827455Snate@binkert.org
2837455Snate@binkert.orgvoid
2847039Snate@binkert.orgSequencer::removeRequest(SequencerRequest* srequest)
2857039Snate@binkert.org{
2867039Snate@binkert.org    assert(m_outstanding_count ==
2877039Snate@binkert.org           m_writeRequestTable.size() + m_readRequestTable.size());
2886145Snate@binkert.org
2897039Snate@binkert.org    const RubyRequest & ruby_request = srequest->ruby_request;
2908174Snilay@cs.wisc.edu    Address line_addr(ruby_request.m_PhysicalAddress);
2917039Snate@binkert.org    line_addr.makeLineAddress();
2928174Snilay@cs.wisc.edu    if ((ruby_request.m_Type == RubyRequestType_ST) ||
2938174Snilay@cs.wisc.edu        (ruby_request.m_Type == RubyRequestType_RMW_Read) ||
2948174Snilay@cs.wisc.edu        (ruby_request.m_Type == RubyRequestType_RMW_Write) ||
2958174Snilay@cs.wisc.edu        (ruby_request.m_Type == RubyRequestType_Load_Linked) ||
2968174Snilay@cs.wisc.edu        (ruby_request.m_Type == RubyRequestType_Store_Conditional) ||
2978174Snilay@cs.wisc.edu        (ruby_request.m_Type == RubyRequestType_Locked_RMW_Read) ||
2988174Snilay@cs.wisc.edu        (ruby_request.m_Type == RubyRequestType_Locked_RMW_Write)) {
2997455Snate@binkert.org        m_writeRequestTable.erase(line_addr);
3007039Snate@binkert.org    } else {
3017455Snate@binkert.org        m_readRequestTable.erase(line_addr);
3027039Snate@binkert.org    }
3036285Snate@binkert.org
3047455Snate@binkert.org    markRemoved();
3056145Snate@binkert.org}
3066145Snate@binkert.org
3077560SBrad.Beckmann@amd.combool
3087560SBrad.Beckmann@amd.comSequencer::handleLlsc(const Address& address, SequencerRequest* request)
3097550SBrad.Beckmann@amd.com{
3107560SBrad.Beckmann@amd.com    //
3117560SBrad.Beckmann@amd.com    // The success flag indicates whether the LLSC operation was successful.
3127560SBrad.Beckmann@amd.com    // LL ops will always succeed, but SC may fail if the cache line is no
3137560SBrad.Beckmann@amd.com    // longer locked.
3147560SBrad.Beckmann@amd.com    //
3157560SBrad.Beckmann@amd.com    bool success = true;
3168174Snilay@cs.wisc.edu    if (request->ruby_request.m_Type == RubyRequestType_Store_Conditional) {
3177550SBrad.Beckmann@amd.com        if (!m_dataCache_ptr->isLocked(address, m_version)) {
3187550SBrad.Beckmann@amd.com            //
3197550SBrad.Beckmann@amd.com            // For failed SC requests, indicate the failure to the cpu by
3207550SBrad.Beckmann@amd.com            // setting the extra data to zero.
3217550SBrad.Beckmann@amd.com            //
3227550SBrad.Beckmann@amd.com            request->ruby_request.pkt->req->setExtraData(0);
3237560SBrad.Beckmann@amd.com            success = false;
3247550SBrad.Beckmann@amd.com        } else {
3257550SBrad.Beckmann@amd.com            //
3267550SBrad.Beckmann@amd.com            // For successful SC requests, indicate the success to the cpu by
3277550SBrad.Beckmann@amd.com            // setting the extra data to one.
3287550SBrad.Beckmann@amd.com            //
3297550SBrad.Beckmann@amd.com            request->ruby_request.pkt->req->setExtraData(1);
3307550SBrad.Beckmann@amd.com        }
3317560SBrad.Beckmann@amd.com        //
3327560SBrad.Beckmann@amd.com        // Independent of success, all SC operations must clear the lock
3337560SBrad.Beckmann@amd.com        //
3347550SBrad.Beckmann@amd.com        m_dataCache_ptr->clearLocked(address);
3358174Snilay@cs.wisc.edu    } else if (request->ruby_request.m_Type == RubyRequestType_Load_Linked) {
3367550SBrad.Beckmann@amd.com        //
3377550SBrad.Beckmann@amd.com        // Note: To fully follow Alpha LLSC semantics, should the LL clear any
3387550SBrad.Beckmann@amd.com        // previously locked cache lines?
3397550SBrad.Beckmann@amd.com        //
3407550SBrad.Beckmann@amd.com        m_dataCache_ptr->setLocked(address, m_version);
3417550SBrad.Beckmann@amd.com    } else if (m_dataCache_ptr->isLocked(address, m_version)) {
3427550SBrad.Beckmann@amd.com        //
3437550SBrad.Beckmann@amd.com        // Normal writes should clear the locked address
3447550SBrad.Beckmann@amd.com        //
3457550SBrad.Beckmann@amd.com        m_dataCache_ptr->clearLocked(address);
3467550SBrad.Beckmann@amd.com    }
3477560SBrad.Beckmann@amd.com    return success;
3487550SBrad.Beckmann@amd.com}
3497550SBrad.Beckmann@amd.com
3507550SBrad.Beckmann@amd.comvoid
3517039Snate@binkert.orgSequencer::writeCallback(const Address& address, DataBlock& data)
3527039Snate@binkert.org{
3537546SBrad.Beckmann@amd.com    writeCallback(address, GenericMachineType_NULL, data);
3547546SBrad.Beckmann@amd.com}
3557546SBrad.Beckmann@amd.com
3567546SBrad.Beckmann@amd.comvoid
3577546SBrad.Beckmann@amd.comSequencer::writeCallback(const Address& address,
3587546SBrad.Beckmann@amd.com                         GenericMachineType mach,
3597546SBrad.Beckmann@amd.com                         DataBlock& data)
3607546SBrad.Beckmann@amd.com{
3617565SBrad.Beckmann@amd.com    writeCallback(address, mach, data, 0, 0, 0);
3627565SBrad.Beckmann@amd.com}
3637565SBrad.Beckmann@amd.com
3647565SBrad.Beckmann@amd.comvoid
3657565SBrad.Beckmann@amd.comSequencer::writeCallback(const Address& address,
3667565SBrad.Beckmann@amd.com                         GenericMachineType mach,
3677565SBrad.Beckmann@amd.com                         DataBlock& data,
3687565SBrad.Beckmann@amd.com                         Time initialRequestTime,
3697565SBrad.Beckmann@amd.com                         Time forwardRequestTime,
3707565SBrad.Beckmann@amd.com                         Time firstResponseTime)
3717565SBrad.Beckmann@amd.com{
3727039Snate@binkert.org    assert(address == line_address(address));
3737455Snate@binkert.org    assert(m_writeRequestTable.count(line_address(address)));
3746145Snate@binkert.org
3757455Snate@binkert.org    RequestTable::iterator i = m_writeRequestTable.find(address);
3767455Snate@binkert.org    assert(i != m_writeRequestTable.end());
3777455Snate@binkert.org    SequencerRequest* request = i->second;
3786145Snate@binkert.org
3797455Snate@binkert.org    m_writeRequestTable.erase(i);
3807455Snate@binkert.org    markRemoved();
3816846Spdudnik@cs.wisc.edu
3828174Snilay@cs.wisc.edu    assert((request->ruby_request.m_Type == RubyRequestType_ST) ||
3838174Snilay@cs.wisc.edu           (request->ruby_request.m_Type == RubyRequestType_RMW_Read) ||
3848174Snilay@cs.wisc.edu           (request->ruby_request.m_Type == RubyRequestType_RMW_Write) ||
3858174Snilay@cs.wisc.edu           (request->ruby_request.m_Type == RubyRequestType_Load_Linked) ||
3868174Snilay@cs.wisc.edu           (request->ruby_request.m_Type == RubyRequestType_Store_Conditional) ||
3878174Snilay@cs.wisc.edu           (request->ruby_request.m_Type == RubyRequestType_Locked_RMW_Read) ||
3888174Snilay@cs.wisc.edu           (request->ruby_request.m_Type == RubyRequestType_Locked_RMW_Write));
3896145Snate@binkert.org
3907550SBrad.Beckmann@amd.com    //
3917550SBrad.Beckmann@amd.com    // For Alpha, properly handle LL, SC, and write requests with respect to
3927550SBrad.Beckmann@amd.com    // locked cache blocks.
3937550SBrad.Beckmann@amd.com    //
3948171Stushar@csail.mit.edu    // Not valid for Network_test protocl
3958171Stushar@csail.mit.edu    //
3968171Stushar@csail.mit.edu    bool success = true;
3978171Stushar@csail.mit.edu    if(!m_usingNetworkTester)
3988171Stushar@csail.mit.edu        success = handleLlsc(address, request);
3997550SBrad.Beckmann@amd.com
4008174Snilay@cs.wisc.edu    if (request->ruby_request.m_Type == RubyRequestType_Locked_RMW_Read) {
4017039Snate@binkert.org        m_controller->blockOnQueue(address, m_mandatory_q_ptr);
4028174Snilay@cs.wisc.edu    } else if (request->ruby_request.m_Type == RubyRequestType_Locked_RMW_Write) {
4037039Snate@binkert.org        m_controller->unblock(address);
4047039Snate@binkert.org    }
4056863Sdrh5@cs.wisc.edu
4067565SBrad.Beckmann@amd.com    hitCallback(request, mach, data, success,
4077565SBrad.Beckmann@amd.com                initialRequestTime, forwardRequestTime, firstResponseTime);
4086145Snate@binkert.org}
4096145Snate@binkert.org
4107039Snate@binkert.orgvoid
4117039Snate@binkert.orgSequencer::readCallback(const Address& address, DataBlock& data)
4127039Snate@binkert.org{
4137546SBrad.Beckmann@amd.com    readCallback(address, GenericMachineType_NULL, data);
4147546SBrad.Beckmann@amd.com}
4157546SBrad.Beckmann@amd.com
4167546SBrad.Beckmann@amd.comvoid
4177546SBrad.Beckmann@amd.comSequencer::readCallback(const Address& address,
4187546SBrad.Beckmann@amd.com                        GenericMachineType mach,
4197546SBrad.Beckmann@amd.com                        DataBlock& data)
4207546SBrad.Beckmann@amd.com{
4217565SBrad.Beckmann@amd.com    readCallback(address, mach, data, 0, 0, 0);
4227565SBrad.Beckmann@amd.com}
4237565SBrad.Beckmann@amd.com
4247565SBrad.Beckmann@amd.comvoid
4257565SBrad.Beckmann@amd.comSequencer::readCallback(const Address& address,
4267565SBrad.Beckmann@amd.com                        GenericMachineType mach,
4277565SBrad.Beckmann@amd.com                        DataBlock& data,
4287565SBrad.Beckmann@amd.com                        Time initialRequestTime,
4297565SBrad.Beckmann@amd.com                        Time forwardRequestTime,
4307565SBrad.Beckmann@amd.com                        Time firstResponseTime)
4317565SBrad.Beckmann@amd.com{
4327039Snate@binkert.org    assert(address == line_address(address));
4337455Snate@binkert.org    assert(m_readRequestTable.count(line_address(address)));
4346145Snate@binkert.org
4357455Snate@binkert.org    RequestTable::iterator i = m_readRequestTable.find(address);
4367455Snate@binkert.org    assert(i != m_readRequestTable.end());
4377455Snate@binkert.org    SequencerRequest* request = i->second;
4387455Snate@binkert.org
4397455Snate@binkert.org    m_readRequestTable.erase(i);
4407455Snate@binkert.org    markRemoved();
4416145Snate@binkert.org
4428174Snilay@cs.wisc.edu    assert((request->ruby_request.m_Type == RubyRequestType_LD) ||
4438174Snilay@cs.wisc.edu           (request->ruby_request.m_Type == RubyRequestType_IFETCH));
4446285Snate@binkert.org
4457565SBrad.Beckmann@amd.com    hitCallback(request, mach, data, true,
4467565SBrad.Beckmann@amd.com                initialRequestTime, forwardRequestTime, firstResponseTime);
4476145Snate@binkert.org}
4486145Snate@binkert.org
4497039Snate@binkert.orgvoid
4507546SBrad.Beckmann@amd.comSequencer::hitCallback(SequencerRequest* srequest,
4517546SBrad.Beckmann@amd.com                       GenericMachineType mach,
4527560SBrad.Beckmann@amd.com                       DataBlock& data,
4537565SBrad.Beckmann@amd.com                       bool success,
4547565SBrad.Beckmann@amd.com                       Time initialRequestTime,
4557565SBrad.Beckmann@amd.com                       Time forwardRequestTime,
4567565SBrad.Beckmann@amd.com                       Time firstResponseTime)
4577039Snate@binkert.org{
4587039Snate@binkert.org    const RubyRequest & ruby_request = srequest->ruby_request;
4598174Snilay@cs.wisc.edu    Address request_address(ruby_request.m_PhysicalAddress);
4608174Snilay@cs.wisc.edu    Address request_line_address(ruby_request.m_PhysicalAddress);
4617039Snate@binkert.org    request_line_address.makeLineAddress();
4628174Snilay@cs.wisc.edu    RubyRequestType type = ruby_request.m_Type;
4637039Snate@binkert.org    Time issued_time = srequest->issue_time;
4646145Snate@binkert.org
4657039Snate@binkert.org    // Set this cache entry to the most recently used
4667039Snate@binkert.org    if (type == RubyRequestType_IFETCH) {
4677039Snate@binkert.org        if (m_instCache_ptr->isTagPresent(request_line_address))
4687039Snate@binkert.org            m_instCache_ptr->setMRU(request_line_address);
4697039Snate@binkert.org    } else {
4707039Snate@binkert.org        if (m_dataCache_ptr->isTagPresent(request_line_address))
4717039Snate@binkert.org            m_dataCache_ptr->setMRU(request_line_address);
4727039Snate@binkert.org    }
4736145Snate@binkert.org
4747039Snate@binkert.org    assert(g_eventQueue_ptr->getTime() >= issued_time);
4757039Snate@binkert.org    Time miss_latency = g_eventQueue_ptr->getTime() - issued_time;
4766145Snate@binkert.org
4777039Snate@binkert.org    // Profile the miss latency for all non-zero demand misses
4787039Snate@binkert.org    if (miss_latency != 0) {
4797546SBrad.Beckmann@amd.com        g_system_ptr->getProfiler()->missLatency(miss_latency, type, mach);
4806285Snate@binkert.org
4817565SBrad.Beckmann@amd.com        if (mach == GenericMachineType_L1Cache_wCC) {
4827565SBrad.Beckmann@amd.com            g_system_ptr->getProfiler()->missLatencyWcc(issued_time,
4837565SBrad.Beckmann@amd.com                                                   initialRequestTime,
4847565SBrad.Beckmann@amd.com                                                   forwardRequestTime,
4857565SBrad.Beckmann@amd.com                                                   firstResponseTime,
4867565SBrad.Beckmann@amd.com                                                   g_eventQueue_ptr->getTime());
4877565SBrad.Beckmann@amd.com        }
4887565SBrad.Beckmann@amd.com
4897565SBrad.Beckmann@amd.com        if (mach == GenericMachineType_Directory) {
4907565SBrad.Beckmann@amd.com            g_system_ptr->getProfiler()->missLatencyDir(issued_time,
4917565SBrad.Beckmann@amd.com                                                   initialRequestTime,
4927565SBrad.Beckmann@amd.com                                                   forwardRequestTime,
4937565SBrad.Beckmann@amd.com                                                   firstResponseTime,
4947565SBrad.Beckmann@amd.com                                                   g_eventQueue_ptr->getTime());
4957565SBrad.Beckmann@amd.com        }
4967565SBrad.Beckmann@amd.com
4977832Snate@binkert.org        DPRINTFR(ProtocolTrace, "%7s %3s %10s%20s %6s>%-6s %s %d cycles\n",
4987832Snate@binkert.org            g_eventQueue_ptr->getTime(), m_version, "Seq",
4997832Snate@binkert.org            success ? "Done" : "SC_Failed", "", "",
5008174Snilay@cs.wisc.edu            ruby_request.m_PhysicalAddress, miss_latency);
5016285Snate@binkert.org    }
5027039Snate@binkert.org#if 0
5037039Snate@binkert.org    if (request.getPrefetch() == PrefetchBit_Yes) {
5047039Snate@binkert.org        return; // Ignore the prefetch
5057039Snate@binkert.org    }
5067039Snate@binkert.org#endif
5076285Snate@binkert.org
5087039Snate@binkert.org    // update the data
5097039Snate@binkert.org    if (ruby_request.data != NULL) {
5107039Snate@binkert.org        if ((type == RubyRequestType_LD) ||
5117039Snate@binkert.org            (type == RubyRequestType_IFETCH) ||
5127039Snate@binkert.org            (type == RubyRequestType_RMW_Read) ||
5137908Shestness@cs.utexas.edu            (type == RubyRequestType_Locked_RMW_Read) ||
5147907Shestness@cs.utexas.edu            (type == RubyRequestType_Load_Linked)) {
5157039Snate@binkert.org            memcpy(ruby_request.data,
5168174Snilay@cs.wisc.edu                   data.getData(request_address.getOffset(), ruby_request.m_Size),
5178174Snilay@cs.wisc.edu                   ruby_request.m_Size);
5187039Snate@binkert.org        } else {
5197039Snate@binkert.org            data.setData(ruby_request.data, request_address.getOffset(),
5208174Snilay@cs.wisc.edu                         ruby_request.m_Size);
5217039Snate@binkert.org        }
5226285Snate@binkert.org    } else {
5237039Snate@binkert.org        DPRINTF(MemoryAccess,
5247039Snate@binkert.org                "WARNING.  Data not transfered from Ruby to M5 for type %s\n",
5257039Snate@binkert.org                RubyRequestType_to_string(type));
5267039Snate@binkert.org    }
5277023SBrad.Beckmann@amd.com
5287039Snate@binkert.org    // If using the RubyTester, update the RubyTester sender state's
5297039Snate@binkert.org    // subBlock with the recieved data.  The tester will later access
5307039Snate@binkert.org    // this state.
5317039Snate@binkert.org    // Note: RubyPort will access it's sender state before the
5327039Snate@binkert.org    // RubyTester.
5337039Snate@binkert.org    if (m_usingRubyTester) {
5347039Snate@binkert.org        RubyPort::SenderState *requestSenderState =
5357039Snate@binkert.org            safe_cast<RubyPort::SenderState*>(ruby_request.pkt->senderState);
5367039Snate@binkert.org        RubyTester::SenderState* testerSenderState =
5377039Snate@binkert.org            safe_cast<RubyTester::SenderState*>(requestSenderState->saved);
5387039Snate@binkert.org        testerSenderState->subBlock->mergeFrom(data);
5397039Snate@binkert.org    }
5407023SBrad.Beckmann@amd.com
5417039Snate@binkert.org    ruby_hit_callback(ruby_request.pkt);
5427039Snate@binkert.org    delete srequest;
5436285Snate@binkert.org}
5446285Snate@binkert.org
5456285Snate@binkert.org// Returns true if the sequencer already has a load or store outstanding
5467039Snate@binkert.orgRequestStatus
5477039Snate@binkert.orgSequencer::getRequestStatus(const RubyRequest& request)
5487039Snate@binkert.org{
5497039Snate@binkert.org    bool is_outstanding_store =
5508174Snilay@cs.wisc.edu        !!m_writeRequestTable.count(line_address(request.m_PhysicalAddress));
5517039Snate@binkert.org    bool is_outstanding_load =
5528174Snilay@cs.wisc.edu        !!m_readRequestTable.count(line_address(request.m_PhysicalAddress));
5537039Snate@binkert.org    if (is_outstanding_store) {
5548174Snilay@cs.wisc.edu        if ((request.m_Type == RubyRequestType_LD) ||
5558174Snilay@cs.wisc.edu            (request.m_Type == RubyRequestType_IFETCH) ||
5568174Snilay@cs.wisc.edu            (request.m_Type == RubyRequestType_RMW_Read)) {
5577039Snate@binkert.org            m_store_waiting_on_load_cycles++;
5587039Snate@binkert.org        } else {
5597039Snate@binkert.org            m_store_waiting_on_store_cycles++;
5607039Snate@binkert.org        }
5617039Snate@binkert.org        return RequestStatus_Aliased;
5627039Snate@binkert.org    } else if (is_outstanding_load) {
5638174Snilay@cs.wisc.edu        if ((request.m_Type == RubyRequestType_ST) ||
5648174Snilay@cs.wisc.edu            (request.m_Type == RubyRequestType_RMW_Write)) {
5657039Snate@binkert.org            m_load_waiting_on_store_cycles++;
5667039Snate@binkert.org        } else {
5677039Snate@binkert.org            m_load_waiting_on_load_cycles++;
5687039Snate@binkert.org        }
5697039Snate@binkert.org        return RequestStatus_Aliased;
5706859Sdrh5@cs.wisc.edu    }
5717039Snate@binkert.org
5727039Snate@binkert.org    if (m_outstanding_count >= m_max_outstanding_requests) {
5737039Snate@binkert.org        return RequestStatus_BufferFull;
5746859Sdrh5@cs.wisc.edu    }
5756145Snate@binkert.org
5767039Snate@binkert.org    return RequestStatus_Ready;
5776145Snate@binkert.org}
5786145Snate@binkert.org
5797039Snate@binkert.orgbool
5807039Snate@binkert.orgSequencer::empty() const
5817039Snate@binkert.org{
5827455Snate@binkert.org    return m_writeRequestTable.empty() && m_readRequestTable.empty();
5836145Snate@binkert.org}
5846145Snate@binkert.org
5857039Snate@binkert.orgRequestStatus
5867039Snate@binkert.orgSequencer::makeRequest(const RubyRequest &request)
5877039Snate@binkert.org{
5888174Snilay@cs.wisc.edu    assert(request.m_PhysicalAddress.getOffset() + request.m_Size <=
5897039Snate@binkert.org           RubySystem::getBlockSizeBytes());
5907039Snate@binkert.org    RequestStatus status = getRequestStatus(request);
5917039Snate@binkert.org    if (status != RequestStatus_Ready)
5927039Snate@binkert.org        return status;
5936349Spdudnik@gmail.com
5947039Snate@binkert.org    SequencerRequest *srequest =
5957039Snate@binkert.org        new SequencerRequest(request, g_eventQueue_ptr->getTime());
5966285Snate@binkert.org    bool found = insertRequest(srequest);
5977039Snate@binkert.org    if (found) {
5987039Snate@binkert.org        panic("Sequencer::makeRequest should never be called if the "
5997039Snate@binkert.org              "request is already outstanding\n");
6007039Snate@binkert.org        return RequestStatus_NULL;
6017039Snate@binkert.org    }
6027023SBrad.Beckmann@amd.com
6037039Snate@binkert.org    issueRequest(request);
6046145Snate@binkert.org
6057039Snate@binkert.org    // TODO: issue hardware prefetches here
6067039Snate@binkert.org    return RequestStatus_Issued;
6076145Snate@binkert.org}
6086145Snate@binkert.org
6097039Snate@binkert.orgvoid
6107039Snate@binkert.orgSequencer::issueRequest(const RubyRequest& request)
6117039Snate@binkert.org{
6128174Snilay@cs.wisc.edu    // TODO: Eliminate RubyRequest being copied again.
6138174Snilay@cs.wisc.edu
6148165Snilay@cs.wisc.edu    RubyRequestType ctype;
6158174Snilay@cs.wisc.edu    switch(request.m_Type) {
6167039Snate@binkert.org      case RubyRequestType_IFETCH:
6178165Snilay@cs.wisc.edu        ctype = RubyRequestType_IFETCH;
6187039Snate@binkert.org        break;
6197039Snate@binkert.org      case RubyRequestType_LD:
6208165Snilay@cs.wisc.edu        ctype = RubyRequestType_LD;
6217039Snate@binkert.org        break;
6227039Snate@binkert.org      case RubyRequestType_ST:
6237908Shestness@cs.utexas.edu      case RubyRequestType_RMW_Read:
6247908Shestness@cs.utexas.edu      case RubyRequestType_RMW_Write:
6257908Shestness@cs.utexas.edu      //
6267908Shestness@cs.utexas.edu      // x86 locked instructions are translated to store cache coherence
6277908Shestness@cs.utexas.edu      // requests because these requests should always be treated as read
6287908Shestness@cs.utexas.edu      // exclusive operations and should leverage any migratory sharing
6297908Shestness@cs.utexas.edu      // optimization built into the protocol.
6307908Shestness@cs.utexas.edu      //
6317908Shestness@cs.utexas.edu      case RubyRequestType_Locked_RMW_Read:
6327908Shestness@cs.utexas.edu      case RubyRequestType_Locked_RMW_Write:
6338165Snilay@cs.wisc.edu        ctype = RubyRequestType_ST;
6347039Snate@binkert.org        break;
6357908Shestness@cs.utexas.edu      //
6367908Shestness@cs.utexas.edu      // Alpha LL/SC instructions need to be handled carefully by the cache
6377908Shestness@cs.utexas.edu      // coherence protocol to ensure they follow the proper semantics.  In
6387908Shestness@cs.utexas.edu      // particular, by identifying the operations as atomic, the protocol
6397908Shestness@cs.utexas.edu      // should understand that migratory sharing optimizations should not be
6407908Shestness@cs.utexas.edu      // performed (i.e. a load between the LL and SC should not steal away
6417908Shestness@cs.utexas.edu      // exclusive permission).
6427908Shestness@cs.utexas.edu      //
6437907Shestness@cs.utexas.edu      case RubyRequestType_Load_Linked:
6447907Shestness@cs.utexas.edu      case RubyRequestType_Store_Conditional:
6458165Snilay@cs.wisc.edu        ctype = RubyRequestType_ATOMIC;
6467039Snate@binkert.org        break;
6477039Snate@binkert.org      default:
6487039Snate@binkert.org        assert(0);
6497039Snate@binkert.org    }
6506285Snate@binkert.org
6518164Snilay@cs.wisc.edu    RubyAccessMode amtype;
6528174Snilay@cs.wisc.edu    switch(request.m_AccessMode){
6537039Snate@binkert.org      case RubyAccessMode_User:
6548164Snilay@cs.wisc.edu        amtype = RubyAccessMode_User;
6557039Snate@binkert.org        break;
6567039Snate@binkert.org      case RubyAccessMode_Supervisor:
6578164Snilay@cs.wisc.edu        amtype = RubyAccessMode_Supervisor;
6587039Snate@binkert.org        break;
6597039Snate@binkert.org      case RubyAccessMode_Device:
6608164Snilay@cs.wisc.edu        amtype = RubyAccessMode_User;
6617039Snate@binkert.org        break;
6627039Snate@binkert.org      default:
6637039Snate@binkert.org        assert(0);
6647039Snate@binkert.org    }
6656285Snate@binkert.org
6668174Snilay@cs.wisc.edu    Address line_addr(request.m_PhysicalAddress);
6677039Snate@binkert.org    line_addr.makeLineAddress();
6688174Snilay@cs.wisc.edu    RubyRequest *msg = new RubyRequest(request.m_PhysicalAddress.getAddress(),
6698174Snilay@cs.wisc.edu                                       request.data, request.m_Size,
6708174Snilay@cs.wisc.edu                                       request.m_ProgramCounter.getAddress(),
6718174Snilay@cs.wisc.edu                                       ctype, amtype, request.pkt,
6728174Snilay@cs.wisc.edu                                       PrefetchBit_No, request.proc_id);
6736285Snate@binkert.org
6747832Snate@binkert.org    DPRINTFR(ProtocolTrace, "%7s %3s %10s%20s %6s>%-6s %s %s\n",
6757832Snate@binkert.org        g_eventQueue_ptr->getTime(), m_version, "Seq", "Begin", "", "",
6768174Snilay@cs.wisc.edu        request.m_PhysicalAddress, RubyRequestType_to_string(request.m_Type));
6776285Snate@binkert.org
6787039Snate@binkert.org    Time latency = 0;  // initialzed to an null value
6796285Snate@binkert.org
6808174Snilay@cs.wisc.edu    if (request.m_Type == RubyRequestType_IFETCH)
6817039Snate@binkert.org        latency = m_instCache_ptr->getLatency();
6827039Snate@binkert.org    else
6837039Snate@binkert.org        latency = m_dataCache_ptr->getLatency();
6846285Snate@binkert.org
6857039Snate@binkert.org    // Send the message to the cache controller
6867039Snate@binkert.org    assert(latency > 0);
6876145Snate@binkert.org
6887039Snate@binkert.org    assert(m_mandatory_q_ptr != NULL);
6897039Snate@binkert.org    m_mandatory_q_ptr->enqueue(msg, latency);
6906145Snate@binkert.org}
6916145Snate@binkert.org
6927039Snate@binkert.org#if 0
6937039Snate@binkert.orgbool
6948165Snilay@cs.wisc.eduSequencer::tryCacheAccess(const Address& addr, RubyRequestType type,
6958164Snilay@cs.wisc.edu                          RubyAccessMode access_mode,
6967039Snate@binkert.org                          int size, DataBlock*& data_ptr)
6977039Snate@binkert.org{
6987039Snate@binkert.org    CacheMemory *cache =
6998165Snilay@cs.wisc.edu        (type == RubyRequestType_IFETCH) ? m_instCache_ptr : m_dataCache_ptr;
7007039Snate@binkert.org
7017039Snate@binkert.org    return cache->tryCacheAccess(line_address(addr), type, data_ptr);
7027039Snate@binkert.org}
7037039Snate@binkert.org#endif
7047039Snate@binkert.org
7057455Snate@binkert.orgtemplate <class KEY, class VALUE>
7067455Snate@binkert.orgstd::ostream &
7077455Snate@binkert.orgoperator<<(ostream &out, const m5::hash_map<KEY, VALUE> &map)
7087455Snate@binkert.org{
7097455Snate@binkert.org    typename m5::hash_map<KEY, VALUE>::const_iterator i = map.begin();
7107455Snate@binkert.org    typename m5::hash_map<KEY, VALUE>::const_iterator end = map.end();
7117455Snate@binkert.org
7127455Snate@binkert.org    out << "[";
7137455Snate@binkert.org    for (; i != end; ++i)
7147455Snate@binkert.org        out << " " << i->first << "=" << i->second;
7157455Snate@binkert.org    out << " ]";
7167455Snate@binkert.org
7177455Snate@binkert.org    return out;
7187455Snate@binkert.org}
7197455Snate@binkert.org
7207039Snate@binkert.orgvoid
7217039Snate@binkert.orgSequencer::print(ostream& out) const
7227039Snate@binkert.org{
7237039Snate@binkert.org    out << "[Sequencer: " << m_version
7247039Snate@binkert.org        << ", outstanding requests: " << m_outstanding_count
7257039Snate@binkert.org        << ", read request table: " << m_readRequestTable
7267039Snate@binkert.org        << ", write request table: " << m_writeRequestTable
7277039Snate@binkert.org        << "]";
7287039Snate@binkert.org}
7297039Snate@binkert.org
7307039Snate@binkert.org// this can be called from setState whenever coherence permissions are
7317039Snate@binkert.org// upgraded when invoked, coherence violations will be checked for the
7327039Snate@binkert.org// given block
7337039Snate@binkert.orgvoid
7347039Snate@binkert.orgSequencer::checkCoherence(const Address& addr)
7357039Snate@binkert.org{
7366145Snate@binkert.org#ifdef CHECK_COHERENCE
7377039Snate@binkert.org    g_system_ptr->checkGlobalCoherenceInvariant(addr);
7386145Snate@binkert.org#endif
7396145Snate@binkert.org}
740