comm.hh revision 10239:592f0bb6bd6f
12068SN/A/*
22068SN/A * Copyright (c) 2011 ARM Limited
32068SN/A * Copyright (c) 2013 Advanced Micro Devices, Inc.
42068SN/A * All rights reserved
52068SN/A *
62068SN/A * The license below extends only to copyright in the software and shall
72068SN/A * not be construed as granting a license to any other intellectual
82068SN/A * property including but not limited to intellectual property relating
92068SN/A * to a hardware implementation of the functionality of the software
102068SN/A * licensed hereunder.  You may use the software subject to the license
112068SN/A * terms below provided that you ensure that this notice is replicated
122068SN/A * unmodified and in its entirety in all distributions of the software,
132068SN/A * modified or unmodified, in source code or in binary form.
142068SN/A *
152068SN/A * Copyright (c) 2004-2006 The Regents of The University of Michigan
162068SN/A * All rights reserved.
172068SN/A *
182068SN/A * Redistribution and use in source and binary forms, with or without
192068SN/A * modification, are permitted provided that the following conditions are
202068SN/A * met: redistributions of source code must retain the above copyright
212068SN/A * notice, this list of conditions and the following disclaimer;
222068SN/A * redistributions in binary form must reproduce the above copyright
232068SN/A * notice, this list of conditions and the following disclaimer in the
242068SN/A * documentation and/or other materials provided with the distribution;
252068SN/A * neither the name of the copyright holders nor the names of its
262068SN/A * contributors may be used to endorse or promote products derived from
272068SN/A * this software without specific prior written permission.
282665Ssaidi@eecs.umich.edu *
292665Ssaidi@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
302665Ssaidi@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
312068SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
322649Ssaidi@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
332649Ssaidi@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
342649Ssaidi@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
352649Ssaidi@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
362649Ssaidi@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
372068SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
382068SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
392068SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
402068SN/A *
412068SN/A * Authors: Kevin Lim
422068SN/A */
432068SN/A
442068SN/A#ifndef __CPU_O3_COMM_HH__
452068SN/A#define __CPU_O3_COMM_HH__
465736Snate@binkert.org
472068SN/A#include <vector>
482068SN/A
496181Sksewell@umich.edu#include "arch/types.hh"
506181Sksewell@umich.edu#include "base/types.hh"
512068SN/A#include "cpu/inst_seq.hh"
522068SN/A#include "sim/faults.hh"
532068SN/A
542068SN/A// Typedef for physical register index type. Although the Impl would be the
552068SN/A// most likely location for this, there are a few classes that need this
562068SN/A// typedef yet are not templated on the Impl. For now it will be defined here.
572068SN/Atypedef short int PhysRegIndex;
582068SN/A
592068SN/A/** Struct that defines the information passed from fetch to decode. */
602068SN/Atemplate<class Impl>
612068SN/Astruct DefaultFetchDefaultDecode {
622068SN/A    typedef typename Impl::DynInstPtr DynInstPtr;
632068SN/A
642068SN/A    int size;
652068SN/A
662068SN/A    DynInstPtr insts[Impl::MaxWidth];
672068SN/A    Fault fetchFault;
682068SN/A    InstSeqNum fetchFaultSN;
696181Sksewell@umich.edu    bool clearFetchFault;
706181Sksewell@umich.edu};
712068SN/A
722068SN/A/** Struct that defines the information passed from decode to rename. */
732068SN/Atemplate<class Impl>
742068SN/Astruct DefaultDecodeDefaultRename {
752068SN/A    typedef typename Impl::DynInstPtr DynInstPtr;
762068SN/A
772068SN/A    int size;
782068SN/A
792068SN/A    DynInstPtr insts[Impl::MaxWidth];
802068SN/A};
812068SN/A
822068SN/A/** Struct that defines the information passed from rename to IEW. */
832068SN/Atemplate<class Impl>
842068SN/Astruct DefaultRenameDefaultIEW {
852068SN/A    typedef typename Impl::DynInstPtr DynInstPtr;
866181Sksewell@umich.edu
876181Sksewell@umich.edu    int size;
882068SN/A
892068SN/A    DynInstPtr insts[Impl::MaxWidth];
902068SN/A};
912068SN/A
922068SN/A/** Struct that defines the information passed from IEW to commit. */
932068SN/Atemplate<class Impl>
942068SN/Astruct DefaultIEWDefaultCommit {
952068SN/A    typedef typename Impl::DynInstPtr DynInstPtr;
962068SN/A
972068SN/A    int size;
982068SN/A
992068SN/A    DynInstPtr insts[Impl::MaxWidth];
1002068SN/A    DynInstPtr mispredictInst[Impl::MaxThreads];
1012068SN/A    Addr mispredPC[Impl::MaxThreads];
1022068SN/A    InstSeqNum squashedSeqNum[Impl::MaxThreads];
1032068SN/A    TheISA::PCState pc[Impl::MaxThreads];
1042068SN/A
1052068SN/A    bool squash[Impl::MaxThreads];
1062068SN/A    bool branchMispredict[Impl::MaxThreads];
1072068SN/A    bool branchTaken[Impl::MaxThreads];
1082068SN/A    bool includeSquashInst[Impl::MaxThreads];
1092068SN/A};
1102068SN/A
1112068SN/Atemplate<class Impl>
1122068SN/Astruct IssueStruct {
1133953Sstever@eecs.umich.edu    typedef typename Impl::DynInstPtr DynInstPtr;
1142068SN/A
1152068SN/A    int size;
1162068SN/A
1172068SN/A    DynInstPtr insts[Impl::MaxWidth];
1182068SN/A};
1192068SN/A
1202068SN/A/** Struct that defines all backwards communication. */
1212068SN/Atemplate<class Impl>
1222068SN/Astruct TimeBufStruct {
1232068SN/A    typedef typename Impl::DynInstPtr DynInstPtr;
1242068SN/A    struct decodeComm {
1252068SN/A        TheISA::PCState nextPC;
1262068SN/A        DynInstPtr mispredictInst;
1272068SN/A        DynInstPtr squashInst;
1282068SN/A        InstSeqNum doneSeqNum;
1292068SN/A        Addr mispredPC;
1302227SN/A        uint64_t branchAddr;
1312068SN/A        unsigned branchCount;
1322068SN/A        bool squash;
1332095SN/A        bool predIncorrect;
1346181Sksewell@umich.edu        bool branchMispredict;
1356181Sksewell@umich.edu        bool branchTaken;
1362095SN/A    };
1372095SN/A
1382095SN/A    decodeComm decodeInfo[Impl::MaxThreads];
1392068SN/A
1402068SN/A    struct renameComm {
1412068SN/A    };
1422095SN/A
1436181Sksewell@umich.edu    renameComm renameInfo[Impl::MaxThreads];
1446181Sksewell@umich.edu
1456181Sksewell@umich.edu    struct iewComm {
1466181Sksewell@umich.edu        // Also eventually include skid buffer space.
1472095SN/A        unsigned freeIQEntries;
1482132SN/A        unsigned freeLQEntries;
1492095SN/A        unsigned freeSQEntries;
1502095SN/A        unsigned dispatchedToLQ;
1512095SN/A        unsigned dispatchedToSQ;
1522095SN/A
1533349Sbinkertn@umich.edu        unsigned iqCount;
1542623SN/A        unsigned ldstqCount;
1552095SN/A
1562095SN/A        unsigned dispatched;
1576181Sksewell@umich.edu        bool usedIQ;
1586181Sksewell@umich.edu        bool usedLSQ;
1596181Sksewell@umich.edu    };
1602068SN/A
1613953Sstever@eecs.umich.edu    iewComm iewInfo[Impl::MaxThreads];
1622068SN/A
1633953Sstever@eecs.umich.edu    struct commitComm {
1642068SN/A        /////////////////////////////////////////////////////////////////////
1652068SN/A        // This code has been re-structured for better packing of variables
1666181Sksewell@umich.edu        // instead of by stage which is the more logical way to arrange the
1676181Sksewell@umich.edu        // data.
1682068SN/A        // F = Fetch
1692068SN/A        // D = Decode
1702132SN/A        // I = IEW
1712068SN/A        // R = Rename
1722068SN/A        // As such each member is annotated with who consumes it
1732068SN/A        // e.g. bool variable name // *F,R for Fetch and Rename
1742068SN/A        /////////////////////////////////////////////////////////////////////
1753953Sstever@eecs.umich.edu
1762068SN/A        /// The pc of the next instruction to execute. This is the next
1772090SN/A        /// instruction for a branch mispredict, but the same instruction for
1782068SN/A        /// order violation and the like
1792068SN/A        TheISA::PCState pc; // *F
1802068SN/A
1812068SN/A        /// Provide fetch the instruction that mispredicted, if this
1822068SN/A        /// pointer is not-null a misprediction occured
1832068SN/A        DynInstPtr mispredictInst;  // *F
1842068SN/A
1852068SN/A        /// Instruction that caused the a non-mispredict squash
1862068SN/A        DynInstPtr squashInst; // *F
1872069SN/A
1882132SN/A        /// Hack for now to send back an uncached access to the IEW stage.
1892068SN/A        DynInstPtr uncachedLoad; // *I
1902068SN/A
1912068SN/A        /// Communication specifically to the IQ to tell the IQ that it can
1922132SN/A        /// schedule a non-speculative instruction.
1932068SN/A        InstSeqNum nonSpecSeqNum; // *I
1942068SN/A
1952068SN/A        /// Represents the instruction that has either been retired or
1962069SN/A        /// squashed.  Similar to having a single bus that broadcasts the
1972068SN/A        /// retired or squashed sequence number.
1982068SN/A        InstSeqNum doneSeqNum; // *F, I
1992090SN/A
2008442Sgblack@eecs.umich.edu        /// Tell Rename how many free entries it has in the ROB
2012068SN/A        unsigned freeROBEntries; // *R
2022068SN/A
2032068SN/A        bool squash; // *F, D, R, I
2042090SN/A        bool robSquashing; // *F, D, R, I
2052069SN/A
2062069SN/A        /// Rename should re-read number of free rob entries
2072069SN/A        bool usedROB; // *R
2082069SN/A
2092069SN/A        /// Notify Rename that the ROB is empty
2102069SN/A        bool emptyROB; // *R
2112069SN/A
2122069SN/A        /// Was the branch taken or not
2132095SN/A        bool branchTaken; // *F
2142132SN/A        /// If an interrupt is pending and fetch should stall
2152095SN/A        bool interruptPending; // *F
2162095SN/A        /// If the interrupt ended up being cleared before being handled
2172095SN/A        bool clearInterrupt; // *F
2182132SN/A
2192095SN/A        /// Hack for now to send back an uncached access to the IEW stage.
2202095SN/A        bool uncached; // *I
2212095SN/A
2222095SN/A    };
2232095SN/A
2242095SN/A    commitComm commitInfo[Impl::MaxThreads];
2252098SN/A
2268442Sgblack@eecs.umich.edu    bool decodeBlock[Impl::MaxThreads];
2272095SN/A    bool decodeUnblock[Impl::MaxThreads];
2282095SN/A    bool renameBlock[Impl::MaxThreads];
2292095SN/A    bool renameUnblock[Impl::MaxThreads];
2302095SN/A    bool iewBlock[Impl::MaxThreads];
2312095SN/A    bool iewUnblock[Impl::MaxThreads];
2322095SN/A    bool commitBlock[Impl::MaxThreads];
2332095SN/A    bool commitUnblock[Impl::MaxThreads];
2342095SN/A};
2353349Sbinkertn@umich.edu
2362095SN/A#endif //__CPU_O3_COMM_HH__
2372095SN/A