X-Git-Url: http://git.joshuawise.com/fpgaboy.git/blobdiff_plain/b057a5d6e6db6db06ae33703ca72cd235eec91d6..99b9687942367fd256a797bcd1f67fec07f92a37:/core/insn_incdec_reg8.v diff --git a/core/insn_incdec_reg8.v b/core/insn_incdec_reg8.v index 58582b6..b7ed993 100644 --- a/core/insn_incdec_reg8.v +++ b/core/insn_incdec_reg8.v @@ -1,15 +1,17 @@ +`define INSN_INCDEC_reg8 9'b000xxx10x + `ifdef EXECUTE `INSN_INCDEC_reg8: begin `EXEC_INC_PC `EXEC_NEWCYCLE case (opcode[5:3]) - `INSN_reg_A: tmp <= `_A; - `INSN_reg_B: tmp <= `_B; - `INSN_reg_C: tmp <= `_C; - `INSN_reg_D: tmp <= `_D; - `INSN_reg_E: tmp <= `_E; - `INSN_reg_H: tmp <= `_H; - `INSN_reg_L: tmp <= `_L; + `INSN_reg_A: tmp <= `_A + (opcode[0] ? 8'hFF : 8'h01); + `INSN_reg_B: tmp <= `_B + (opcode[0] ? 8'hFF : 8'h01); + `INSN_reg_C: tmp <= `_C + (opcode[0] ? 8'hFF : 8'h01); + `INSN_reg_D: tmp <= `_D + (opcode[0] ? 8'hFF : 8'h01); + `INSN_reg_E: tmp <= `_E + (opcode[0] ? 8'hFF : 8'h01); + `INSN_reg_H: tmp <= `_H + (opcode[0] ? 8'hFF : 8'h01); + `INSN_reg_L: tmp <= `_L + (opcode[0] ? 8'hFF : 8'h01); endcase end `endif @@ -17,18 +19,19 @@ `ifdef WRITEBACK `INSN_INCDEC_reg8: begin case (opcode[5:3]) - `INSN_reg_A: `_A <= tmp + (opcode[0] ? 8'hFF : 8'h01); - `INSN_reg_B: `_B <= tmp + (opcode[0] ? 8'hFF : 8'h01); - `INSN_reg_C: `_C <= tmp + (opcode[0] ? 8'hFF : 8'h01); - `INSN_reg_D: `_D <= tmp + (opcode[0] ? 8'hFF : 8'h01); - `INSN_reg_E: `_E <= tmp + (opcode[0] ? 8'hFF : 8'h01); - `INSN_reg_H: `_H <= tmp + (opcode[0] ? 8'hFF : 8'h01); - `INSN_reg_L: `_L <= tmp + (opcode[0] ? 8'hFF : 8'h01); + `INSN_reg_A: `_A <= tmp; + `INSN_reg_B: `_B <= tmp; + `INSN_reg_C: `_C <= tmp; + `INSN_reg_D: `_D <= tmp; + `INSN_reg_E: `_E <= tmp; + `INSN_reg_H: `_H <= tmp; + `INSN_reg_L: `_L <= tmp; endcase `_F <= { - ((tmp + (opcode[0] ? 8'hFF : 8'h01)) == 8'h00) ? 1'b1 : 1'b0, - 1'b0, - (({1'b0,tmp[3:0]} + (opcode[0] ? 5'h1F : 5'h01)) >> 4) ? 1'b1 : 1'b0, - `_F[4:0]}; + (tmp == 8'h00) ? 1'b1 : 1'b0, /* Z */ + opcode[0], /* N */ + (tmp[3:0] == (opcode[0] ? 4'hF : 4'h0)) ? 1'b1 : 1'b0, + `_F[4:0] + }; end `endif