]> Joshua Wise's Git repositories - firearm.git/commitdiff
Add condition checking logic.
authorJoshua Wise <joshua@rebirth.joshuawise.com>
Fri, 26 Dec 2008 10:41:24 +0000 (05:41 -0500)
committerJoshua Wise <joshua@rebirth.joshuawise.com>
Fri, 26 Dec 2008 10:41:24 +0000 (05:41 -0500)
ARM_Constants.v
Issue.v

index 921e6eca747d1fd630315b7eeb0c7adf1162c344..a635c5e8355e7eb3611a43fb14c35208e4713d5a 100644 (file)
 `define SHIFT_LSL 2'b00
 `define SHIFT_LSR 2'b01
 `define SHIFT_ASR 2'b10
-`define SHIFT_ROR 2'b11
\ No newline at end of file
+`define SHIFT_ROR 2'b11
+
+`define CPSR_N 31
+`define CPSR_Z 30
+`define CPSR_C 29
+`define CPSR_V 28
+`define CPSR_I 7
+`define CPSR_F 6
diff --git a/Issue.v b/Issue.v
index a450190c28faa0b7926995e60d90d42adff71438..1dbdc20e662f09d80e1655fc3ffe8c10583eaf1e 100644 (file)
--- a/Issue.v
+++ b/Issue.v
@@ -10,6 +10,7 @@ module Issue(
        input inbubble, /* stage inputs */
        input [31:0] insn,
        input [31:0] inpc,
+       input [31:0] cpsr,
        
        output reg outbubble,   /* stage outputs */
        output reg [31:0] outpc
@@ -230,4 +231,35 @@ module Issue(
                        def_regs = 16'bxxxxxxxxxxxxxxxx;
                end
                endcase
+       
+       /* Condition checking logic */
+       reg condition_met;
+       always @(*)
+               casez(insn[31:28])
+               `COND_EQ:       condition_met = cpsr[`CPSR_Z];
+               `COND_NE:       condition_met = !cpsr[`CPSR_Z];
+               `COND_CS:       condition_met = cpsr[`CPSR_C];
+               `COND_CC:       condition_met = !cpsr[`CPSR_C];
+               `COND_MI:       condition_met = cpsr[`CPSR_N];
+               `COND_PL:       condition_met = !cpsr[`CPSR_N];
+               `COND_VS:       condition_met = cpsr[`CPSR_V];
+               `COND_VC:       condition_met = !cpsr[`CPSR_V];
+               `COND_HI:       condition_met = cpsr[`CPSR_C] && !cpsr[`CPSR_Z];
+               `COND_LS:       condition_met = !cpsr[`CPSR_C] || cpsr[`CPSR_Z];
+               `COND_GE:       condition_met = cpsr[`CPSR_N] == cpsr[`CPSR_V];
+               `COND_LT:       condition_met = cpsr[`CPSR_N] != cpsr[`CPSR_V];
+               `COND_GT:       condition_met = !cpsr[`CPSR_Z] && (cpsr[`CPSR_N] == cpsr[`CPSR_V]);
+               `COND_LE:       condition_met = cpsr[`CPSR_Z] || (cpsr[`CPSR_N] != cpsr[`CPSR_V]);
+               `COND_AL:       condition_met = 1;
+               `COND_NV:       condition_met = 0;
+               default:        condition_met = 1'bx;
+               endcase
+       
+       /* Issue logic */
+       /* reg use_cpsr;
+        * reg [15:0] use_regs;
+        * reg def_cpsr;
+        * reg [15:0] def_regs;
+        */
+       
 endmodule
This page took 0.028173 seconds and 4 git commands to generate.