comm.hh revision 8137
11689SN/A/* 28137SAli.Saidi@ARM.com * Copyright (c) 2011 ARM Limited 38137SAli.Saidi@ARM.com * All rights reserved 48137SAli.Saidi@ARM.com * 58137SAli.Saidi@ARM.com * The license below extends only to copyright in the software and shall 68137SAli.Saidi@ARM.com * not be construed as granting a license to any other intellectual 78137SAli.Saidi@ARM.com * property including but not limited to intellectual property relating 88137SAli.Saidi@ARM.com * to a hardware implementation of the functionality of the software 98137SAli.Saidi@ARM.com * licensed hereunder. You may use the software subject to the license 108137SAli.Saidi@ARM.com * terms below provided that you ensure that this notice is replicated 118137SAli.Saidi@ARM.com * unmodified and in its entirety in all distributions of the software, 128137SAli.Saidi@ARM.com * modified or unmodified, in source code or in binary form. 138137SAli.Saidi@ARM.com * 142329SN/A * Copyright (c) 2004-2006 The Regents of The University of Michigan 151689SN/A * All rights reserved. 161689SN/A * 171689SN/A * Redistribution and use in source and binary forms, with or without 181689SN/A * modification, are permitted provided that the following conditions are 191689SN/A * met: redistributions of source code must retain the above copyright 201689SN/A * notice, this list of conditions and the following disclaimer; 211689SN/A * redistributions in binary form must reproduce the above copyright 221689SN/A * notice, this list of conditions and the following disclaimer in the 231689SN/A * documentation and/or other materials provided with the distribution; 241689SN/A * neither the name of the copyright holders nor the names of its 251689SN/A * contributors may be used to endorse or promote products derived from 261689SN/A * this software without specific prior written permission. 271689SN/A * 281689SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 291689SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 301689SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 311689SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 321689SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 331689SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 341689SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 351689SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 361689SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 371689SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 381689SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 392665Ssaidi@eecs.umich.edu * 402665Ssaidi@eecs.umich.edu * Authors: Kevin Lim 411689SN/A */ 421689SN/A 432292SN/A#ifndef __CPU_O3_COMM_HH__ 442292SN/A#define __CPU_O3_COMM_HH__ 451060SN/A 461061SN/A#include <vector> 471684SN/A 487720Sgblack@eecs.umich.edu#include "arch/types.hh" 496216Snate@binkert.org#include "base/types.hh" 506216Snate@binkert.org#include "cpu/inst_seq.hh" 512980Sgblack@eecs.umich.edu#include "sim/faults.hh" 521060SN/A 532292SN/A// Typedef for physical register index type. Although the Impl would be the 542292SN/A// most likely location for this, there are a few classes that need this 552292SN/A// typedef yet are not templated on the Impl. For now it will be defined here. 561060SN/Atypedef short int PhysRegIndex; 571060SN/A 582348SN/A/** Struct that defines the information passed from fetch to decode. */ 591060SN/Atemplate<class Impl> 602292SN/Astruct DefaultFetchDefaultDecode { 612292SN/A typedef typename Impl::DynInstPtr DynInstPtr; 622292SN/A 632292SN/A int size; 642292SN/A 652292SN/A DynInstPtr insts[Impl::MaxWidth]; 662292SN/A Fault fetchFault; 672292SN/A InstSeqNum fetchFaultSN; 682292SN/A bool clearFetchFault; 692292SN/A}; 702292SN/A 712348SN/A/** Struct that defines the information passed from decode to rename. */ 722292SN/Atemplate<class Impl> 732292SN/Astruct DefaultDecodeDefaultRename { 741061SN/A typedef typename Impl::DynInstPtr DynInstPtr; 751061SN/A 761061SN/A int size; 771061SN/A 781461SN/A DynInstPtr insts[Impl::MaxWidth]; 791060SN/A}; 801060SN/A 812348SN/A/** Struct that defines the information passed from rename to IEW. */ 821060SN/Atemplate<class Impl> 832292SN/Astruct DefaultRenameDefaultIEW { 841061SN/A typedef typename Impl::DynInstPtr DynInstPtr; 851061SN/A 861061SN/A int size; 871061SN/A 881461SN/A DynInstPtr insts[Impl::MaxWidth]; 891060SN/A}; 901060SN/A 912348SN/A/** Struct that defines the information passed from IEW to commit. */ 921060SN/Atemplate<class Impl> 932292SN/Astruct DefaultIEWDefaultCommit { 941061SN/A typedef typename Impl::DynInstPtr DynInstPtr; 951061SN/A 961061SN/A int size; 971061SN/A 981461SN/A DynInstPtr insts[Impl::MaxWidth]; 991062SN/A 1002292SN/A bool squash[Impl::MaxThreads]; 1012292SN/A bool branchMispredict[Impl::MaxThreads]; 1027851SMatt.Horsnell@arm.com DynInstPtr mispredictInst[Impl::MaxThreads]; 1032292SN/A bool branchTaken[Impl::MaxThreads]; 1044636Sgblack@eecs.umich.edu Addr mispredPC[Impl::MaxThreads]; 1057720Sgblack@eecs.umich.edu TheISA::PCState pc[Impl::MaxThreads]; 1062292SN/A InstSeqNum squashedSeqNum[Impl::MaxThreads]; 1072292SN/A 1082292SN/A bool includeSquashInst[Impl::MaxThreads]; 1091060SN/A}; 1101060SN/A 1111060SN/Atemplate<class Impl> 1121060SN/Astruct IssueStruct { 1131061SN/A typedef typename Impl::DynInstPtr DynInstPtr; 1141061SN/A 1151061SN/A int size; 1161061SN/A 1171461SN/A DynInstPtr insts[Impl::MaxWidth]; 1181060SN/A}; 1191060SN/A 1202348SN/A/** Struct that defines all backwards communication. */ 1212292SN/Atemplate<class Impl> 1221060SN/Astruct TimeBufStruct { 1237851SMatt.Horsnell@arm.com typedef typename Impl::DynInstPtr DynInstPtr; 1241060SN/A struct decodeComm { 1251060SN/A bool squash; 1261060SN/A bool predIncorrect; 1271060SN/A uint64_t branchAddr; 1281060SN/A 1291062SN/A InstSeqNum doneSeqNum; 1301062SN/A 1312292SN/A // @todo: Might want to package this kind of branch stuff into a single 1321062SN/A // struct as it is used pretty frequently. 1331061SN/A bool branchMispredict; 1347851SMatt.Horsnell@arm.com DynInstPtr mispredictInst; 1351061SN/A bool branchTaken; 1364636Sgblack@eecs.umich.edu Addr mispredPC; 1377720Sgblack@eecs.umich.edu TheISA::PCState nextPC; 1382292SN/A unsigned branchCount; 1391060SN/A }; 1401060SN/A 1412292SN/A decodeComm decodeInfo[Impl::MaxThreads]; 1421060SN/A 1431060SN/A struct renameComm { 1441060SN/A }; 1451060SN/A 1462292SN/A renameComm renameInfo[Impl::MaxThreads]; 1471060SN/A 1481060SN/A struct iewComm { 1492292SN/A // Also eventually include skid buffer space. 1502292SN/A bool usedIQ; 1512292SN/A unsigned freeIQEntries; 1522292SN/A bool usedLSQ; 1532292SN/A unsigned freeLSQEntries; 1541060SN/A 1552292SN/A unsigned iqCount; 1562292SN/A unsigned ldstqCount; 1572292SN/A 1582292SN/A unsigned dispatched; 1592292SN/A unsigned dispatchedToLSQ; 1601060SN/A }; 1611060SN/A 1622292SN/A iewComm iewInfo[Impl::MaxThreads]; 1631060SN/A 1641060SN/A struct commitComm { 1652292SN/A 1668137SAli.Saidi@ARM.com /////////////// For Decode, IEW, Rename, Fetch /////////// 1671060SN/A bool squash; 1682292SN/A bool robSquashing; 1691060SN/A 1708137SAli.Saidi@ARM.com ////////// For Fetch & IEW ///////////// 1711060SN/A // Represents the instruction that has either been retired or 1721060SN/A // squashed. Similar to having a single bus that broadcasts the 1731060SN/A // retired or squashed sequence number. 1741060SN/A InstSeqNum doneSeqNum; 1751061SN/A 1768137SAli.Saidi@ARM.com ////////////// For Rename ///////////////// 1778137SAli.Saidi@ARM.com // Rename should re-read number of free rob entries 1788137SAli.Saidi@ARM.com bool usedROB; 1798137SAli.Saidi@ARM.com // Notify Rename that the ROB is empty 1808137SAli.Saidi@ARM.com bool emptyROB; 1818137SAli.Saidi@ARM.com // Tell Rename how many free entries it has in the ROB 1828137SAli.Saidi@ARM.com unsigned freeROBEntries; 1831061SN/A 1848137SAli.Saidi@ARM.com 1858137SAli.Saidi@ARM.com ///////////// For Fetch ////////////////// 1868137SAli.Saidi@ARM.com // Provide fetch the instruction that mispredicted, if this 1878137SAli.Saidi@ARM.com // pointer is not-null a misprediction occured 1888137SAli.Saidi@ARM.com DynInstPtr mispredictInst; 1898137SAli.Saidi@ARM.com // Was the branch taken or not 1908137SAli.Saidi@ARM.com bool branchTaken; 1918137SAli.Saidi@ARM.com // The pc of the next instruction to execute. This is the next 1928137SAli.Saidi@ARM.com // instruction for a branch mispredict, but the same instruction for 1938137SAli.Saidi@ARM.com // order violation and the like 1948137SAli.Saidi@ARM.com TheISA::PCState pc; 1958137SAli.Saidi@ARM.com 1968137SAli.Saidi@ARM.com // Instruction that caused the a non-mispredict squash 1978137SAli.Saidi@ARM.com DynInstPtr squashInst; 1988137SAli.Saidi@ARM.com // If an interrupt is pending and fetch should stall 1998137SAli.Saidi@ARM.com bool interruptPending; 2008137SAli.Saidi@ARM.com // If the interrupt ended up being cleared before being handled 2018137SAli.Saidi@ARM.com bool clearInterrupt; 2028137SAli.Saidi@ARM.com 2038137SAli.Saidi@ARM.com //////////// For IEW ////////////////// 2041061SN/A // Communication specifically to the IQ to tell the IQ that it can 2051061SN/A // schedule a non-speculative instruction. 2061061SN/A InstSeqNum nonSpecSeqNum; 2072292SN/A 2082292SN/A // Hack for now to send back an uncached access to the IEW stage. 2092292SN/A bool uncached; 2102292SN/A DynInstPtr uncachedLoad; 2112292SN/A 2121060SN/A }; 2131060SN/A 2142292SN/A commitComm commitInfo[Impl::MaxThreads]; 2152292SN/A 2162292SN/A bool decodeBlock[Impl::MaxThreads]; 2172292SN/A bool decodeUnblock[Impl::MaxThreads]; 2182292SN/A bool renameBlock[Impl::MaxThreads]; 2192292SN/A bool renameUnblock[Impl::MaxThreads]; 2202292SN/A bool iewBlock[Impl::MaxThreads]; 2212292SN/A bool iewUnblock[Impl::MaxThreads]; 2222292SN/A bool commitBlock[Impl::MaxThreads]; 2232292SN/A bool commitUnblock[Impl::MaxThreads]; 2241060SN/A}; 2251060SN/A 2262292SN/A#endif //__CPU_O3_COMM_HH__ 227