}
format PredOp {
// ARM System Call (SoftWare Interrupt)
- 1: swi({{ if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR),
- condCode))
+ 1: swi({{ if (testPredicate(Cpsr, condCode))
{
//xc->syscall(R7);
xc->syscall(IMMED_23_0);
else:
inst_flags += ('IsCondControl', )
- icode = 'if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode)) {\n'
+ icode = 'if (testPredicate(Cpsr, condCode)) {\n'
icode += code
icode += ' NPC = NPC + 4 + disp;\n'
icode += '} else {\n'
#Condition code
- icode = 'if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode)) {\n'
+ icode = 'if (testPredicate(Cpsr, condCode)) {\n'
icode += code
icode += ' NPC = Rm & 0xfffffffe; // Masks off bottom bit\n'
icode += '} else {\n'
%(op_decl)s;
%(op_rd)s;
- %(code)s;
-
- if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode) &&
- fault == NoFault)
- {
- %(op_wb)s;
+ if (%(predicate_test)s) {
+ %(code)s;
+ if (fault == NoFault) {
+ %(op_wb)s;
+ }
}
return fault;
orig_code = code
cblk = code
- iop = InstObjParams(name, Name, 'FPAOp', cblk, flags)
+ iop = InstObjParams(name, Name, 'FPAOp',
+ {"code": cblk,
+ "predicate_test": predicateTest},
+ flags)
header_output = BasicDeclare.subst(iop)
decoder_output = BasicConstructor.subst(iop)
exec_output = FPAExecute.subst(iop)
sng_cblk = code
- sng_iop = InstObjParams(name, Name+'S', 'FPAOp', sng_cblk, flags)
+ sng_iop = InstObjParams(name, Name+'S', 'FPAOp',
+ {"code": sng_cblk,
+ "predicate_test": predicateTest},
+ flags)
header_output += BasicDeclare.subst(sng_iop)
decoder_output += BasicConstructor.subst(sng_iop)
exec_output += FPAExecute.subst(sng_iop)
dbl_code = re.sub(r'\.sf', '.df', orig_code)
dbl_cblk = dbl_code
- dbl_iop = InstObjParams(name, Name+'D', 'FPAOp', dbl_cblk, flags)
+ dbl_iop = InstObjParams(name, Name+'D', 'FPAOp',
+ {"code": dbl_cblk,
+ "predicate_test": predicateTest},
+ flags)
header_output += BasicDeclare.subst(dbl_iop)
decoder_output += BasicConstructor.subst(dbl_iop)
exec_output += FPAExecute.subst(dbl_iop)
def format FloatCmp(fReg1, fReg2, *flags) {{
code = calcFPCcCode % vars()
- iop = InstObjParams(name, Name, 'FPAOp', code, flags)
+ iop = InstObjParams(name, Name, 'FPAOp',
+ {"code": code,
+ "predicate_test": predicateTest},
+ flags)
header_output = BasicDeclare.subst(iop)
decoder_output = BasicConstructor.subst(iop)
decode_block = BasicDecode.subst(iop)
}};
def format ArmMacroFPAOp(code, mem_flags = [], inst_flag = [], *opt_flags) {{
- iop = InstObjParams(name, Name, 'ArmMacroFPAOp', code, opt_flags)
+ iop = InstObjParams(name, Name, 'ArmMacroFPAOp',
+ {"code": code,
+ "predicate_test": predicateTest},
+ opt_flags)
header_output = BasicDeclare.subst(iop)
decoder_output = MacroFPAConstructor.subst(iop)
decode_block = BasicDecode.subst(iop)
}};
def format ArmMacroFMOp(code, mem_flags = [], inst_flag = [], *opt_flags) {{
- iop = InstObjParams(name, Name, 'ArmMacroFMOp', code, opt_flags)
+ iop = InstObjParams(name, Name, 'ArmMacroFMOp',
+ {"code": code,
+ "predicate_test": predicateTest},
+ opt_flags)
header_output = BasicDeclare.subst(iop)
decoder_output = MacroFMConstructor.subst(iop)
decode_block = BasicDecode.subst(iop)
%(op_rd)s;
%(ea_code)s;
- if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode))
+ if (%(predicate_test)s)
{
if (fault == NoFault) {
%(op_wb)s;
%(op_rd)s;
EA = xc->getEA();
- if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode))
+ if (%(predicate_test)s)
{
if (fault == NoFault) {
fault = xc->read(EA, (uint%(mem_acc_size)d_t&)Mem, memAccessFlags);
%(op_rd)s;
%(ea_code)s;
- if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode))
+ if (%(predicate_test)s)
{
if (fault == NoFault) {
fault = xc->read(EA, (uint%(mem_acc_size)d_t&)Mem, memAccessFlags);
%(op_rd)s;
%(ea_code)s;
- if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode))
+ if (%(predicate_test)s)
{
if (fault == NoFault) {
fault = xc->read(EA, (uint%(mem_acc_size)d_t &)Mem, memAccessFlags);
%(op_decl)s;
%(op_rd)s;
- if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode))
+ if (%(predicate_test)s)
{
// ARM instructions will not have a pkt if the predicate is false
Mem = pkt->get<typeof(Mem)>();
%(op_decl)s;
%(op_rd)s;
- if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode))
+ if (%(predicate_test)s)
{
EA = xc->getEA();
%(op_rd)s;
%(ea_code)s;
- if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode))
+ if (%(predicate_test)s)
{
if (fault == NoFault) {
%(memacc_code)s;
%(op_rd)s;
%(ea_code)s;
- if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode))
+ if (%(predicate_test)s)
{
if (fault == NoFault) {
%(memacc_code)s;
%(fp_enable_check)s;
%(op_dest_decl)s;
- if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode))
+ if (%(predicate_test)s)
{
if (fault == NoFault) {
%(op_wb)s;
%(fp_enable_check)s;
%(op_dest_decl)s;
- if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode))
+ if (%(predicate_test)s)
{
if (fault == NoFault) {
%(op_wb)s;
%(op_decl)s;
%(op_rd)s;
- if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode))
+ if (%(predicate_test)s)
{
EA = xc->getEA();
%(op_rd)s;
%(ea_code)s;
- if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode))
+ if (%(predicate_test)s)
{
if (fault == NoFault) {
%(memacc_code)s;
}};
+let {{
+ predicateTest = 'testPredicate(Cpsr, condCode)'
+}};
+
def template PredOpExecute {{
Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const
{
Fault fault = NoFault;
-
- %(fp_enable_check)s;
%(op_decl)s;
%(op_rd)s;
- %(code)s;
- if (testPredicate(xc->readMiscReg(ArmISA::MISCREG_CPSR), condCode))
+ if (%(predicate_test)s)
{
+ %(fp_enable_check)s;
+ %(code)s;
if (fault == NoFault)
{
%(op_wb)s;
}
}
- else
- return NoFault;
- // Predicated false instructions should not return faults
return fault;
}
}};
def format PredOp(code, *opt_flags) {{
- iop = InstObjParams(name, Name, 'PredOp', code, opt_flags)
+ iop = InstObjParams(name, Name, 'PredOp',
+ {"code": code,
+ "predicate_test": predicateTest},
+ opt_flags)
header_output = BasicDeclare.subst(iop)
decoder_output = BasicConstructor.subst(iop)
decode_block = BasicDecode.subst(iop)
}};
def format PredImmOp(code, *opt_flags) {{
- iop = InstObjParams(name, Name, 'PredImmOp', code, opt_flags)
+ iop = InstObjParams(name, Name, 'PredImmOp',
+ {"code": code,
+ "predicate_test": predicateTest},
+ opt_flags)
header_output = BasicDeclare.subst(iop)
decoder_output = BasicConstructor.subst(iop)
decode_block = BasicDecode.subst(iop)
ccCode = calcCcCode % vars()
code += ccCode;
iop = InstObjParams(name, Name, 'PredImmOp',
- {"code": code, "cc_code": ccCode}, opt_flags)
+ {"code": code,
+ "cc_code": ccCode,
+ "predicate_test": predicateTest},
+ opt_flags)
header_output = BasicDeclare.subst(iop)
decoder_output = BasicConstructor.subst(iop)
decode_block = BasicDecode.subst(iop)
def format PredIntOp(code, *opt_flags) {{
new_code = ArmGenericCodeSubs(code)
- iop = InstObjParams(name, Name, 'PredIntOp', new_code, opt_flags)
+ iop = InstObjParams(name, Name, 'PredIntOp',
+ {"code": new_code,
+ "predicate_test": predicateTest},
+ opt_flags)
header_output = BasicDeclare.subst(iop)
decoder_output = BasicConstructor.subst(iop)
decode_block = BasicDecode.subst(iop)
code += ccCode;
new_code = ArmGenericCodeSubs(code)
iop = InstObjParams(name, Name, 'PredIntOp',
- {"code": new_code, "cc_code": ccCode }, opt_flags)
+ {"code": new_code,
+ "cc_code": ccCode,
+ "predicate_test": predicateTest},
+ opt_flags)
header_output = BasicDeclare.subst(iop)
decoder_output = BasicConstructor.subst(iop)
decode_block = BasicDecode.subst(iop)
# they differ only in the set of code objects contained (which in
# turn affects the object's overall operand list).
iop = InstObjParams(name, Name, base_class,
- { 'ea_code':ea_code, 'memacc_code':memacc_code},
+ {'ea_code': ea_code,
+ 'memacc_code': memacc_code,
+ 'predicate_test': predicateTest},
inst_flags)
ea_iop = InstObjParams(name, Name, base_class,
- { 'ea_code':ea_code },
- inst_flags)
+ {'ea_code': ea_code,
+ 'predicate_test': predicateTest},
+ inst_flags)
memacc_iop = InstObjParams(name, Name, base_class,
- { 'memacc_code':memacc_code},
- inst_flags)
+ {'memacc_code': memacc_code,
+ 'predicate_test': predicateTest},
+ inst_flags)
if mem_flags:
s = '\n\tmemAccessFlags = ' + string.join(mem_flags, '|') + ';'