gem5  v20.1.0.0
micro.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006-2007 The Regents of The University of Michigan
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef __ARCH_SPARC_INSTS_MICRO_HH__
30 #define __ARCH_SPARC_INSTS_MICRO_HH__
31 
33 
34 namespace SparcISA
35 {
36 
38 {
39  protected:
40  const uint32_t numMicroops;
41 
42  // Constructor.
43  SparcMacroInst(const char *mnem, ExtMachInst _machInst,
44  OpClass __opClass, uint32_t _numMicroops) :
45  SparcStaticInst(mnem, _machInst, __opClass),
46  numMicroops(_numMicroops)
47  {
48  assert(numMicroops);
50  flags[IsMacroop] = true;
51  }
52 
54  {
55  delete [] microops;
56  }
57 
58  std::string generateDisassembly(
59  Addr pc, const Loader::SymbolTable *symtab) const override;
60 
62 
64  fetchMicroop(MicroPC upc) const override
65  {
66  assert(upc < numMicroops);
67  return microops[upc];
68  }
69 
70  Fault
71  execute(ExecContext *, Trace::InstRecord *) const override
72  {
73  panic("Tried to execute a macroop directly!\n");
74  }
75 
76  Fault
78  {
79  panic("Tried to execute a macroop directly!\n");
80  }
81 
82  Fault
84  {
85  panic("Tried to execute a macroop directly!\n");
86  }
87 };
88 
90 {
91  protected:
92  // Constructor.
93  SparcMicroInst(const char *mnem, ExtMachInst _machInst,
94  OpClass __opClass) :
95  SparcStaticInst(mnem, _machInst, __opClass)
96  {
97  flags[IsMicroop] = true;
98  }
99 
100  void
101  advancePC(SparcISA::PCState &pcState) const override
102  {
103  if (flags[IsLastMicroop])
104  pcState.uEnd();
105  else
106  pcState.uAdvance();
107  }
108 };
109 
111 {
112  protected:
113  // Constructor.
114  SparcDelayedMicroInst(const char *mnem, ExtMachInst _machInst,
115  OpClass __opClass) :
116  SparcMicroInst(mnem, _machInst, __opClass)
117  {
118  flags[IsDelayedCommit] = true;
119  }
120 };
121 
122 }
123 
124 #endif // __ARCH_SPARC_INSTS_MICRO_HH__
StaticInst::flags
std::bitset< Num_Flags > flags
Flag values for this instruction.
Definition: static_inst.hh:99
SparcISA::SparcMacroInst
Definition: micro.hh:37
SparcISA::SparcMacroInst::numMicroops
const uint32_t numMicroops
Definition: micro.hh:40
SparcISA::SparcMacroInst::completeAcc
Fault completeAcc(PacketPtr, ExecContext *, Trace::InstRecord *) const override
Definition: micro.hh:83
SparcISA::SparcMacroInst::~SparcMacroInst
~SparcMacroInst()
Definition: micro.hh:53
SparcISA::SparcMacroInst::initiateAcc
Fault initiateAcc(ExecContext *, Trace::InstRecord *) const override
Definition: micro.hh:77
SparcISA::SparcMicroInst::advancePC
void advancePC(SparcISA::PCState &pcState) const override
Definition: micro.hh:101
Loader::SymbolTable
Definition: symtab.hh:59
Trace::InstRecord
Definition: insttracer.hh:55
GenericISA::DelaySlotUPCState::uAdvance
void uAdvance()
Definition: types.hh:432
GenericISA::DelaySlotUPCState
Definition: types.hh:391
SparcISA
Definition: asi.cc:31
GenericISA::DelaySlotUPCState::uEnd
void uEnd()
Definition: types.hh:440
Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
MipsISA::pc
Bitfield< 4 > pc
Definition: pra_constants.hh:240
ExecContext
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:70
StaticInst::ExtMachInst
TheISA::ExtMachInst ExtMachInst
Binary extended machine instruction type.
Definition: static_inst.hh:89
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
SparcISA::SparcStaticInst
Base class for all SPARC static instructions.
Definition: static_inst.hh:87
SparcISA::SparcMicroInst
Definition: micro.hh:89
SparcISA::SparcDelayedMicroInst
Definition: micro.hh:110
SparcISA::SparcDelayedMicroInst::SparcDelayedMicroInst
SparcDelayedMicroInst(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: micro.hh:114
SparcISA::SparcMacroInst::SparcMacroInst
SparcMacroInst(const char *mnem, ExtMachInst _machInst, OpClass __opClass, uint32_t _numMicroops)
Definition: micro.hh:43
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
static_inst.hh
SparcISA::SparcMacroInst::execute
Fault execute(ExecContext *, Trace::InstRecord *) const override
Definition: micro.hh:71
RefCountingPtr< StaticInst >
SparcISA::SparcMicroInst::SparcMicroInst
SparcMicroInst(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: micro.hh:93
MicroPC
uint16_t MicroPC
Definition: types.hh:144
SparcISA::SparcMacroInst::microops
StaticInstPtr * microops
Definition: micro.hh:61
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:171
SparcISA::SparcMacroInst::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: micro.cc:35
SparcISA::SparcMacroInst::fetchMicroop
StaticInstPtr fetchMicroop(MicroPC upc) const override
Return the microop that goes with a particular micropc.
Definition: micro.hh:64

Generated on Wed Sep 30 2020 14:02:07 for gem5 by doxygen 1.8.17