]> Joshua Wise's Git repositories - fpgaboy.git/blobdiff - core/insn_call-callcc.v
Move the core to core/
[fpgaboy.git] / core / insn_call-callcc.v
diff --git a/core/insn_call-callcc.v b/core/insn_call-callcc.v
new file mode 100644 (file)
index 0000000..a446a3d
--- /dev/null
@@ -0,0 +1,44 @@
+`ifdef EXECUTE
+       `INSN_CALL,`INSN_CALLCC: begin
+               case (cycle)
+               0:      begin
+                               `EXEC_INC_PC
+                               `EXEC_READ(`_PC + 1)
+                       end
+               1:      begin
+                               `EXEC_INC_PC
+                               `EXEC_READ(`_PC + 1)
+                       end
+               2:      begin
+                               `EXEC_INC_PC
+                               if (!opcode[0]) // i.e., is callcc
+                                       /* We need to check the condition code to bail out. */
+                                       case (opcode[4:3])
+                                       `INSN_cc_NZ:    if (`_F[7]) `EXEC_NEWCYCLE
+                                       `INSN_cc_Z:     if (~`_F[7]) `EXEC_NEWCYCLE
+                                       `INSN_cc_NC:    if (`_F[4]) `EXEC_NEWCYCLE
+                                       `INSN_cc_C:     if (~`_F[4]) `EXEC_NEWCYCLE
+                                       endcase
+                       end
+               3:      `EXEC_WRITE(`_SP - 1, `_PCH)
+               4:      `EXEC_WRITE(`_SP - 2, `_PCL)
+               5:      `EXEC_NEWCYCLE
+               endcase
+       end
+`endif
+
+`ifdef WRITEBACK
+       `INSN_CALL,`INSN_CALLCC: begin
+               case (cycle)
+               0:      begin /* type F */ end
+               1:      tmp <= rdata;   // tmp contains newpcl
+               2:      tmp2 <= rdata;  // tmp2 contains newpch
+               3:      begin /* type F */ end
+               4:      `_PCH <= tmp2;
+               5:      begin
+                               `_PCL <= tmp;
+                               `_SP <= `_SP - 2;
+                       end
+               endcase
+       end
+`endif
This page took 0.024485 seconds and 4 git commands to generate.