addrCalcImm = 'EA = Rs1 + imm;'
iop = InstObjParams(name, Name, 'Mem',
{"code": code, "postacc_code" : postacc_code,
- "fault_check": faultCode, "ea_code": addrCalcReg}, opt_flags)
+ "fault_check": faultCode, "ea_code": addrCalcReg,
+ "EA_trunc": TruncateEA}, opt_flags)
iop_imm = InstObjParams(name, Name + "Imm", 'MemImm',
{"code": code, "postacc_code" : postacc_code,
- "fault_check": faultCode, "ea_code": addrCalcImm}, opt_flags)
+ "fault_check": faultCode, "ea_code": addrCalcImm,
+ "EA_trunc": TruncateEA}, opt_flags)
header_output = MemDeclare.subst(iop) + MemDeclare.subst(iop_imm)
decoder_output = BasicConstructor.subst(iop) + BasicConstructor.subst(iop_imm)
decode_block = ROrImmDecode.subst(iop)
iop = InstObjParams(name, Name, 'BlockMem',
{"code": pcedCode, "ea_code": addrCalcReg,
"fault_check": faultCode, "micro_pc": microPc,
- "set_flags": flag_code}, opt_flags)
+ "set_flags": flag_code, "EA_trunc" : TruncateEA},
+ opt_flags)
iop_imm = InstObjParams(name, Name + 'Imm', 'BlockMemImm',
{"code": pcedCode, "ea_code": addrCalcImm,
"fault_check": faultCode, "micro_pc": microPc,
- "set_flags": flag_code}, opt_flags)
+ "set_flags": flag_code, "EA_trunc" : TruncateEA},
+ opt_flags)
decoder_output += BlockMemMicroConstructor.subst(iop)
decoder_output += BlockMemMicroConstructor.subst(iop_imm)
exec_output += doDualSplitExecute(
}
if(storeCond && fault == NoFault)
{
+ %(EA_trunc)s
fault = xc->write((uint%(mem_acc_size)s_t)Mem,
EA, %(asi_val)s, &mem_data);
}
}
if(fault == NoFault)
{
+ %(EA_trunc)s
fault = xc->write((uint%(mem_acc_size)s_t)Mem,
EA, %(asi_val)s, &mem_data);
}
addrCalcReg = 'EA = Rs1;'
iop = InstObjParams(name, Name, 'Mem',
{"code": code, "postacc_code" : postacc_code,
- "fault_check": faultCode, "ea_code": addrCalcReg}, opt_flags)
+ "fault_check": faultCode, "ea_code": addrCalcReg,
+ "EA_trunc" : TruncateEA}, opt_flags)
header_output = MemDeclare.subst(iop)
decoder_output = BasicConstructor.subst(iop)
decode_block = BasicDecode.subst(iop)
microParams = {"code": code, "postacc_code" : postacc_code,
- "ea_code" : addrCalcReg, "fault_check" : faultCode}
+ "ea_code" : addrCalcReg, "fault_check" : faultCode,
+ "EA_trunc" : TruncateEA}
exec_output = doSplitExecute(execute, name, Name, asi,
["IsStoreConditional"], microParams);
return (header_output, decoder_output, exec_output, decode_block)
%(fault_check)s;
if(fault == NoFault)
{
+ %(EA_trunc)s
fault = xc->read(EA, (%(mem_acc_type)s%(mem_acc_size)s_t&)Mem, %(asi_val)s);
}
if(fault == NoFault)
%(fault_check)s;
if(fault == NoFault)
{
+ %(EA_trunc)s
fault = xc->read(EA, (%(mem_acc_type)s%(mem_acc_size)s_t&)Mem, %(asi_val)s);
}
return fault;
}
if(storeCond && fault == NoFault)
{
+ %(EA_trunc)s
fault = xc->write((%(mem_acc_type)s%(mem_acc_size)s_t)Mem,
EA, %(asi_val)s, 0);
}
}
if(storeCond && fault == NoFault)
{
+ %(EA_trunc)s
fault = xc->write((%(mem_acc_type)s%(mem_acc_size)s_t)Mem,
EA, %(asi_val)s, 0);
}
fault = new PrivilegedAction;
'''
+ TruncateEA = '''
+#if !FULL_SYSTEM
+ EA = Pstate<3:> ? EA<31:0> : EA;
+#endif
+ '''
}};
//A simple function to generate the name of the macro op of a certain
(eaRegCode, nameReg, NameReg),
(eaImmCode, nameImm, NameImm)):
microParams = {"code": code, "postacc_code" : postacc_code,
- "ea_code": eaCode, "fault_check": faultCode}
+ "ea_code": eaCode, "fault_check": faultCode,
+ "EA_trunc" : TruncateEA}
executeCode += doSplitExecute(execute, name, Name,
asi, opt_flags, microParams)
return executeCode
//From the SPARC ABI
- //The process runs in user mode
- threadContexts[0]->setMiscReg(MISCREG_PSTATE, 0x02);
+ //The process runs in user mode with 32 bit addresses
+ threadContexts[0]->setMiscReg(MISCREG_PSTATE, 0x0a);
//Setup default FP state
threadContexts[0]->setMiscRegNoEffect(MISCREG_FSR, 0);