This patch fixes bug 97
Instead of throwing an illegal instruction exception when the rotate
instructions are disabled (OR1200_ALU_IMPL_ROTATE is undefined), another
instruction (slr?) is executed instead.
Not sure if GCC emits l.rori instructions and none of our testcases seems to
exercise it either, which might be the reason why this hasn't been detected
before. I created a new testcase to check the l.rori instructions, and added
it to the bug report until we have a common tests repository.
With the old code I get these results:
--OR1200_IMPL_ALU_ROTATE undefined:
report(0x00000007);
exit(7)
--OR1200_IMPL_ALU_ROTATE defined:
report(0x80000003);
exit(0)
--OR1200_IMPL_ALU_ROTATE undefined:
Illegal instruction!
exit(10)
--OR1200_IMPL_ALU_ROTATE defined:
report(0x80000003);
exit(0)
Index: rtl/verilog/or1200_ctrl.v
===================================================================
--- rtl/verilog/or1200_ctrl.v (revision 852)
+++ rtl/verilog/or1200_ctrl.v (working copy)
@@ -698,7 +698,9 @@
`ifdef OR1200_MULT_IMPLEMENTED
`OR1200_OR32_MULI,
`endif
+`ifdef OR1200_IMPL_ALU_ROTATE
`OR1200_OR32_SH_ROTI,
+`endif
`OR1200_OR32_SFXXI,
`OR1200_OR32_MTSPR,
`ifdef OR1200_MAC_IMPLEMENTED
@@ -810,11 +812,11 @@
`OR1200_OR32_MULI:
alu_op <= `OR1200_ALUOP_MUL;
`endif
-
+`ifdef OR1200_IMPL_ALU_ROTATE
// Shift and rotate insns with immediate
`OR1200_OR32_SH_ROTI:
alu_op <= `OR1200_ALUOP_SHROT;
-
+`endif
// SFXX insns with immediate
`OR1200_OR32_SFXXI:
alu_op <= `OR1200_ALUOP_COMP;
@@ -1008,9 +1010,10 @@
`endif
// Shift and rotate insns with immediate
+`ifdef OR1200_IMPL_ALU_ROTATE
`OR1200_OR32_SH_ROTI:
rfwb_op <= {`OR1200_RFWBOP_ALU, 1'b1};
-
+`endif
// ALU instructions except the one with immediate
`OR1200_OR32_ALU:
rfwb_op <= {`OR1200_RFWBOP_ALU, 1'b1};
_______________________________________________
OpenRISC mailing list
[email protected]
http://lists.openrisc.net/listinfo/openrisc