//Table A-3 Note: "Specific encodings of the hint field are used
//to distinguish JR from JR.HB and JALR from JALR.HB"
- format Unconditional {
+ format Jump {
0x0: decode HINT {
- 0:jr({{ }},IsReturn,IsLink);
- 1:jr_hb({{ }},IsReturn,IsLink);
+ 0:jr({{ NNPC = Rs; }},IsReturn);
+
+ 1:jr_hb({{ NNPC = Rs; clear_exe_inst_hazards(); }},IsReturn);
}
0x1: decode HINT {
- 0: jalr({{ }},'IsCall','IsReturn','IsLink');
- 1: jalr_hb({{ }},IsCall,IsReturn,IsLink);
+ 0: jalr({{ NNPC = Rs; }},IsCall,IsReturn);
+
+ 1: jalr_hb({{ NNPC = Rs; clear_exe_inst_hazards();}},IsCall,IsReturn);
}
}
0x3: movn({{ if (Rt != 0) Rd = Rs; }});
}
-
format WarnUnimpl {
0x4: syscall();//{{ xc->syscall()}},IsNonSpeculative
0x5: break();
}
}
- format Unconditional {
- 0x2: j({{ }});
- 0x3: jal({{ }},IsCall,IsLink);
+ format Jump {
+ 0x2: j({{ NNPC = (NPC & 0xF0000000) & (0x00000000 & JMPTARG << 2);}});
+
+ 0x3: jal({{ NNPC = (NPC & 0xF0000000) & (0x00000000 & JMPTARG << 2);}},IsCall,IsLink);
}
format Branch {
}};
def format Branch(code,*flags) {{
- code = 'bool cond;\n\t' + code + '\n'
-
#Add Link Code if Link instruction
strlen = len(name)
if name[strlen-2:] == 'al':
- code += 'R31 = NPC + 4;\n'
+ code += 'R31 = NNPC;\n'
- # condition code
- code += 'if (cond) {'
- code += ' NPC = NPC + disp;\n'
- code += ' NNPC = NNPC + disp;\n } \n'
+ #Condition code
+ code = 'bool cond;\n' + code
+ code += 'if (cond) {\n'
+ #code += '//NPC=NPC: just placeholder to force parser to writeback NPC\n'
+ #code += ' NPC = NPC; \n'
+ code += ' NNPC = NPC + disp;\n'
+ code += '} \n'
iop = InstObjParams(name, Name, 'Branch', CodeBlock(code),
('IsDirectControl', 'IsCondControl'))
+
header_output = BasicDeclare.subst(iop)
decoder_output = BasicConstructor.subst(iop)
decode_block = BasicDecode.subst(iop)
def format BranchLikely(code,*flags) {{
- code = 'bool cond;\n\t\t\t' + code
-
#Add Link Code if Link instruction
strlen = len(name)
if name[strlen-3:] == 'all':
- code += 'R31 = NPC + 4;\n'
+ code += 'R31 = NNPC;\n'
- #condition code
+ #Condition code
+ code = 'bool cond;\n' + code
code += 'if (cond) {'
- code += ' NPC = NPC + disp;\n'
- code += ' NNPC = NNPC + disp;\n } \n'
+ #code += '//NPC=NPC: just placeholder to force parser to writeback NPC\n'
+ #code += 'NPC = NPC; \n'
+ code += 'NNPC = NPC + disp;\n'
+ code += '} \n'
iop = InstObjParams(name, Name, 'Branch', CodeBlock(code),
('IsDirectControl', 'IsCondControl','IsCondDelaySlot'))
+
header_output = BasicDeclare.subst(iop)
decoder_output = BasicConstructor.subst(iop)
decode_block = BasicDecode.subst(iop)
exec_output = BasicExecute.subst(iop)
}};
-def format Unconditional(code,*flags) {{
- iop = InstObjParams(name, Name, 'Jump', CodeBlock(code),
+def format Jump(code,*flags) {{
+ #Add Link Code if Link instruction
+ strlen = len(name)
+ if strlen >= 3 and name[2:3] == 'al':
+ code = 'R31 = NNPC;\n' + code
+
+ iop = InstObjParams(name, Name, 'Jump', CodeBlock(code),\
('IsIndirectControl', 'IsUncondControl'))
+
header_output = BasicDeclare.subst(iop)
decoder_output = BasicConstructor.subst(iop)
decode_block = BasicDecode.subst(iop)