func_unit.hh revision 10807
12315SN/A/*
28733Sgeoffrey.blake@arm.com * Copyright (c) 2002-2006 The Regents of The University of Michigan
39920Syasuko.eckert@amd.com * All rights reserved.
48733Sgeoffrey.blake@arm.com *
58733Sgeoffrey.blake@arm.com * Redistribution and use in source and binary forms, with or without
68733Sgeoffrey.blake@arm.com * modification, are permitted provided that the following conditions are
78733Sgeoffrey.blake@arm.com * met: redistributions of source code must retain the above copyright
88733Sgeoffrey.blake@arm.com * notice, this list of conditions and the following disclaimer;
98733Sgeoffrey.blake@arm.com * redistributions in binary form must reproduce the above copyright
108733Sgeoffrey.blake@arm.com * notice, this list of conditions and the following disclaimer in the
118733Sgeoffrey.blake@arm.com * documentation and/or other materials provided with the distribution;
128733Sgeoffrey.blake@arm.com * neither the name of the copyright holders nor the names of its
138733Sgeoffrey.blake@arm.com * contributors may be used to endorse or promote products derived from
148733Sgeoffrey.blake@arm.com * this software without specific prior written permission.
152332SN/A *
162315SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172315SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182315SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192315SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202315SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212315SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222315SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232315SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242315SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252315SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262315SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272315SN/A *
282315SN/A * Authors: Steve Raasch
292315SN/A */
302315SN/A
312315SN/A#ifndef __CPU_FUNC_UNIT_HH__
322315SN/A#define __CPU_FUNC_UNIT_HH__
332315SN/A
342315SN/A#include <bitset>
352315SN/A#include <string>
362315SN/A#include <vector>
372315SN/A
382315SN/A#include "cpu/op_class.hh"
392315SN/A#include "params/FUDesc.hh"
402689Sktlim@umich.edu#include "params/OpDesc.hh"
412689Sktlim@umich.edu#include "sim/sim_object.hh"
422315SN/A
432315SN/A////////////////////////////////////////////////////////////////////////////
442315SN/A//
452315SN/A//  Structures used ONLY during the initialization phase...
462315SN/A//
472315SN/A//
488229Snate@binkert.org//
492315SN/A
502315SN/Aclass OpDesc : public SimObject
512669Sktlim@umich.edu{
522315SN/A  public:
532315SN/A    OpClass opClass;
542315SN/A    Cycles opLat;
558229Snate@binkert.org    bool pipelined;
562683Sktlim@umich.edu
572315SN/A    OpDesc(const OpDescParams *p)
588733Sgeoffrey.blake@arm.com        : SimObject(p), opClass(p->opClass), opLat(p->opLat),
598733Sgeoffrey.blake@arm.com          pipelined(p->pipelined) {};
602315SN/A};
612315SN/A
622315SN/Aclass FUDesc : public SimObject
633468Sgblack@eecs.umich.edu{
643468Sgblack@eecs.umich.edu  public:
656022Sgblack@eecs.umich.edu    std::vector<OpDesc *> opDescList;
663468Sgblack@eecs.umich.edu    unsigned         number;
672315SN/A
682315SN/A    FUDesc(const FUDescParams *p)
692315SN/A        : SimObject(p), opDescList(p->opList), number(p->count) {};
702680Sktlim@umich.edu};
712669Sktlim@umich.edu
722315SN/Atypedef std::vector<OpDesc *>::const_iterator OPDDiterator;
732350SN/Atypedef std::vector<FUDesc *>::const_iterator FUDDiterator;
742350SN/A
752350SN/A
762350SN/A
772350SN/A
782350SN/A////////////////////////////////////////////////////////////////////////////
792350SN/A//
802350SN/A//  The actual FU object
812350SN/A//
822350SN/A//
832680Sktlim@umich.edu//
842683Sktlim@umich.educlass FuncUnit
852680Sktlim@umich.edu{
862350SN/A  private:
872680Sktlim@umich.edu    unsigned opLatencies[Num_OpClasses];
882350SN/A    bool pipelined[Num_OpClasses];
892315SN/A    std::bitset<Num_OpClasses> capabilityList;
902315SN/A
912315SN/A  public:
922315SN/A    FuncUnit();
932669Sktlim@umich.edu    FuncUnit(const FuncUnit &fu);
942669Sktlim@umich.edu
952315SN/A    std::string name;
968832SAli.Saidi@ARM.com
978832SAli.Saidi@ARM.com    void addCapability(OpClass cap, unsigned oplat, bool pipelined);
988832SAli.Saidi@ARM.com
992315SN/A    bool provides(OpClass capability);
1002315SN/A    std::bitset<Num_OpClasses> capabilities();
1012315SN/A
1025529Snate@binkert.org    unsigned &opLatency(OpClass capability);
1032315SN/A    bool isPipelined(OpClass capability);
1042315SN/A};
1052315SN/A
1062315SN/A#endif // __FU_POOL_HH__
1072315SN/A