Move macro defines out to files
[fpgaboy.git] / core / insn_call-callcc.v
CommitLineData
e7fe9dc2
JW
1`define INSN_CALL 9'b011001101
2`define INSN_CALLCC 9'b0110xx100 // Not that call/cc.
3
df770340
JW
4`ifdef EXECUTE
5 `INSN_CALL,`INSN_CALLCC: begin
6 case (cycle)
7 0: begin
5c33c5c0
JW
8 `EXEC_INC_PC
9 `EXEC_READ(`_PC + 1)
df770340
JW
10 end
11 1: begin
5c33c5c0
JW
12 `EXEC_INC_PC
13 `EXEC_READ(`_PC + 1)
df770340
JW
14 end
15 2: begin
5c33c5c0 16 `EXEC_INC_PC
df770340
JW
17 if (!opcode[0]) // i.e., is callcc
18 /* We need to check the condition code to bail out. */
19 case (opcode[4:3])
5c33c5c0
JW
20 `INSN_cc_NZ: if (`_F[7]) `EXEC_NEWCYCLE
21 `INSN_cc_Z: if (~`_F[7]) `EXEC_NEWCYCLE
22 `INSN_cc_NC: if (`_F[4]) `EXEC_NEWCYCLE
23 `INSN_cc_C: if (~`_F[4]) `EXEC_NEWCYCLE
df770340
JW
24 endcase
25 end
5c33c5c0
JW
26 3: `EXEC_WRITE(`_SP - 1, `_PCH)
27 4: `EXEC_WRITE(`_SP - 2, `_PCL)
28 5: `EXEC_NEWCYCLE
df770340
JW
29 endcase
30 end
31`endif
32
33`ifdef WRITEBACK
34 `INSN_CALL,`INSN_CALLCC: begin
35 case (cycle)
36 0: begin /* type F */ end
37 1: tmp <= rdata; // tmp contains newpcl
38 2: tmp2 <= rdata; // tmp2 contains newpch
39 3: begin /* type F */ end
5c33c5c0
JW
40 4: `_PCH <= tmp2;
41 5: begin
42 `_PCL <= tmp;
43 `_SP <= `_SP - 2;
df770340
JW
44 end
45 endcase
46 end
47`endif
This page took 0.029965 seconds and 4 git commands to generate.