ExtMachInst _machInst, OpClass __opClass) :
SparcMacroInst(mnem, _machInst, __opClass, 8)
{}
-
- std::string generateDisassembly(Addr pc,
- const SymbolTable *symtab) const;
};
class BlockMemImm : public BlockMem
imm(sext<13>(SIMM13))
{}
- std::string generateDisassembly(Addr pc,
- const SymbolTable *symtab) const;
-
const int32_t imm;
};
}};
output decoder {{
- std::string BlockMem::generateDisassembly(Addr pc,
+ std::string BlockMemMicro::generateDisassembly(Addr pc,
const SymbolTable *symtab) const
{
std::stringstream response;
return response.str();
}
- std::string BlockMemImm::generateDisassembly(Addr pc,
+ std::string BlockMemImmMicro::generateDisassembly(Addr pc,
const SymbolTable *symtab) const
{
std::stringstream response;
{
public:
//Constructor
- %(class_name)s(MachInst machInst);
+ %(class_name)s(ExtMachInst machInst);
protected:
class %(class_name)s_0 : public %(base_class)sMicro
{
public:
//Constructor
- %(class_name)s_0(MachInst machInst) :
- %(base_class)sMicro("%(mnemonic)s[0]",
- machInst, %(op_class)s, 0*8)
- {;}
+ %(class_name)s_0(ExtMachInst machInst);
%(BasicExecDeclare)s
};
{
public:
//Constructor
- %(class_name)s_1(MachInst machInst) :
- %(base_class)sMicro("%(mnemonic)s[1]",
- machInst, %(op_class)s, 1*8)
- {;}
+ %(class_name)s_1(ExtMachInst machInst);
%(BasicExecDeclare)s
};
{
public:
//Constructor
- %(class_name)s_2(MachInst machInst) :
- %(base_class)sMicro("%(mnemonic)s[2]",
- machInst, %(op_class)s, 2*8)
- {;}
+ %(class_name)s_2(ExtMachInst machInst);
%(BasicExecDeclare)s
};
{
public:
//Constructor
- %(class_name)s_3(MachInst machInst) :
- %(base_class)sMicro("%(mnemonic)s[3]",
- machInst, %(op_class)s, 3*8)
- {;}
+ %(class_name)s_3(ExtMachInst machInst);
%(BasicExecDeclare)s
};
{
public:
//Constructor
- %(class_name)s_4(MachInst machInst) :
- %(base_class)sMicro("%(mnemonic)s[4]",
- machInst, %(op_class)s, 4*8)
- {;}
+ %(class_name)s_4(ExtMachInst machInst);
%(BasicExecDeclare)s
};
{
public:
//Constructor
- %(class_name)s_5(MachInst machInst) :
- %(base_class)sMicro("%(mnemonic)s[5]",
- machInst, %(op_class)s, 5*8)
- {;}
+ %(class_name)s_5(ExtMachInst machInst);
%(BasicExecDeclare)s
};
{
public:
//Constructor
- %(class_name)s_6(MachInst machInst) :
- %(base_class)sMicro("%(mnemonic)s[6]",
- machInst, %(op_class)s, 6*8)
- {;}
+ %(class_name)s_6(ExtMachInst machInst);
%(BasicExecDeclare)s
};
{
public:
//Constructor
- %(class_name)s_7(MachInst machInst) :
- %(base_class)sMicro("%(mnemonic)s[7]",
- machInst, %(op_class)s, 7*8)
- {
- flags[IsLastMicroOp] = true;
- }
+ %(class_name)s_7(ExtMachInst machInst);
%(BasicExecDeclare)s
};
};
// Basic instruction class constructor template.
def template BlockMemConstructor {{
- inline %(class_name)s::%(class_name)s(MachInst machInst)
+ inline %(class_name)s::%(class_name)s(ExtMachInst machInst)
: %(base_class)s("%(mnemonic)s", machInst, %(op_class)s)
{
%(constructor)s;
}
}};
+def template BlockMemMicroConstructor {{
+ inline %(class_name)s::
+ %(class_name)s_%(micro_pc)s::
+ %(class_name)s_%(micro_pc)s(ExtMachInst machInst) :
+ %(base_class)sMicro("%(mnemonic)s[%(micro_pc)s]",
+ machInst, %(op_class)s, %(micro_pc)s * 8)
+ {
+ %(constructor)s;
+ %(set_flags)s;
+ }
+}};
+
def template MicroLoadExecute {{
- Fault %(class_name)s_%(micro_pc)s::execute(%(CPU_exec_context)s *xc,
- Trace::InstRecord *traceData) const
+ Fault %(class_name)s::%(class_name)s_%(micro_pc)s::execute(
+ %(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const
{
Fault fault = NoFault;
Addr EA;
%(op_decl)s;
%(op_rd)s;
- %(fault_check)s;
%(ea_code)s;
+ %(fault_check)s;
DPRINTF(Sparc, "The address is 0x%x\n", EA);
xc->read(EA, (uint%(mem_acc_size)s_t&)Mem, 0);
%(code)s;
Addr EA;
%(op_decl)s;
%(op_rd)s;
- %(fault_check)s;
%(ea_code)s;
+ %(fault_check)s;
DPRINTF(Sparc, "The address is 0x%x\n", EA);
%(code)s;
# those that are only available in hpriv
faultCheck = '''if(bits(Pstate,2,2) == 0 && (EXT_ASI & 0x80) == 0)
return new PrivilegedAction;
- if(AsiIsAsIfUser(EXT_ASI) && !bits(Pstate,2,2))
+ if(AsiIsAsIfUser((ASI)EXT_ASI) && !bits(Pstate,2,2))
return new PrivilegedAction;
- if(RD & 0xf)
+ //The LSB can be zero, since it's really the MSB in doubles
+ //and quads
+ if(RD & 0xe)
return new IllegalInstruction;
if(EA & 0x3f)
- return new MemAddressNotAligned;'''
- addrCalcReg = 'EA = Rs1 + Rs2 + offset;'
- addrCalcImm = 'EA = Rs1 + imm + offset;'
+ return new MemAddressNotAligned;
+ '''
+ addrCalcReg = 'EA = Rs1 + Rs2 + offset * 8;'
+ addrCalcImm = 'EA = Rs1 + imm + offset * 8;'
iop = InstObjParams(name, Name, 'BlockMem', code, opt_flags)
iop_imm = InstObjParams(name, Name + 'Imm', 'BlockMemImm', code, opt_flags)
header_output = BlockMemDeclare.subst(iop) + BlockMemDeclare.subst(iop_imm)
matcher = re.compile(r'Frd_N')
exec_output = ''
for microPC in range(8):
+ flag_code = ''
+ if (microPC == 7):
+ flag_code = "flags[IsLastMicroOp] = true"
pcedCode = matcher.sub("Frd_%d" % microPC, code)
iop = InstObjParams(name, Name, 'BlockMem', pcedCode,
opt_flags, {"ea_code": addrCalcReg,
- "fault_check": faultCheck, "micro_pc": microPC})
+ "fault_check": faultCheck, "micro_pc": microPC,
+ "set_flags": flag_code})
iop_imm = InstObjParams(name, Name + 'Imm', 'BlockMemImm', pcedCode,
opt_flags, {"ea_code": addrCalcImm,
- "fault_check": faultCheck, "micro_pc": microPC})
+ "fault_check": faultCheck, "micro_pc": microPC,
+ "set_flags": flag_code})
exec_output += execute.subst(iop)
exec_output += execute.subst(iop_imm)
+ decoder_output += BlockMemMicroConstructor.subst(iop)
+ decoder_output += BlockMemMicroConstructor.subst(iop_imm)
faultCheck = ''
return (header_output, decoder_output, exec_output, decode_block)
}};