comm.hh revision 6216
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
366216Snate@binkert.org#include "base/types.hh"
376216Snate@binkert.org#include "cpu/inst_seq.hh"
382980Sgblack@eecs.umich.edu#include "sim/faults.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];
904636Sgblack@eecs.umich.edu    Addr mispredPC[Impl::MaxThreads];
914636Sgblack@eecs.umich.edu    Addr nextPC[Impl::MaxThreads];
924636Sgblack@eecs.umich.edu    Addr nextNPC[Impl::MaxThreads];
934636Sgblack@eecs.umich.edu    Addr nextMicroPC[Impl::MaxThreads];
942292SN/A    InstSeqNum squashedSeqNum[Impl::MaxThreads];
952292SN/A
962292SN/A    bool includeSquashInst[Impl::MaxThreads];
971060SN/A};
981060SN/A
991060SN/Atemplate<class Impl>
1001060SN/Astruct IssueStruct {
1011061SN/A    typedef typename Impl::DynInstPtr DynInstPtr;
1021061SN/A
1031061SN/A    int size;
1041061SN/A
1051461SN/A    DynInstPtr insts[Impl::MaxWidth];
1061060SN/A};
1071060SN/A
1082348SN/A/** Struct that defines all backwards communication. */
1092292SN/Atemplate<class Impl>
1101060SN/Astruct TimeBufStruct {
1111060SN/A    struct decodeComm {
1121060SN/A        bool squash;
1131060SN/A        bool predIncorrect;
1141060SN/A        uint64_t branchAddr;
1151060SN/A
1161062SN/A        InstSeqNum doneSeqNum;
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;
1224636Sgblack@eecs.umich.edu        Addr mispredPC;
1234636Sgblack@eecs.umich.edu        Addr nextPC;
1244636Sgblack@eecs.umich.edu        Addr nextNPC;
1254636Sgblack@eecs.umich.edu        Addr nextMicroPC;
1262292SN/A
1272292SN/A        unsigned branchCount;
1281060SN/A    };
1291060SN/A
1302292SN/A    decodeComm decodeInfo[Impl::MaxThreads];
1311060SN/A
1321060SN/A    struct renameComm {
1331060SN/A    };
1341060SN/A
1352292SN/A    renameComm renameInfo[Impl::MaxThreads];
1361060SN/A
1371060SN/A    struct iewComm {
1382292SN/A        // Also eventually include skid buffer space.
1392292SN/A        bool usedIQ;
1402292SN/A        unsigned freeIQEntries;
1412292SN/A        bool usedLSQ;
1422292SN/A        unsigned freeLSQEntries;
1431060SN/A
1442292SN/A        unsigned iqCount;
1452292SN/A        unsigned ldstqCount;
1462292SN/A
1472292SN/A        unsigned dispatched;
1482292SN/A        unsigned dispatchedToLSQ;
1491060SN/A    };
1501060SN/A
1512292SN/A    iewComm iewInfo[Impl::MaxThreads];
1521060SN/A
1531060SN/A    struct commitComm {
1542292SN/A        bool usedROB;
1552292SN/A        unsigned freeROBEntries;
1562292SN/A        bool emptyROB;
1572292SN/A
1581060SN/A        bool squash;
1592292SN/A        bool robSquashing;
1601060SN/A
1611061SN/A        bool branchMispredict;
1621061SN/A        bool branchTaken;
1634636Sgblack@eecs.umich.edu        Addr mispredPC;
1644636Sgblack@eecs.umich.edu        Addr nextPC;
1654636Sgblack@eecs.umich.edu        Addr nextNPC;
1664636Sgblack@eecs.umich.edu        Addr nextMicroPC;
1671060SN/A
1681060SN/A        // Represents the instruction that has either been retired or
1691060SN/A        // squashed.  Similar to having a single bus that broadcasts the
1701060SN/A        // retired or squashed sequence number.
1711060SN/A        InstSeqNum doneSeqNum;
1721061SN/A
1732292SN/A        //Just in case we want to do a commit/squash on a cycle
1742292SN/A        //(necessary for multiple ROBs?)
1752292SN/A        bool commitInsts;
1762292SN/A        InstSeqNum squashSeqNum;
1771061SN/A
1781061SN/A        // Communication specifically to the IQ to tell the IQ that it can
1791061SN/A        // schedule a non-speculative instruction.
1801061SN/A        InstSeqNum nonSpecSeqNum;
1812292SN/A
1822292SN/A        // Hack for now to send back an uncached access to the IEW stage.
1832292SN/A        typedef typename Impl::DynInstPtr DynInstPtr;
1842292SN/A        bool uncached;
1852292SN/A        DynInstPtr uncachedLoad;
1862292SN/A
1872292SN/A        bool interruptPending;
1882292SN/A        bool clearInterrupt;
1891060SN/A    };
1901060SN/A
1912292SN/A    commitComm commitInfo[Impl::MaxThreads];
1922292SN/A
1932292SN/A    bool decodeBlock[Impl::MaxThreads];
1942292SN/A    bool decodeUnblock[Impl::MaxThreads];
1952292SN/A    bool renameBlock[Impl::MaxThreads];
1962292SN/A    bool renameUnblock[Impl::MaxThreads];
1972292SN/A    bool iewBlock[Impl::MaxThreads];
1982292SN/A    bool iewUnblock[Impl::MaxThreads];
1992292SN/A    bool commitBlock[Impl::MaxThreads];
2002292SN/A    bool commitUnblock[Impl::MaxThreads];
2011060SN/A};
2021060SN/A
2032292SN/A#endif //__CPU_O3_COMM_HH__
204