1 `define INSN_ALU_EXT 9'b100xxxxxx
4 wire [7:0] rlc,rrc,rl,rr,sla,sra,swap,srl;
5 wire [3:0] rlcf,rrcf,rlf,rrf,slaf,sraf,swapf,srlf;
9 assign rlc = {tmp[6:0],tmp[7]};
10 assign rlcf = {(tmp == 0 ? 1'b1 : 1'b0)
14 assign rrc = {tmp[0],tmp[7:1]};
15 assign rrcf = {(tmp == 0 ? 1'b1 : 1'b0),
19 assign rl = {tmp[6:0],`_F[4]};
20 assign rlf = {({tmp[6:0],`_F[4]} == 0 ? 1'b1 : 1'b0),
24 assign rr = {`_F[4],tmp[7:1]};
25 assign rrf = {({`_F[4],tmp[7:1]} == 0 ? 1'b1 : 1'b0),
29 assign sla = {tmp[6:0],1'b0};
30 assign slaf = {(tmp[6:0] == 0 ? 1'b1 : 1'b0),
34 assign sra = {tmp[7],tmp[7:1]};
35 // assign sraf = {(tmp[7:1] == 0 ? 1'b1 : 1'b0),2'b0,tmp[0]}; now in assign srlf =
37 assign swap = {tmp[3:0],tmp[7:4]};
38 assign swapf = {(tmp == 1'b0 ? 1'b1 : 1'b0),
41 assign srl = {1'b0,tmp[7:1]};
42 assign srlf = {(tmp[7:1] == 0 ? 1'b1 : 1'b0),
48 assign {alu_res,f_res} =
51 opcode[3] ? {srl,srlf} : {swap,swapf}
53 opcode[3] ? {sra,sraf} : {sla,slaf}
57 opcode[3] ? {rr,rrf} : {rl,rlf}
59 opcode[3] ? {rrc,rrcf} : {rlc,rlcf}
66 if ((opcode[2:0] == `INSN_reg_dHL) && (cycle == 0))
71 `INSN_reg_A: tmp <= `_A;
72 `INSN_reg_B: tmp <= `_B;
73 `INSN_reg_C: tmp <= `_C;
74 `INSN_reg_D: tmp <= `_D;
75 `INSN_reg_E: tmp <= `_E;
76 `INSN_reg_H: tmp <= `_H;
77 `INSN_reg_L: tmp <= `_L;
78 `INSN_reg_dHL: tmp <= rdata;
86 if (opcode[2:0] == `INSN_reg_dHL) begin
87 if(cycle == 0) begin end
88 else if(cycle == 1) begin
89 `EXEC_WRITE(`_HL, alu_res)
90 `_F <= {f_res,`_F[3:0]};
96 `INSN_reg_B: `_B <= alu_res;
97 `INSN_reg_C: `_C <= alu_res;
98 `INSN_reg_D: `_D <= alu_res;
99 `INSN_reg_E: `_E <= alu_res;
100 `INSN_reg_H: `_H <= alu_res;
101 `INSN_reg_L: `_L <= alu_res;
102 `INSN_reg_A: `_A <= alu_res;
103 `INSN_reg_dHL: begin end /* eat dicks */
105 `_F <= {f_res,`_F[3:0]};