Sequencer.cc revision 8641
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
298229Snate@binkert.org#include "base/misc.hh"
307056Snate@binkert.org#include "base/str.hh"
318615Snilay@cs.wisc.edu#include "config/the_isa.hh"
328615Snilay@cs.wisc.edu#if THE_ISA == X86_ISA
338615Snilay@cs.wisc.edu#include "arch/x86/insts/microldstop.hh"
348615Snilay@cs.wisc.edu#endif // X86_ISA
357632SBrad.Beckmann@amd.com#include "cpu/testers/rubytest/RubyTester.hh"
368232Snate@binkert.org#include "debug/MemoryAccess.hh"
378232Snate@binkert.org#include "debug/ProtocolTrace.hh"
388615Snilay@cs.wisc.edu#include "debug/RubySequencer.hh"
398615Snilay@cs.wisc.edu#include "mem/protocol/PrefetchBit.hh"
408615Snilay@cs.wisc.edu#include "mem/protocol/RubyAccessMode.hh"
417039Snate@binkert.org#include "mem/ruby/buffers/MessageBuffer.hh"
427039Snate@binkert.org#include "mem/ruby/common/Global.hh"
437039Snate@binkert.org#include "mem/ruby/common/SubBlock.hh"
447039Snate@binkert.org#include "mem/ruby/profiler/Profiler.hh"
457039Snate@binkert.org#include "mem/ruby/recorder/Tracer.hh"
468229Snate@binkert.org#include "mem/ruby/slicc_interface/RubyRequest.hh"
477039Snate@binkert.org#include "mem/ruby/system/CacheMemory.hh"
486154Snate@binkert.org#include "mem/ruby/system/Sequencer.hh"
496154Snate@binkert.org#include "mem/ruby/system/System.hh"
507550SBrad.Beckmann@amd.com#include "mem/packet.hh"
516876Ssteve.reinhardt@amd.com#include "params/RubySequencer.hh"
526876Ssteve.reinhardt@amd.com
537055Snate@binkert.orgusing namespace std;
547055Snate@binkert.org
556876Ssteve.reinhardt@amd.comSequencer *
566876Ssteve.reinhardt@amd.comRubySequencerParams::create()
576285Snate@binkert.org{
586876Ssteve.reinhardt@amd.com    return new Sequencer(this);
596285Snate@binkert.org}
607039Snate@binkert.org
616876Ssteve.reinhardt@amd.comSequencer::Sequencer(const Params *p)
626886SBrad.Beckmann@amd.com    : RubyPort(p), deadlockCheckEvent(this)
636876Ssteve.reinhardt@amd.com{
646876Ssteve.reinhardt@amd.com    m_store_waiting_on_load_cycles = 0;
656876Ssteve.reinhardt@amd.com    m_store_waiting_on_store_cycles = 0;
666876Ssteve.reinhardt@amd.com    m_load_waiting_on_store_cycles = 0;
676876Ssteve.reinhardt@amd.com    m_load_waiting_on_load_cycles = 0;
687039Snate@binkert.org
696876Ssteve.reinhardt@amd.com    m_outstanding_count = 0;
706285Snate@binkert.org
716876Ssteve.reinhardt@amd.com    m_deadlock_threshold = 0;
726876Ssteve.reinhardt@amd.com    m_instCache_ptr = NULL;
736876Ssteve.reinhardt@amd.com    m_dataCache_ptr = NULL;
746145Snate@binkert.org
756876Ssteve.reinhardt@amd.com    m_instCache_ptr = p->icache;
766876Ssteve.reinhardt@amd.com    m_dataCache_ptr = p->dcache;
776876Ssteve.reinhardt@amd.com    m_max_outstanding_requests = p->max_outstanding_requests;
786876Ssteve.reinhardt@amd.com    m_deadlock_threshold = p->deadlock_threshold;
796899SBrad.Beckmann@amd.com
806876Ssteve.reinhardt@amd.com    assert(m_max_outstanding_requests > 0);
816876Ssteve.reinhardt@amd.com    assert(m_deadlock_threshold > 0);
826876Ssteve.reinhardt@amd.com    assert(m_instCache_ptr != NULL);
836876Ssteve.reinhardt@amd.com    assert(m_dataCache_ptr != NULL);
848171Stushar@csail.mit.edu
858171Stushar@csail.mit.edu    m_usingNetworkTester = p->using_network_tester;
866145Snate@binkert.org}
876145Snate@binkert.org
887039Snate@binkert.orgSequencer::~Sequencer()
897039Snate@binkert.org{
906145Snate@binkert.org}
916145Snate@binkert.org
927039Snate@binkert.orgvoid
937039Snate@binkert.orgSequencer::wakeup()
947039Snate@binkert.org{
957039Snate@binkert.org    // Check for deadlock of any of the requests
967039Snate@binkert.org    Time current_time = g_eventQueue_ptr->getTime();
976145Snate@binkert.org
987039Snate@binkert.org    // Check across all outstanding requests
997039Snate@binkert.org    int total_outstanding = 0;
1006285Snate@binkert.org
1017455Snate@binkert.org    RequestTable::iterator read = m_readRequestTable.begin();
1027455Snate@binkert.org    RequestTable::iterator read_end = m_readRequestTable.end();
1037455Snate@binkert.org    for (; read != read_end; ++read) {
1047455Snate@binkert.org        SequencerRequest* request = read->second;
1057455Snate@binkert.org        if (current_time - request->issue_time < m_deadlock_threshold)
1067455Snate@binkert.org            continue;
1077455Snate@binkert.org
1087805Snilay@cs.wisc.edu        panic("Possible Deadlock detected. Aborting!\n"
1097921SBrad.Beckmann@amd.com             "version: %d request.paddr: 0x%x m_readRequestTable: %d "
1107805Snilay@cs.wisc.edu             "current time: %u issue_time: %d difference: %d\n", m_version,
1118615Snilay@cs.wisc.edu             Address(request->pkt->getAddr()), m_readRequestTable.size(),
1127805Snilay@cs.wisc.edu             current_time, request->issue_time,
1137805Snilay@cs.wisc.edu             current_time - request->issue_time);
1146145Snate@binkert.org    }
1156145Snate@binkert.org
1167455Snate@binkert.org    RequestTable::iterator write = m_writeRequestTable.begin();
1177455Snate@binkert.org    RequestTable::iterator write_end = m_writeRequestTable.end();
1187455Snate@binkert.org    for (; write != write_end; ++write) {
1197455Snate@binkert.org        SequencerRequest* request = write->second;
1207455Snate@binkert.org        if (current_time - request->issue_time < m_deadlock_threshold)
1217455Snate@binkert.org            continue;
1227455Snate@binkert.org
1237805Snilay@cs.wisc.edu        panic("Possible Deadlock detected. Aborting!\n"
1247921SBrad.Beckmann@amd.com             "version: %d request.paddr: 0x%x m_writeRequestTable: %d "
1257805Snilay@cs.wisc.edu             "current time: %u issue_time: %d difference: %d\n", m_version,
1268615Snilay@cs.wisc.edu             Address(request->pkt->getAddr()), m_writeRequestTable.size(),
1277805Snilay@cs.wisc.edu             current_time, request->issue_time,
1287805Snilay@cs.wisc.edu             current_time - request->issue_time);
1296145Snate@binkert.org    }
1306285Snate@binkert.org
1317039Snate@binkert.org    total_outstanding += m_writeRequestTable.size();
1327039Snate@binkert.org    total_outstanding += m_readRequestTable.size();
1336145Snate@binkert.org
1347039Snate@binkert.org    assert(m_outstanding_count == total_outstanding);
1357039Snate@binkert.org
1367039Snate@binkert.org    if (m_outstanding_count > 0) {
1377039Snate@binkert.org        // If there are still outstanding requests, keep checking
1387039Snate@binkert.org        schedule(deadlockCheckEvent,
1397039Snate@binkert.org                 m_deadlock_threshold * g_eventQueue_ptr->getClock() +
1407823Ssteve.reinhardt@amd.com                 curTick());
1417039Snate@binkert.org    }
1426145Snate@binkert.org}
1436145Snate@binkert.org
1447039Snate@binkert.orgvoid
1457039Snate@binkert.orgSequencer::printStats(ostream & out) const
1467039Snate@binkert.org{
1477039Snate@binkert.org    out << "Sequencer: " << m_name << endl
1487039Snate@binkert.org        << "  store_waiting_on_load_cycles: "
1497039Snate@binkert.org        << m_store_waiting_on_load_cycles << endl
1507039Snate@binkert.org        << "  store_waiting_on_store_cycles: "
1517039Snate@binkert.org        << m_store_waiting_on_store_cycles << endl
1527039Snate@binkert.org        << "  load_waiting_on_load_cycles: "
1537039Snate@binkert.org        << m_load_waiting_on_load_cycles << endl
1547039Snate@binkert.org        << "  load_waiting_on_store_cycles: "
1557039Snate@binkert.org        << m_load_waiting_on_store_cycles << endl;
1566859Sdrh5@cs.wisc.edu}
1576859Sdrh5@cs.wisc.edu
1587039Snate@binkert.orgvoid
1597039Snate@binkert.orgSequencer::printProgress(ostream& out) const
1607039Snate@binkert.org{
1617039Snate@binkert.org#if 0
1627039Snate@binkert.org    int total_demand = 0;
1637039Snate@binkert.org    out << "Sequencer Stats Version " << m_version << endl;
1647039Snate@binkert.org    out << "Current time = " << g_eventQueue_ptr->getTime() << endl;
1657039Snate@binkert.org    out << "---------------" << endl;
1667039Snate@binkert.org    out << "outstanding requests" << endl;
1676145Snate@binkert.org
1687455Snate@binkert.org    out << "proc " << m_Read
1697455Snate@binkert.org        << " version Requests = " << m_readRequestTable.size() << endl;
1706145Snate@binkert.org
1717039Snate@binkert.org    // print the request table
1727455Snate@binkert.org    RequestTable::iterator read = m_readRequestTable.begin();
1737455Snate@binkert.org    RequestTable::iterator read_end = m_readRequestTable.end();
1747455Snate@binkert.org    for (; read != read_end; ++read) {
1757455Snate@binkert.org        SequencerRequest* request = read->second;
1767039Snate@binkert.org        out << "\tRequest[ " << i << " ] = " << request->type
1777039Snate@binkert.org            << " Address " << rkeys[i]
1787039Snate@binkert.org            << " Posted " << request->issue_time
1797039Snate@binkert.org            << " PF " << PrefetchBit_No << endl;
1806145Snate@binkert.org        total_demand++;
1817039Snate@binkert.org    }
1826145Snate@binkert.org
1837455Snate@binkert.org    out << "proc " << m_version
1847455Snate@binkert.org        << " Write Requests = " << m_writeRequestTable.size << endl;
1856285Snate@binkert.org
1867039Snate@binkert.org    // print the request table
1877455Snate@binkert.org    RequestTable::iterator write = m_writeRequestTable.begin();
1887455Snate@binkert.org    RequestTable::iterator write_end = m_writeRequestTable.end();
1897455Snate@binkert.org    for (; write != write_end; ++write) {
1907455Snate@binkert.org        SequencerRequest* request = write->second;
1917039Snate@binkert.org        out << "\tRequest[ " << i << " ] = " << request.getType()
1927039Snate@binkert.org            << " Address " << wkeys[i]
1937039Snate@binkert.org            << " Posted " << request.getTime()
1947039Snate@binkert.org            << " PF " << request.getPrefetch() << endl;
1957039Snate@binkert.org        if (request.getPrefetch() == PrefetchBit_No) {
1967039Snate@binkert.org            total_demand++;
1977039Snate@binkert.org        }
1987039Snate@binkert.org    }
1997039Snate@binkert.org
2007039Snate@binkert.org    out << endl;
2017039Snate@binkert.org
2027039Snate@binkert.org    out << "Total Number Outstanding: " << m_outstanding_count << endl
2037039Snate@binkert.org        << "Total Number Demand     : " << total_demand << endl
2047039Snate@binkert.org        << "Total Number Prefetches : " << m_outstanding_count - total_demand
2057039Snate@binkert.org        << endl << endl << endl;
2067039Snate@binkert.org#endif
2076145Snate@binkert.org}
2086145Snate@binkert.org
2097039Snate@binkert.orgvoid
2107039Snate@binkert.orgSequencer::printConfig(ostream& out) const
2117039Snate@binkert.org{
2127039Snate@binkert.org    out << "Seqeuncer config: " << m_name << endl
2137039Snate@binkert.org        << "  controller: " << m_controller->getName() << endl
2147039Snate@binkert.org        << "  version: " << m_version << endl
2157039Snate@binkert.org        << "  max_outstanding_requests: " << m_max_outstanding_requests << endl
2167039Snate@binkert.org        << "  deadlock_threshold: " << m_deadlock_threshold << endl;
2176145Snate@binkert.org}
2186145Snate@binkert.org
2196145Snate@binkert.org// Insert the request on the correct request table.  Return true if
2206145Snate@binkert.org// the entry was already present.
2218615Snilay@cs.wisc.eduRequestStatus
2228615Snilay@cs.wisc.eduSequencer::insertRequest(PacketPtr pkt, RubyRequestType request_type)
2237039Snate@binkert.org{
2248641Snate@binkert.org    assert(m_outstanding_count ==
2258641Snate@binkert.org        (m_writeRequestTable.size() + m_readRequestTable.size()));
2266145Snate@binkert.org
2277039Snate@binkert.org    // See if we should schedule a deadlock check
2287039Snate@binkert.org    if (deadlockCheckEvent.scheduled() == false) {
2297823Ssteve.reinhardt@amd.com        schedule(deadlockCheckEvent, m_deadlock_threshold + curTick());
2307039Snate@binkert.org    }
2316145Snate@binkert.org
2328615Snilay@cs.wisc.edu    Address line_addr(pkt->getAddr());
2337039Snate@binkert.org    line_addr.makeLineAddress();
2348615Snilay@cs.wisc.edu    if ((request_type == RubyRequestType_ST) ||
2358615Snilay@cs.wisc.edu        (request_type == RubyRequestType_RMW_Read) ||
2368615Snilay@cs.wisc.edu        (request_type == RubyRequestType_RMW_Write) ||
2378615Snilay@cs.wisc.edu        (request_type == RubyRequestType_Load_Linked) ||
2388615Snilay@cs.wisc.edu        (request_type == RubyRequestType_Store_Conditional) ||
2398615Snilay@cs.wisc.edu        (request_type == RubyRequestType_Locked_RMW_Read) ||
2408615Snilay@cs.wisc.edu        (request_type == RubyRequestType_Locked_RMW_Write) ||
2418615Snilay@cs.wisc.edu        (request_type == RubyRequestType_FLUSH)) {
2428615Snilay@cs.wisc.edu
2438615Snilay@cs.wisc.edu        // Check if there is any outstanding read request for the same
2448615Snilay@cs.wisc.edu        // cache line.
2458615Snilay@cs.wisc.edu        if (m_readRequestTable.count(line_addr) > 0) {
2468615Snilay@cs.wisc.edu            m_store_waiting_on_load_cycles++;
2478615Snilay@cs.wisc.edu            return RequestStatus_Aliased;
2488615Snilay@cs.wisc.edu        }
2498615Snilay@cs.wisc.edu
2507455Snate@binkert.org        pair<RequestTable::iterator, bool> r =
2517455Snate@binkert.org            m_writeRequestTable.insert(RequestTable::value_type(line_addr, 0));
2528615Snilay@cs.wisc.edu        if (r.second) {
2538615Snilay@cs.wisc.edu            RequestTable::iterator i = r.first;
2548615Snilay@cs.wisc.edu            i->second = new SequencerRequest(pkt, request_type,
2558615Snilay@cs.wisc.edu                                             g_eventQueue_ptr->getTime());
2568615Snilay@cs.wisc.edu            m_outstanding_count++;
2578615Snilay@cs.wisc.edu        } else {
2588615Snilay@cs.wisc.edu          // There is an outstanding write request for the cache line
2598615Snilay@cs.wisc.edu          m_store_waiting_on_store_cycles++;
2608615Snilay@cs.wisc.edu          return RequestStatus_Aliased;
2618615Snilay@cs.wisc.edu        }
2628615Snilay@cs.wisc.edu    } else {
2638615Snilay@cs.wisc.edu        // Check if there is any outstanding write request for the same
2648615Snilay@cs.wisc.edu        // cache line.
2658615Snilay@cs.wisc.edu        if (m_writeRequestTable.count(line_addr) > 0) {
2668615Snilay@cs.wisc.edu            m_load_waiting_on_store_cycles++;
2678615Snilay@cs.wisc.edu            return RequestStatus_Aliased;
2688615Snilay@cs.wisc.edu        }
2697039Snate@binkert.org
2707455Snate@binkert.org        pair<RequestTable::iterator, bool> r =
2717455Snate@binkert.org            m_readRequestTable.insert(RequestTable::value_type(line_addr, 0));
2727039Snate@binkert.org
2738615Snilay@cs.wisc.edu        if (r.second) {
2748615Snilay@cs.wisc.edu            RequestTable::iterator i = r.first;
2758615Snilay@cs.wisc.edu            i->second = new SequencerRequest(pkt, request_type,
2768615Snilay@cs.wisc.edu                                             g_eventQueue_ptr->getTime());
2778615Snilay@cs.wisc.edu            m_outstanding_count++;
2788615Snilay@cs.wisc.edu        } else {
2798615Snilay@cs.wisc.edu            // There is an outstanding read request for the cache line
2808615Snilay@cs.wisc.edu            m_load_waiting_on_load_cycles++;
2818615Snilay@cs.wisc.edu            return RequestStatus_Aliased;
2827039Snate@binkert.org        }
2836145Snate@binkert.org    }
2846145Snate@binkert.org
2857039Snate@binkert.org    g_system_ptr->getProfiler()->sequencerRequests(m_outstanding_count);
2868641Snate@binkert.org    assert(m_outstanding_count ==
2878641Snate@binkert.org        (m_writeRequestTable.size() + m_readRequestTable.size()));
2886145Snate@binkert.org
2898615Snilay@cs.wisc.edu    return RequestStatus_Ready;
2906145Snate@binkert.org}
2916145Snate@binkert.org
2927039Snate@binkert.orgvoid
2937455Snate@binkert.orgSequencer::markRemoved()
2947455Snate@binkert.org{
2957455Snate@binkert.org    m_outstanding_count--;
2967455Snate@binkert.org    assert(m_outstanding_count ==
2977455Snate@binkert.org           m_writeRequestTable.size() + m_readRequestTable.size());
2987455Snate@binkert.org}
2997455Snate@binkert.org
3007455Snate@binkert.orgvoid
3017039Snate@binkert.orgSequencer::removeRequest(SequencerRequest* srequest)
3027039Snate@binkert.org{
3037039Snate@binkert.org    assert(m_outstanding_count ==
3047039Snate@binkert.org           m_writeRequestTable.size() + m_readRequestTable.size());
3056145Snate@binkert.org
3068615Snilay@cs.wisc.edu    Address line_addr(srequest->pkt->getAddr());
3077039Snate@binkert.org    line_addr.makeLineAddress();
3088615Snilay@cs.wisc.edu    if ((srequest->m_type == RubyRequestType_ST) ||
3098615Snilay@cs.wisc.edu        (srequest->m_type == RubyRequestType_RMW_Read) ||
3108615Snilay@cs.wisc.edu        (srequest->m_type == RubyRequestType_RMW_Write) ||
3118615Snilay@cs.wisc.edu        (srequest->m_type == RubyRequestType_Load_Linked) ||
3128615Snilay@cs.wisc.edu        (srequest->m_type == RubyRequestType_Store_Conditional) ||
3138615Snilay@cs.wisc.edu        (srequest->m_type == RubyRequestType_Locked_RMW_Read) ||
3148615Snilay@cs.wisc.edu        (srequest->m_type == RubyRequestType_Locked_RMW_Write)) {
3157455Snate@binkert.org        m_writeRequestTable.erase(line_addr);
3167039Snate@binkert.org    } else {
3177455Snate@binkert.org        m_readRequestTable.erase(line_addr);
3187039Snate@binkert.org    }
3196285Snate@binkert.org
3207455Snate@binkert.org    markRemoved();
3216145Snate@binkert.org}
3226145Snate@binkert.org
3237560SBrad.Beckmann@amd.combool
3247560SBrad.Beckmann@amd.comSequencer::handleLlsc(const Address& address, SequencerRequest* request)
3257550SBrad.Beckmann@amd.com{
3267560SBrad.Beckmann@amd.com    //
3277560SBrad.Beckmann@amd.com    // The success flag indicates whether the LLSC operation was successful.
3287560SBrad.Beckmann@amd.com    // LL ops will always succeed, but SC may fail if the cache line is no
3297560SBrad.Beckmann@amd.com    // longer locked.
3307560SBrad.Beckmann@amd.com    //
3317560SBrad.Beckmann@amd.com    bool success = true;
3328615Snilay@cs.wisc.edu    if (request->m_type == RubyRequestType_Store_Conditional) {
3337550SBrad.Beckmann@amd.com        if (!m_dataCache_ptr->isLocked(address, m_version)) {
3347550SBrad.Beckmann@amd.com            //
3357550SBrad.Beckmann@amd.com            // For failed SC requests, indicate the failure to the cpu by
3367550SBrad.Beckmann@amd.com            // setting the extra data to zero.
3377550SBrad.Beckmann@amd.com            //
3388615Snilay@cs.wisc.edu            request->pkt->req->setExtraData(0);
3397560SBrad.Beckmann@amd.com            success = false;
3407550SBrad.Beckmann@amd.com        } else {
3417550SBrad.Beckmann@amd.com            //
3427550SBrad.Beckmann@amd.com            // For successful SC requests, indicate the success to the cpu by
3437550SBrad.Beckmann@amd.com            // setting the extra data to one.
3447550SBrad.Beckmann@amd.com            //
3458615Snilay@cs.wisc.edu            request->pkt->req->setExtraData(1);
3467550SBrad.Beckmann@amd.com        }
3477560SBrad.Beckmann@amd.com        //
3487560SBrad.Beckmann@amd.com        // Independent of success, all SC operations must clear the lock
3497560SBrad.Beckmann@amd.com        //
3507550SBrad.Beckmann@amd.com        m_dataCache_ptr->clearLocked(address);
3518615Snilay@cs.wisc.edu    } else if (request->m_type == RubyRequestType_Load_Linked) {
3527550SBrad.Beckmann@amd.com        //
3537550SBrad.Beckmann@amd.com        // Note: To fully follow Alpha LLSC semantics, should the LL clear any
3547550SBrad.Beckmann@amd.com        // previously locked cache lines?
3557550SBrad.Beckmann@amd.com        //
3567550SBrad.Beckmann@amd.com        m_dataCache_ptr->setLocked(address, m_version);
3578615Snilay@cs.wisc.edu    } else if ((m_dataCache_ptr->isTagPresent(address)) &&
3588615Snilay@cs.wisc.edu               (m_dataCache_ptr->isLocked(address, m_version))) {
3597550SBrad.Beckmann@amd.com        //
3607550SBrad.Beckmann@amd.com        // Normal writes should clear the locked address
3617550SBrad.Beckmann@amd.com        //
3627550SBrad.Beckmann@amd.com        m_dataCache_ptr->clearLocked(address);
3637550SBrad.Beckmann@amd.com    }
3647560SBrad.Beckmann@amd.com    return success;
3657550SBrad.Beckmann@amd.com}
3667550SBrad.Beckmann@amd.com
3677550SBrad.Beckmann@amd.comvoid
3687039Snate@binkert.orgSequencer::writeCallback(const Address& address, DataBlock& data)
3697039Snate@binkert.org{
3707546SBrad.Beckmann@amd.com    writeCallback(address, GenericMachineType_NULL, data);
3717546SBrad.Beckmann@amd.com}
3727546SBrad.Beckmann@amd.com
3737546SBrad.Beckmann@amd.comvoid
3747546SBrad.Beckmann@amd.comSequencer::writeCallback(const Address& address,
3757546SBrad.Beckmann@amd.com                         GenericMachineType mach,
3767546SBrad.Beckmann@amd.com                         DataBlock& data)
3777546SBrad.Beckmann@amd.com{
3787565SBrad.Beckmann@amd.com    writeCallback(address, mach, data, 0, 0, 0);
3797565SBrad.Beckmann@amd.com}
3807565SBrad.Beckmann@amd.com
3817565SBrad.Beckmann@amd.comvoid
3827565SBrad.Beckmann@amd.comSequencer::writeCallback(const Address& address,
3837565SBrad.Beckmann@amd.com                         GenericMachineType mach,
3847565SBrad.Beckmann@amd.com                         DataBlock& data,
3857565SBrad.Beckmann@amd.com                         Time initialRequestTime,
3867565SBrad.Beckmann@amd.com                         Time forwardRequestTime,
3877565SBrad.Beckmann@amd.com                         Time firstResponseTime)
3887565SBrad.Beckmann@amd.com{
3897039Snate@binkert.org    assert(address == line_address(address));
3907455Snate@binkert.org    assert(m_writeRequestTable.count(line_address(address)));
3916145Snate@binkert.org
3927455Snate@binkert.org    RequestTable::iterator i = m_writeRequestTable.find(address);
3937455Snate@binkert.org    assert(i != m_writeRequestTable.end());
3947455Snate@binkert.org    SequencerRequest* request = i->second;
3956145Snate@binkert.org
3967455Snate@binkert.org    m_writeRequestTable.erase(i);
3977455Snate@binkert.org    markRemoved();
3986846Spdudnik@cs.wisc.edu
3998615Snilay@cs.wisc.edu    assert((request->m_type == RubyRequestType_ST) ||
4008615Snilay@cs.wisc.edu           (request->m_type == RubyRequestType_ATOMIC) ||
4018615Snilay@cs.wisc.edu           (request->m_type == RubyRequestType_RMW_Read) ||
4028615Snilay@cs.wisc.edu           (request->m_type == RubyRequestType_RMW_Write) ||
4038615Snilay@cs.wisc.edu           (request->m_type == RubyRequestType_Load_Linked) ||
4048615Snilay@cs.wisc.edu           (request->m_type == RubyRequestType_Store_Conditional) ||
4058615Snilay@cs.wisc.edu           (request->m_type == RubyRequestType_Locked_RMW_Read) ||
4068615Snilay@cs.wisc.edu           (request->m_type == RubyRequestType_Locked_RMW_Write) ||
4078615Snilay@cs.wisc.edu           (request->m_type == RubyRequestType_FLUSH));
4088184Ssomayeh@cs.wisc.edu
4096145Snate@binkert.org
4107550SBrad.Beckmann@amd.com    //
4117550SBrad.Beckmann@amd.com    // For Alpha, properly handle LL, SC, and write requests with respect to
4127550SBrad.Beckmann@amd.com    // locked cache blocks.
4137550SBrad.Beckmann@amd.com    //
4148171Stushar@csail.mit.edu    // Not valid for Network_test protocl
4158171Stushar@csail.mit.edu    //
4168171Stushar@csail.mit.edu    bool success = true;
4178171Stushar@csail.mit.edu    if(!m_usingNetworkTester)
4188171Stushar@csail.mit.edu        success = handleLlsc(address, request);
4197550SBrad.Beckmann@amd.com
4208615Snilay@cs.wisc.edu    if (request->m_type == RubyRequestType_Locked_RMW_Read) {
4217039Snate@binkert.org        m_controller->blockOnQueue(address, m_mandatory_q_ptr);
4228615Snilay@cs.wisc.edu    } else if (request->m_type == RubyRequestType_Locked_RMW_Write) {
4237039Snate@binkert.org        m_controller->unblock(address);
4247039Snate@binkert.org    }
4256863Sdrh5@cs.wisc.edu
4267565SBrad.Beckmann@amd.com    hitCallback(request, mach, data, success,
4277565SBrad.Beckmann@amd.com                initialRequestTime, forwardRequestTime, firstResponseTime);
4286145Snate@binkert.org}
4296145Snate@binkert.org
4307039Snate@binkert.orgvoid
4317039Snate@binkert.orgSequencer::readCallback(const Address& address, DataBlock& data)
4327039Snate@binkert.org{
4337546SBrad.Beckmann@amd.com    readCallback(address, GenericMachineType_NULL, data);
4347546SBrad.Beckmann@amd.com}
4357546SBrad.Beckmann@amd.com
4367546SBrad.Beckmann@amd.comvoid
4377546SBrad.Beckmann@amd.comSequencer::readCallback(const Address& address,
4387546SBrad.Beckmann@amd.com                        GenericMachineType mach,
4397546SBrad.Beckmann@amd.com                        DataBlock& data)
4407546SBrad.Beckmann@amd.com{
4417565SBrad.Beckmann@amd.com    readCallback(address, mach, data, 0, 0, 0);
4427565SBrad.Beckmann@amd.com}
4437565SBrad.Beckmann@amd.com
4447565SBrad.Beckmann@amd.comvoid
4457565SBrad.Beckmann@amd.comSequencer::readCallback(const Address& address,
4467565SBrad.Beckmann@amd.com                        GenericMachineType mach,
4477565SBrad.Beckmann@amd.com                        DataBlock& data,
4487565SBrad.Beckmann@amd.com                        Time initialRequestTime,
4497565SBrad.Beckmann@amd.com                        Time forwardRequestTime,
4507565SBrad.Beckmann@amd.com                        Time firstResponseTime)
4517565SBrad.Beckmann@amd.com{
4527039Snate@binkert.org    assert(address == line_address(address));
4537455Snate@binkert.org    assert(m_readRequestTable.count(line_address(address)));
4546145Snate@binkert.org
4557455Snate@binkert.org    RequestTable::iterator i = m_readRequestTable.find(address);
4567455Snate@binkert.org    assert(i != m_readRequestTable.end());
4577455Snate@binkert.org    SequencerRequest* request = i->second;
4587455Snate@binkert.org
4597455Snate@binkert.org    m_readRequestTable.erase(i);
4607455Snate@binkert.org    markRemoved();
4616145Snate@binkert.org
4628615Snilay@cs.wisc.edu    assert((request->m_type == RubyRequestType_LD) ||
4638615Snilay@cs.wisc.edu           (request->m_type == RubyRequestType_IFETCH));
4646285Snate@binkert.org
4657565SBrad.Beckmann@amd.com    hitCallback(request, mach, data, true,
4667565SBrad.Beckmann@amd.com                initialRequestTime, forwardRequestTime, firstResponseTime);
4676145Snate@binkert.org}
4686145Snate@binkert.org
4697039Snate@binkert.orgvoid
4707546SBrad.Beckmann@amd.comSequencer::hitCallback(SequencerRequest* srequest,
4717546SBrad.Beckmann@amd.com                       GenericMachineType mach,
4727560SBrad.Beckmann@amd.com                       DataBlock& data,
4737565SBrad.Beckmann@amd.com                       bool success,
4747565SBrad.Beckmann@amd.com                       Time initialRequestTime,
4757565SBrad.Beckmann@amd.com                       Time forwardRequestTime,
4767565SBrad.Beckmann@amd.com                       Time firstResponseTime)
4777039Snate@binkert.org{
4788615Snilay@cs.wisc.edu    PacketPtr pkt = srequest->pkt;
4798615Snilay@cs.wisc.edu    Address request_address(pkt->getAddr());
4808615Snilay@cs.wisc.edu    Address request_line_address(pkt->getAddr());
4817039Snate@binkert.org    request_line_address.makeLineAddress();
4828615Snilay@cs.wisc.edu    RubyRequestType type = srequest->m_type;
4837039Snate@binkert.org    Time issued_time = srequest->issue_time;
4846145Snate@binkert.org
4857039Snate@binkert.org    // Set this cache entry to the most recently used
4867039Snate@binkert.org    if (type == RubyRequestType_IFETCH) {
4877039Snate@binkert.org        if (m_instCache_ptr->isTagPresent(request_line_address))
4887039Snate@binkert.org            m_instCache_ptr->setMRU(request_line_address);
4897039Snate@binkert.org    } else {
4907039Snate@binkert.org        if (m_dataCache_ptr->isTagPresent(request_line_address))
4917039Snate@binkert.org            m_dataCache_ptr->setMRU(request_line_address);
4927039Snate@binkert.org    }
4936145Snate@binkert.org
4947039Snate@binkert.org    assert(g_eventQueue_ptr->getTime() >= issued_time);
4957039Snate@binkert.org    Time miss_latency = g_eventQueue_ptr->getTime() - issued_time;
4966145Snate@binkert.org
4977039Snate@binkert.org    // Profile the miss latency for all non-zero demand misses
4987039Snate@binkert.org    if (miss_latency != 0) {
4997546SBrad.Beckmann@amd.com        g_system_ptr->getProfiler()->missLatency(miss_latency, type, mach);
5006285Snate@binkert.org
5017565SBrad.Beckmann@amd.com        if (mach == GenericMachineType_L1Cache_wCC) {
5027565SBrad.Beckmann@amd.com            g_system_ptr->getProfiler()->missLatencyWcc(issued_time,
5037565SBrad.Beckmann@amd.com                                                   initialRequestTime,
5047565SBrad.Beckmann@amd.com                                                   forwardRequestTime,
5057565SBrad.Beckmann@amd.com                                                   firstResponseTime,
5067565SBrad.Beckmann@amd.com                                                   g_eventQueue_ptr->getTime());
5077565SBrad.Beckmann@amd.com        }
5087565SBrad.Beckmann@amd.com
5097565SBrad.Beckmann@amd.com        if (mach == GenericMachineType_Directory) {
5107565SBrad.Beckmann@amd.com            g_system_ptr->getProfiler()->missLatencyDir(issued_time,
5117565SBrad.Beckmann@amd.com                                                   initialRequestTime,
5127565SBrad.Beckmann@amd.com                                                   forwardRequestTime,
5137565SBrad.Beckmann@amd.com                                                   firstResponseTime,
5147565SBrad.Beckmann@amd.com                                                   g_eventQueue_ptr->getTime());
5157565SBrad.Beckmann@amd.com        }
5167565SBrad.Beckmann@amd.com
5178266Sksewell@umich.edu        DPRINTFR(ProtocolTrace, "%15s %3s %10s%20s %6s>%-6s %s %d cycles\n",
5188266Sksewell@umich.edu                 curTick(), m_version, "Seq",
5198266Sksewell@umich.edu                 success ? "Done" : "SC_Failed", "", "",
5208615Snilay@cs.wisc.edu                 request_address, miss_latency);
5216285Snate@binkert.org    }
5226285Snate@binkert.org
5237039Snate@binkert.org    // update the data
5248615Snilay@cs.wisc.edu    if (pkt->getPtr<uint8_t>(true) != NULL) {
5257039Snate@binkert.org        if ((type == RubyRequestType_LD) ||
5267039Snate@binkert.org            (type == RubyRequestType_IFETCH) ||
5277039Snate@binkert.org            (type == RubyRequestType_RMW_Read) ||
5287908Shestness@cs.utexas.edu            (type == RubyRequestType_Locked_RMW_Read) ||
5297907Shestness@cs.utexas.edu            (type == RubyRequestType_Load_Linked)) {
5308615Snilay@cs.wisc.edu            memcpy(pkt->getPtr<uint8_t>(true),
5318615Snilay@cs.wisc.edu                   data.getData(request_address.getOffset(), pkt->getSize()),
5328615Snilay@cs.wisc.edu                   pkt->getSize());
5337039Snate@binkert.org        } else {
5348615Snilay@cs.wisc.edu            data.setData(pkt->getPtr<uint8_t>(true),
5358615Snilay@cs.wisc.edu                         request_address.getOffset(), pkt->getSize());
5367039Snate@binkert.org        }
5376285Snate@binkert.org    } else {
5387039Snate@binkert.org        DPRINTF(MemoryAccess,
5397039Snate@binkert.org                "WARNING.  Data not transfered from Ruby to M5 for type %s\n",
5407039Snate@binkert.org                RubyRequestType_to_string(type));
5417039Snate@binkert.org    }
5427023SBrad.Beckmann@amd.com
5437039Snate@binkert.org    // If using the RubyTester, update the RubyTester sender state's
5447039Snate@binkert.org    // subBlock with the recieved data.  The tester will later access
5457039Snate@binkert.org    // this state.
5467039Snate@binkert.org    // Note: RubyPort will access it's sender state before the
5477039Snate@binkert.org    // RubyTester.
5487039Snate@binkert.org    if (m_usingRubyTester) {
5497039Snate@binkert.org        RubyPort::SenderState *requestSenderState =
5508615Snilay@cs.wisc.edu            safe_cast<RubyPort::SenderState*>(pkt->senderState);
5517039Snate@binkert.org        RubyTester::SenderState* testerSenderState =
5527039Snate@binkert.org            safe_cast<RubyTester::SenderState*>(requestSenderState->saved);
5537039Snate@binkert.org        testerSenderState->subBlock->mergeFrom(data);
5547039Snate@binkert.org    }
5557023SBrad.Beckmann@amd.com
5568615Snilay@cs.wisc.edu    ruby_hit_callback(pkt);
5577039Snate@binkert.org    delete srequest;
5586285Snate@binkert.org}
5596285Snate@binkert.org
5607039Snate@binkert.orgbool
5617039Snate@binkert.orgSequencer::empty() const
5627039Snate@binkert.org{
5637455Snate@binkert.org    return m_writeRequestTable.empty() && m_readRequestTable.empty();
5646145Snate@binkert.org}
5656145Snate@binkert.org
5667039Snate@binkert.orgRequestStatus
5678615Snilay@cs.wisc.eduSequencer::makeRequest(PacketPtr pkt)
5687039Snate@binkert.org{
5698615Snilay@cs.wisc.edu    if (m_outstanding_count >= m_max_outstanding_requests) {
5708615Snilay@cs.wisc.edu        return RequestStatus_BufferFull;
5718615Snilay@cs.wisc.edu    }
5728615Snilay@cs.wisc.edu
5738615Snilay@cs.wisc.edu    RubyRequestType primary_type = RubyRequestType_NULL;
5748615Snilay@cs.wisc.edu    RubyRequestType secondary_type = RubyRequestType_NULL;
5758615Snilay@cs.wisc.edu
5768615Snilay@cs.wisc.edu    if (pkt->isLLSC()) {
5778615Snilay@cs.wisc.edu        //
5788615Snilay@cs.wisc.edu        // Alpha LL/SC instructions need to be handled carefully by the cache
5798615Snilay@cs.wisc.edu        // coherence protocol to ensure they follow the proper semantics. In
5808615Snilay@cs.wisc.edu        // particular, by identifying the operations as atomic, the protocol
5818615Snilay@cs.wisc.edu        // should understand that migratory sharing optimizations should not
5828615Snilay@cs.wisc.edu        // be performed (i.e. a load between the LL and SC should not steal
5838615Snilay@cs.wisc.edu        // away exclusive permission).
5848615Snilay@cs.wisc.edu        //
5858615Snilay@cs.wisc.edu        if (pkt->isWrite()) {
5868615Snilay@cs.wisc.edu            DPRINTF(RubySequencer, "Issuing SC\n");
5878615Snilay@cs.wisc.edu            primary_type = RubyRequestType_Store_Conditional;
5888615Snilay@cs.wisc.edu        } else {
5898615Snilay@cs.wisc.edu            DPRINTF(RubySequencer, "Issuing LL\n");
5908615Snilay@cs.wisc.edu            assert(pkt->isRead());
5918615Snilay@cs.wisc.edu            primary_type = RubyRequestType_Load_Linked;
5928615Snilay@cs.wisc.edu        }
5938615Snilay@cs.wisc.edu        secondary_type = RubyRequestType_ATOMIC;
5948615Snilay@cs.wisc.edu    } else if (pkt->req->isLocked()) {
5958615Snilay@cs.wisc.edu        //
5968615Snilay@cs.wisc.edu        // x86 locked instructions are translated to store cache coherence
5978615Snilay@cs.wisc.edu        // requests because these requests should always be treated as read
5988615Snilay@cs.wisc.edu        // exclusive operations and should leverage any migratory sharing
5998615Snilay@cs.wisc.edu        // optimization built into the protocol.
6008615Snilay@cs.wisc.edu        //
6018615Snilay@cs.wisc.edu        if (pkt->isWrite()) {
6028615Snilay@cs.wisc.edu            DPRINTF(RubySequencer, "Issuing Locked RMW Write\n");
6038615Snilay@cs.wisc.edu            primary_type = RubyRequestType_Locked_RMW_Write;
6048615Snilay@cs.wisc.edu        } else {
6058615Snilay@cs.wisc.edu            DPRINTF(RubySequencer, "Issuing Locked RMW Read\n");
6068615Snilay@cs.wisc.edu            assert(pkt->isRead());
6078615Snilay@cs.wisc.edu            primary_type = RubyRequestType_Locked_RMW_Read;
6088615Snilay@cs.wisc.edu        }
6098615Snilay@cs.wisc.edu        secondary_type = RubyRequestType_ST;
6108615Snilay@cs.wisc.edu    } else {
6118615Snilay@cs.wisc.edu        if (pkt->isRead()) {
6128615Snilay@cs.wisc.edu            if (pkt->req->isInstFetch()) {
6138615Snilay@cs.wisc.edu                primary_type = secondary_type = RubyRequestType_IFETCH;
6148615Snilay@cs.wisc.edu            } else {
6158615Snilay@cs.wisc.edu#if THE_ISA == X86_ISA
6168615Snilay@cs.wisc.edu                uint32_t flags = pkt->req->getFlags();
6178615Snilay@cs.wisc.edu                bool storeCheck = flags &
6188615Snilay@cs.wisc.edu                        (TheISA::StoreCheck << TheISA::FlagShift);
6198615Snilay@cs.wisc.edu#else
6208615Snilay@cs.wisc.edu                bool storeCheck = false;
6218615Snilay@cs.wisc.edu#endif // X86_ISA
6228615Snilay@cs.wisc.edu                if (storeCheck) {
6238615Snilay@cs.wisc.edu                    primary_type = RubyRequestType_RMW_Read;
6248615Snilay@cs.wisc.edu                    secondary_type = RubyRequestType_ST;
6258615Snilay@cs.wisc.edu                } else {
6268615Snilay@cs.wisc.edu                    primary_type = secondary_type = RubyRequestType_LD;
6278615Snilay@cs.wisc.edu                }
6288615Snilay@cs.wisc.edu            }
6298615Snilay@cs.wisc.edu        } else if (pkt->isWrite()) {
6308615Snilay@cs.wisc.edu            //
6318615Snilay@cs.wisc.edu            // Note: M5 packets do not differentiate ST from RMW_Write
6328615Snilay@cs.wisc.edu            //
6338615Snilay@cs.wisc.edu            primary_type = secondary_type = RubyRequestType_ST;
6348615Snilay@cs.wisc.edu        } else if (pkt->isFlush()) {
6358615Snilay@cs.wisc.edu          primary_type = secondary_type = RubyRequestType_FLUSH;
6368615Snilay@cs.wisc.edu        } else {
6378615Snilay@cs.wisc.edu            panic("Unsupported ruby packet type\n");
6388615Snilay@cs.wisc.edu        }
6398615Snilay@cs.wisc.edu    }
6408615Snilay@cs.wisc.edu
6418615Snilay@cs.wisc.edu    RequestStatus status = insertRequest(pkt, primary_type);
6427039Snate@binkert.org    if (status != RequestStatus_Ready)
6437039Snate@binkert.org        return status;
6446349Spdudnik@gmail.com
6458615Snilay@cs.wisc.edu    issueRequest(pkt, secondary_type);
6466145Snate@binkert.org
6477039Snate@binkert.org    // TODO: issue hardware prefetches here
6487039Snate@binkert.org    return RequestStatus_Issued;
6496145Snate@binkert.org}
6506145Snate@binkert.org
6517039Snate@binkert.orgvoid
6528615Snilay@cs.wisc.eduSequencer::issueRequest(PacketPtr pkt, RubyRequestType secondary_type)
6537039Snate@binkert.org{
6548615Snilay@cs.wisc.edu    int proc_id = -1;
6558615Snilay@cs.wisc.edu    if (pkt != NULL && pkt->req->hasContextId()) {
6568615Snilay@cs.wisc.edu        proc_id = pkt->req->contextId();
6577039Snate@binkert.org    }
6586285Snate@binkert.org
6598615Snilay@cs.wisc.edu    // If valid, copy the pc to the ruby request
6608615Snilay@cs.wisc.edu    Addr pc = 0;
6618615Snilay@cs.wisc.edu    if (pkt->req->hasPC()) {
6628615Snilay@cs.wisc.edu        pc = pkt->req->getPC();
6637039Snate@binkert.org    }
6646285Snate@binkert.org
6658615Snilay@cs.wisc.edu    RubyRequest *msg = new RubyRequest(pkt->getAddr(),
6668615Snilay@cs.wisc.edu                                       pkt->getPtr<uint8_t>(true),
6678615Snilay@cs.wisc.edu                                       pkt->getSize(), pc, secondary_type,
6688615Snilay@cs.wisc.edu                                       RubyAccessMode_Supervisor, pkt,
6698188SLisa.Hsu@amd.com                                       PrefetchBit_No, proc_id);
6706285Snate@binkert.org
6718266Sksewell@umich.edu    DPRINTFR(ProtocolTrace, "%15s %3s %10s%20s %6s>%-6s %s %s\n",
6728266Sksewell@umich.edu            curTick(), m_version, "Seq", "Begin", "", "",
6738615Snilay@cs.wisc.edu            msg->getPhysicalAddress(),
6748615Snilay@cs.wisc.edu            RubyRequestType_to_string(secondary_type));
6756285Snate@binkert.org
6767039Snate@binkert.org    Time latency = 0;  // initialzed to an null value
6776285Snate@binkert.org
6788615Snilay@cs.wisc.edu    if (secondary_type == RubyRequestType_IFETCH)
6797039Snate@binkert.org        latency = m_instCache_ptr->getLatency();
6807039Snate@binkert.org    else
6817039Snate@binkert.org        latency = m_dataCache_ptr->getLatency();
6826285Snate@binkert.org
6837039Snate@binkert.org    // Send the message to the cache controller
6847039Snate@binkert.org    assert(latency > 0);
6856145Snate@binkert.org
6867039Snate@binkert.org    assert(m_mandatory_q_ptr != NULL);
6877039Snate@binkert.org    m_mandatory_q_ptr->enqueue(msg, latency);
6886145Snate@binkert.org}
6896145Snate@binkert.org
6907455Snate@binkert.orgtemplate <class KEY, class VALUE>
6917455Snate@binkert.orgstd::ostream &
6927455Snate@binkert.orgoperator<<(ostream &out, const m5::hash_map<KEY, VALUE> &map)
6937455Snate@binkert.org{
6947455Snate@binkert.org    typename m5::hash_map<KEY, VALUE>::const_iterator i = map.begin();
6957455Snate@binkert.org    typename m5::hash_map<KEY, VALUE>::const_iterator end = map.end();
6967455Snate@binkert.org
6977455Snate@binkert.org    out << "[";
6987455Snate@binkert.org    for (; i != end; ++i)
6997455Snate@binkert.org        out << " " << i->first << "=" << i->second;
7007455Snate@binkert.org    out << " ]";
7017455Snate@binkert.org
7027455Snate@binkert.org    return out;
7037455Snate@binkert.org}
7047455Snate@binkert.org
7057039Snate@binkert.orgvoid
7067039Snate@binkert.orgSequencer::print(ostream& out) const
7077039Snate@binkert.org{
7087039Snate@binkert.org    out << "[Sequencer: " << m_version
7097039Snate@binkert.org        << ", outstanding requests: " << m_outstanding_count
7107039Snate@binkert.org        << ", read request table: " << m_readRequestTable
7117039Snate@binkert.org        << ", write request table: " << m_writeRequestTable
7127039Snate@binkert.org        << "]";
7137039Snate@binkert.org}
7147039Snate@binkert.org
7157039Snate@binkert.org// this can be called from setState whenever coherence permissions are
7167039Snate@binkert.org// upgraded when invoked, coherence violations will be checked for the
7177039Snate@binkert.org// given block
7187039Snate@binkert.orgvoid
7197039Snate@binkert.orgSequencer::checkCoherence(const Address& addr)
7207039Snate@binkert.org{
7216145Snate@binkert.org#ifdef CHECK_COHERENCE
7227039Snate@binkert.org    g_system_ptr->checkGlobalCoherenceInvariant(addr);
7236145Snate@binkert.org#endif
7246145Snate@binkert.org}
725