gem5  v22.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 gem5
35 {
36 
37 namespace SparcISA
38 {
39 
41 {
42  protected:
43  const uint32_t numMicroops;
44 
45  // Constructor.
46  SparcMacroInst(const char *mnem, ExtMachInst _machInst,
47  OpClass __opClass, uint32_t _numMicroops) :
48  SparcStaticInst(mnem, _machInst, __opClass),
49  numMicroops(_numMicroops)
50  {
51  assert(numMicroops);
53  flags[IsMacroop] = true;
54  }
55 
57  {
58  delete [] microops;
59  }
60 
61  std::string generateDisassembly(
62  Addr pc, const loader::SymbolTable *symtab) const override;
63 
65 
67  fetchMicroop(MicroPC upc) const override
68  {
69  assert(upc < numMicroops);
70  return microops[upc];
71  }
72 
73  Fault
74  execute(ExecContext *, trace::InstRecord *) const override
75  {
76  panic("Tried to execute a macroop directly!\n");
77  }
78 
79  Fault
81  {
82  panic("Tried to execute a macroop directly!\n");
83  }
84 
85  Fault
87  {
88  panic("Tried to execute a macroop directly!\n");
89  }
90 };
91 
93 {
94  protected:
95  // Constructor.
96  SparcMicroInst(const char *mnem, ExtMachInst _machInst,
97  OpClass __opClass) :
98  SparcStaticInst(mnem, _machInst, __opClass)
99  {
100  flags[IsMicroop] = true;
101  }
102 
103  void
104  advancePC(PCStateBase &pc_state) const override
105  {
106  auto &spc = pc_state.as<PCState>();
107  if (flags[IsLastMicroop])
108  spc.uEnd();
109  else
110  spc.uAdvance();
111  }
112 
113  void
114  advancePC(ThreadContext *tc) const override
115  {
116  PCState pc = tc->pcState().as<PCState>();
117  if (flags[IsLastMicroop])
118  pc.uEnd();
119  else
120  pc.uAdvance();
121  tc->pcState(pc);
122  }
123 };
124 
126 {
127  protected:
128  // Constructor.
129  SparcDelayedMicroInst(const char *mnem, ExtMachInst _machInst,
130  OpClass __opClass) :
131  SparcMicroInst(mnem, _machInst, __opClass)
132  {
133  flags[IsDelayedCommit] = true;
134  }
135 };
136 
137 } // namespace SparcISA
138 } // namespace gem5
139 
140 #endif // __ARCH_SPARC_INSTS_MICRO_HH__
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:72
Target & as()
Definition: pcstate.hh:72
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
SparcDelayedMicroInst(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: micro.hh:129
SparcMacroInst(const char *mnem, ExtMachInst _machInst, OpClass __opClass, uint32_t _numMicroops)
Definition: micro.hh:46
Fault completeAcc(PacketPtr, ExecContext *, trace::InstRecord *) const override
Definition: micro.hh:86
Fault execute(ExecContext *, trace::InstRecord *) const override
Definition: micro.hh:74
StaticInstPtr fetchMicroop(MicroPC upc) const override
Return the microop that goes with a particular micropc.
Definition: micro.hh:67
StaticInstPtr * microops
Definition: micro.hh:64
Fault initiateAcc(ExecContext *, trace::InstRecord *) const override
Definition: micro.hh:80
const uint32_t numMicroops
Definition: micro.hh:43
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: micro.cc:38
void advancePC(PCStateBase &pc_state) const override
Definition: micro.hh:104
SparcMicroInst(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: micro.hh:96
void advancePC(ThreadContext *tc) const override
Definition: micro.hh:114
Base class for all SPARC static instructions.
Definition: static_inst.hh:94
std::bitset< Num_Flags > flags
Flag values for this instruction.
Definition: static_inst.hh:103
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual const PCStateBase & pcState() const =0
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:178
Bitfield< 4 > pc
uint64_t ExtMachInst
Definition: types.hh:42
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::shared_ptr< FaultBase > Fault
Definition: types.hh:248
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
uint16_t MicroPC
Definition: types.hh:149

Generated on Wed Dec 21 2022 10:22:27 for gem5 by doxygen 1.9.1