noncoherent_xbar.hh revision 10713
12381SN/A/* 210405Sandreas.hansson@arm.com * Copyright (c) 2011-2014 ARM Limited 38711SN/A * All rights reserved 48711SN/A * 58711SN/A * The license below extends only to copyright in the software and shall 68711SN/A * not be construed as granting a license to any other intellectual 78711SN/A * property including but not limited to intellectual property relating 88711SN/A * to a hardware implementation of the functionality of the software 98711SN/A * licensed hereunder. You may use the software subject to the license 108711SN/A * terms below provided that you ensure that this notice is replicated 118711SN/A * unmodified and in its entirety in all distributions of the software, 128711SN/A * modified or unmodified, in source code or in binary form. 138711SN/A * 142381SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan 152381SN/A * All rights reserved. 162381SN/A * 172381SN/A * Redistribution and use in source and binary forms, with or without 182381SN/A * modification, are permitted provided that the following conditions are 192381SN/A * met: redistributions of source code must retain the above copyright 202381SN/A * notice, this list of conditions and the following disclaimer; 212381SN/A * redistributions in binary form must reproduce the above copyright 222381SN/A * notice, this list of conditions and the following disclaimer in the 232381SN/A * documentation and/or other materials provided with the distribution; 242381SN/A * neither the name of the copyright holders nor the names of its 252381SN/A * contributors may be used to endorse or promote products derived from 262381SN/A * this software without specific prior written permission. 272381SN/A * 282381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 292381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 302381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 312381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 322381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 332381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 342381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 352381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 362381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 372381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 382381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 392665SN/A * 402665SN/A * Authors: Ron Dreslinski 412772SN/A * Ali Saidi 428715SN/A * Andreas Hansson 438922SN/A * William Wang 442381SN/A */ 452381SN/A 462381SN/A/** 472982SN/A * @file 4810405Sandreas.hansson@arm.com * Declaration of a non-coherent crossbar. 492381SN/A */ 502381SN/A 5110405Sandreas.hansson@arm.com#ifndef __MEM_NONCOHERENT_XBAR_HH__ 5210405Sandreas.hansson@arm.com#define __MEM_NONCOHERENT_XBAR_HH__ 532381SN/A 5410405Sandreas.hansson@arm.com#include "mem/xbar.hh" 5510405Sandreas.hansson@arm.com#include "params/NoncoherentXBar.hh" 562381SN/A 579036SN/A/** 5810405Sandreas.hansson@arm.com * A non-coherent crossbar connects a number of non-snooping masters 5910405Sandreas.hansson@arm.com * and slaves, and routes the request and response packets based on 6010405Sandreas.hansson@arm.com * the address. The request packets issued by the master connected to 6110405Sandreas.hansson@arm.com * a non-coherent crossbar could still snoop in caches attached to a 6210405Sandreas.hansson@arm.com * coherent crossbar, as is the case with the I/O bus and memory bus 6310405Sandreas.hansson@arm.com * in most system configurations. No snoops will, however, reach any 6410405Sandreas.hansson@arm.com * master on the non-coherent crossbar itself. 659036SN/A * 6610405Sandreas.hansson@arm.com * The non-coherent crossbar can be used as a template for modelling 679036SN/A * PCIe, and non-coherent AMBA and OCP buses, and is typically used 689036SN/A * for the I/O buses. 699036SN/A */ 7010405Sandreas.hansson@arm.comclass NoncoherentXBar : public BaseXBar 712381SN/A{ 729031SN/A 739036SN/A protected: 749036SN/A 758922SN/A /** 7610405Sandreas.hansson@arm.com * Declare the layers of this crossbar, one vector for requests 7710405Sandreas.hansson@arm.com * and one for responses. 789092SN/A */ 799715SN/A std::vector<ReqLayer*> reqLayers; 809715SN/A std::vector<RespLayer*> respLayers; 819092SN/A 829092SN/A /** 8310405Sandreas.hansson@arm.com * Declaration of the non-coherent crossbar slave port type, one 8410405Sandreas.hansson@arm.com * will be instantiated for each of the master ports connecting to 8510405Sandreas.hansson@arm.com * the crossbar. 868922SN/A */ 8710405Sandreas.hansson@arm.com class NoncoherentXBarSlavePort : public SlavePort 882381SN/A { 898922SN/A private: 909036SN/A 9110405Sandreas.hansson@arm.com /** A reference to the crossbar to which this port belongs. */ 9210405Sandreas.hansson@arm.com NoncoherentXBar &xbar; 932381SN/A 942381SN/A public: 952381SN/A 9610405Sandreas.hansson@arm.com NoncoherentXBarSlavePort(const std::string &_name, 9710405Sandreas.hansson@arm.com NoncoherentXBar &_xbar, PortID _id) 9810405Sandreas.hansson@arm.com : SlavePort(_name, &_xbar, _id), xbar(_xbar) 998922SN/A { } 1008922SN/A 1018922SN/A protected: 1028922SN/A 1038948SN/A /** 10410405Sandreas.hansson@arm.com * When receiving a timing request, pass it to the crossbar. 1058948SN/A */ 1068975SN/A virtual bool recvTimingReq(PacketPtr pkt) 10710405Sandreas.hansson@arm.com { return xbar.recvTimingReq(pkt, id); } 1088948SN/A 1098948SN/A /** 11010405Sandreas.hansson@arm.com * When receiving an atomic request, pass it to the crossbar. 1118948SN/A */ 1128922SN/A virtual Tick recvAtomic(PacketPtr pkt) 11310405Sandreas.hansson@arm.com { return xbar.recvAtomic(pkt, id); } 1148922SN/A 1158948SN/A /** 11610405Sandreas.hansson@arm.com * When receiving a functional request, pass it to the crossbar. 1178948SN/A */ 1188922SN/A virtual void recvFunctional(PacketPtr pkt) 11910405Sandreas.hansson@arm.com { xbar.recvFunctional(pkt, id); } 1208922SN/A 1218948SN/A /** 12210405Sandreas.hansson@arm.com * When receiving a retry, pass it to the crossbar. 1238948SN/A */ 12410713Sandreas.hansson@arm.com virtual void recvRespRetry() 12510405Sandreas.hansson@arm.com { panic("Crossbar slave ports should never retry.\n"); } 1268922SN/A 1279036SN/A /** 12810405Sandreas.hansson@arm.com * Return the union of all adress ranges seen by this crossbar. 1299036SN/A */ 1309090SN/A virtual AddrRangeList getAddrRanges() const 13110405Sandreas.hansson@arm.com { return xbar.getAddrRanges(); } 1328922SN/A 1338922SN/A }; 1348922SN/A 1358922SN/A /** 13610405Sandreas.hansson@arm.com * Declaration of the crossbar master port type, one will be 1379036SN/A * instantiated for each of the slave ports connecting to the 13810405Sandreas.hansson@arm.com * crossbar. 1398922SN/A */ 14010405Sandreas.hansson@arm.com class NoncoherentXBarMasterPort : public MasterPort 1418922SN/A { 1428922SN/A private: 1439036SN/A 14410405Sandreas.hansson@arm.com /** A reference to the crossbar to which this port belongs. */ 14510405Sandreas.hansson@arm.com NoncoherentXBar &xbar; 1468922SN/A 1478922SN/A public: 1488922SN/A 14910405Sandreas.hansson@arm.com NoncoherentXBarMasterPort(const std::string &_name, 15010405Sandreas.hansson@arm.com NoncoherentXBar &_xbar, PortID _id) 15110405Sandreas.hansson@arm.com : MasterPort(_name, &_xbar, _id), xbar(_xbar) 1522381SN/A { } 1532381SN/A 1542381SN/A protected: 1552381SN/A 1568948SN/A /** 15710405Sandreas.hansson@arm.com * When receiving a timing response, pass it to the crossbar. 1588948SN/A */ 1598975SN/A virtual bool recvTimingResp(PacketPtr pkt) 16010405Sandreas.hansson@arm.com { return xbar.recvTimingResp(pkt, id); } 1612381SN/A 1628711SN/A /** When reciving a range change from the peer port (at id), 16310405Sandreas.hansson@arm.com pass it to the crossbar. */ 1648711SN/A virtual void recvRangeChange() 16510405Sandreas.hansson@arm.com { xbar.recvRangeChange(id); } 1662381SN/A 1672657SN/A /** When reciving a retry from the peer port (at id), 16810405Sandreas.hansson@arm.com pass it to the crossbar. */ 16910713Sandreas.hansson@arm.com virtual void recvReqRetry() 17010713Sandreas.hansson@arm.com { xbar.recvReqRetry(id); } 1712657SN/A 1722381SN/A }; 1732381SN/A 17410405Sandreas.hansson@arm.com /** Function called by the port when the crossbar is recieving a Timing 1758975SN/A request packet.*/ 1769083SN/A virtual bool recvTimingReq(PacketPtr pkt, PortID slave_port_id); 1778975SN/A 17810405Sandreas.hansson@arm.com /** Function called by the port when the crossbar is recieving a Timing 1798975SN/A response packet.*/ 1809083SN/A virtual bool recvTimingResp(PacketPtr pkt, PortID master_port_id); 1814475SN/A 1829092SN/A /** Timing function called by port when it is once again able to process 1839092SN/A * requests. */ 18410713Sandreas.hansson@arm.com void recvReqRetry(PortID master_port_id); 1859092SN/A 18610405Sandreas.hansson@arm.com /** Function called by the port when the crossbar is recieving a Atomic 1874475SN/A transaction.*/ 1889032SN/A Tick recvAtomic(PacketPtr pkt, PortID slave_port_id); 1894475SN/A 19010405Sandreas.hansson@arm.com /** Function called by the port when the crossbar is recieving a Functional 1914475SN/A transaction.*/ 1929032SN/A void recvFunctional(PacketPtr pkt, PortID slave_port_id); 1934475SN/A 1942381SN/A public: 1952381SN/A 19610405Sandreas.hansson@arm.com NoncoherentXBar(const NoncoherentXBarParams *p); 1972568SN/A 19810405Sandreas.hansson@arm.com virtual ~NoncoherentXBar(); 1999715SN/A 2009342SN/A unsigned int drain(DrainManager *dm); 2019092SN/A 2029712SN/A /** 2039712SN/A * stats 2049712SN/A */ 2059712SN/A virtual void regStats(); 20610405Sandreas.hansson@arm.com Stats::Scalar totPktSize; 2072381SN/A}; 2082381SN/A 20910405Sandreas.hansson@arm.com#endif //__MEM_NONCOHERENT_XBAR_HH__ 210