comm.hh revision 2980
11689SN/A/*
22329SN/A * Copyright (c) 2004-2006 The Regents of The University of Michigan
31689SN/A * All rights reserved.
41689SN/A *
51689SN/A * Redistribution and use in source and binary forms, with or without
61689SN/A * modification, are permitted provided that the following conditions are
71689SN/A * met: redistributions of source code must retain the above copyright
81689SN/A * notice, this list of conditions and the following disclaimer;
91689SN/A * redistributions in binary form must reproduce the above copyright
101689SN/A * notice, this list of conditions and the following disclaimer in the
111689SN/A * documentation and/or other materials provided with the distribution;
121689SN/A * neither the name of the copyright holders nor the names of its
131689SN/A * contributors may be used to endorse or promote products derived from
141689SN/A * this software without specific prior written permission.
151689SN/A *
161689SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
171689SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
181689SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
191689SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
201689SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
211689SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
221689SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
231689SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
241689SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
251689SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
261689SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Kevin Lim
291689SN/A */
301689SN/A
312292SN/A#ifndef __CPU_O3_COMM_HH__
322292SN/A#define __CPU_O3_COMM_HH__
331060SN/A
341061SN/A#include <vector>
351684SN/A
362980Sgblack@eecs.umich.edu#include "sim/faults.hh"
371060SN/A#include "cpu/inst_seq.hh"
381710SN/A#include "sim/host.hh"
391060SN/A
402292SN/A// Typedef for physical register index type. Although the Impl would be the
412292SN/A// most likely location for this, there are a few classes that need this
422292SN/A// typedef yet are not templated on the Impl. For now it will be defined here.
431060SN/Atypedef short int PhysRegIndex;
441060SN/A
452348SN/A/** Struct that defines the information passed from fetch to decode. */
461060SN/Atemplate<class Impl>
472292SN/Astruct DefaultFetchDefaultDecode {
482292SN/A    typedef typename Impl::DynInstPtr DynInstPtr;
492292SN/A
502292SN/A    int size;
512292SN/A
522292SN/A    DynInstPtr insts[Impl::MaxWidth];
532292SN/A    Fault fetchFault;
542292SN/A    InstSeqNum fetchFaultSN;
552292SN/A    bool clearFetchFault;
562292SN/A};
572292SN/A
582348SN/A/** Struct that defines the information passed from decode to rename. */
592292SN/Atemplate<class Impl>
602292SN/Astruct DefaultDecodeDefaultRename {
611061SN/A    typedef typename Impl::DynInstPtr DynInstPtr;
621061SN/A
631061SN/A    int size;
641061SN/A
651461SN/A    DynInstPtr insts[Impl::MaxWidth];
661060SN/A};
671060SN/A
682348SN/A/** Struct that defines the information passed from rename to IEW. */
691060SN/Atemplate<class Impl>
702292SN/Astruct DefaultRenameDefaultIEW {
711061SN/A    typedef typename Impl::DynInstPtr DynInstPtr;
721061SN/A
731061SN/A    int size;
741061SN/A
751461SN/A    DynInstPtr insts[Impl::MaxWidth];
761060SN/A};
771060SN/A
782348SN/A/** Struct that defines the information passed from IEW to commit. */
791060SN/Atemplate<class Impl>
802292SN/Astruct DefaultIEWDefaultCommit {
811061SN/A    typedef typename Impl::DynInstPtr DynInstPtr;
821061SN/A
831061SN/A    int size;
841061SN/A
851461SN/A    DynInstPtr insts[Impl::MaxWidth];
861062SN/A
872292SN/A    bool squash[Impl::MaxThreads];
882292SN/A    bool branchMispredict[Impl::MaxThreads];
892292SN/A    bool branchTaken[Impl::MaxThreads];
902935Sksewell@umich.edu    bool condDelaySlotBranch[Impl::MaxThreads];
912292SN/A    uint64_t mispredPC[Impl::MaxThreads];
922292SN/A    uint64_t nextPC[Impl::MaxThreads];
932292SN/A    InstSeqNum squashedSeqNum[Impl::MaxThreads];
942292SN/A
952292SN/A    bool includeSquashInst[Impl::MaxThreads];
961060SN/A};
971060SN/A
981060SN/Atemplate<class Impl>
991060SN/Astruct IssueStruct {
1001061SN/A    typedef typename Impl::DynInstPtr DynInstPtr;
1011061SN/A
1021061SN/A    int size;
1031061SN/A
1041461SN/A    DynInstPtr insts[Impl::MaxWidth];
1051060SN/A};
1061060SN/A
1072348SN/A/** Struct that defines all backwards communication. */
1082292SN/Atemplate<class Impl>
1091060SN/Astruct TimeBufStruct {
1101060SN/A    struct decodeComm {
1111060SN/A        bool squash;
1121060SN/A        bool predIncorrect;
1131060SN/A        uint64_t branchAddr;
1141060SN/A
1151062SN/A        InstSeqNum doneSeqNum;
1162935Sksewell@umich.edu        InstSeqNum bdelayDoneSeqNum;
1171062SN/A
1182292SN/A        // @todo: Might want to package this kind of branch stuff into a single
1191062SN/A        // struct as it is used pretty frequently.
1201061SN/A        bool branchMispredict;
1211061SN/A        bool branchTaken;
1221061SN/A        uint64_t mispredPC;
1231060SN/A        uint64_t nextPC;
1242292SN/A
1252292SN/A        unsigned branchCount;
1261060SN/A    };
1271060SN/A
1282292SN/A    decodeComm decodeInfo[Impl::MaxThreads];
1291060SN/A
1301060SN/A    struct renameComm {
1311060SN/A    };
1321060SN/A
1332292SN/A    renameComm renameInfo[Impl::MaxThreads];
1341060SN/A
1351060SN/A    struct iewComm {
1362292SN/A        // Also eventually include skid buffer space.
1372292SN/A        bool usedIQ;
1382292SN/A        unsigned freeIQEntries;
1392292SN/A        bool usedLSQ;
1402292SN/A        unsigned freeLSQEntries;
1411060SN/A
1422292SN/A        unsigned iqCount;
1432292SN/A        unsigned ldstqCount;
1442292SN/A
1452292SN/A        unsigned dispatched;
1462292SN/A        unsigned dispatchedToLSQ;
1471060SN/A    };
1481060SN/A
1492292SN/A    iewComm iewInfo[Impl::MaxThreads];
1501060SN/A
1511060SN/A    struct commitComm {
1522292SN/A        bool usedROB;
1532292SN/A        unsigned freeROBEntries;
1542292SN/A        bool emptyROB;
1552292SN/A
1561060SN/A        bool squash;
1572292SN/A        bool robSquashing;
1581060SN/A
1591061SN/A        bool branchMispredict;
1601061SN/A        bool branchTaken;
1611061SN/A        uint64_t mispredPC;
1621060SN/A        uint64_t nextPC;
1631060SN/A
1641060SN/A        // Represents the instruction that has either been retired or
1651060SN/A        // squashed.  Similar to having a single bus that broadcasts the
1661060SN/A        // retired or squashed sequence number.
1671060SN/A        InstSeqNum doneSeqNum;
1681061SN/A
1692935Sksewell@umich.edu        InstSeqNum bdelayDoneSeqNum;
1702935Sksewell@umich.edu        bool squashDelaySlot;
1712935Sksewell@umich.edu
1722292SN/A        //Just in case we want to do a commit/squash on a cycle
1732292SN/A        //(necessary for multiple ROBs?)
1742292SN/A        bool commitInsts;
1752292SN/A        InstSeqNum squashSeqNum;
1761061SN/A
1771061SN/A        // Communication specifically to the IQ to tell the IQ that it can
1781061SN/A        // schedule a non-speculative instruction.
1791061SN/A        InstSeqNum nonSpecSeqNum;
1802292SN/A
1812292SN/A        // Hack for now to send back an uncached access to the IEW stage.
1822292SN/A        typedef typename Impl::DynInstPtr DynInstPtr;
1832292SN/A        bool uncached;
1842292SN/A        DynInstPtr uncachedLoad;
1852292SN/A
1862292SN/A        bool interruptPending;
1872292SN/A        bool clearInterrupt;
1881060SN/A    };
1891060SN/A
1902292SN/A    commitComm commitInfo[Impl::MaxThreads];
1912292SN/A
1922292SN/A    bool decodeBlock[Impl::MaxThreads];
1932292SN/A    bool decodeUnblock[Impl::MaxThreads];
1942292SN/A    bool renameBlock[Impl::MaxThreads];
1952292SN/A    bool renameUnblock[Impl::MaxThreads];
1962292SN/A    bool iewBlock[Impl::MaxThreads];
1972292SN/A    bool iewUnblock[Impl::MaxThreads];
1982292SN/A    bool commitBlock[Impl::MaxThreads];
1992292SN/A    bool commitUnblock[Impl::MaxThreads];
2001060SN/A};
2011060SN/A
2022292SN/A#endif //__CPU_O3_COMM_HH__
203