Line 47... |
Line 47... |
`DEC_ZP,`DEC_ZPX,`DEC_ABS,`DEC_ABSX: begin res8 <= b8 - 8'd1; wdat <= {4{b8-8'd1}}; wadr <= radr; wadr2LSB <= radr2LSB; state <= STORE1; end
|
`DEC_ZP,`DEC_ZPX,`DEC_ABS,`DEC_ABSX: begin res8 <= b8 - 8'd1; wdat <= {4{b8-8'd1}}; wadr <= radr; wadr2LSB <= radr2LSB; state <= STORE1; end
|
endcase
|
endcase
|
end
|
end
|
else begin
|
else begin
|
case(ir[7:0])
|
case(ir[7:0])
|
/* The following handled in the DECODE stage which reduces the CPI at a cost of clock frequency.
|
//The following handled in the DECODE stage which reduces the CPI at a cost of clock frequency.
|
`RR:
|
`RR:
|
case(ir[23:20])
|
case(ir[23:20])
|
`ADD_RR: res <= a + b;
|
// `ADD_RR: res <= a + b;
|
`SUB_RR: res <= a - b; // Also CMP
|
// `SUB_RR: res <= a - b; // Also CMP
|
`AND_RR: res <= a & b; // Also BIT
|
// `AND_RR: res <= a & b; // Also BIT
|
`OR_RR: res <= a | b;
|
// `OR_RR: res <= a | b;
|
`EOR_RR: res <= a ^ b;
|
// `EOR_RR: res <= a ^ b;
|
`MUL_RR: prod <= a * b; // slows the whole core down
|
// `MUL_RR: prod <= a * b; // slows the whole core down
|
endcase*/
|
`ASL_RRR: res <= shlo;
|
`ADD_IMM8,`ADD_IMM16,`ADD_IMM32,`ADD_ZPX,`ADD_IX,`ADD_IY,`ADD_ABS,`ADD_ABSX,`ADD_RIND: begin res <= a + b; end
|
`LSR_RRR: res <= shro;
|
`SUB_IMM8,`SUB_IMM16,`SUB_IMM32,`SUB_ZPX,`SUB_IX,`SUB_IY,`SUB_ABS,`SUB_ABSX,`SUB_RIND: begin res <= a - b; end // Also CMP
|
endcase
|
`AND_IMM8,`AND_IMM16,`AND_IMM32,`AND_ZPX,`AND_IX,`AND_IY,`AND_ABS,`AND_ABSX,`AND_RIND: begin res <= a & b; end // Also BIT
|
`ADD_ZPX,`ADD_IX,`ADD_IY,`ADD_ABS,`ADD_ABSX,`ADD_RIND: begin res <= a + b; end
|
`OR_IMM8,`OR_IMM16,`OR_IMM32,`OR_ZPX,`OR_IX,`OR_IY,`OR_ABS,`OR_ABSX,`OR_RIND: begin res <= a | b; end // Also LD
|
`SUB_ZPX,`SUB_IX,`SUB_IY,`SUB_ABS,`SUB_ABSX,`SUB_RIND: begin res <= a - b; end // Also CMP
|
`EOR_IMM8,`EOR_IMM16,`EOR_IMM32,`EOR_ZPX,`EOR_IX,`EOR_IY,`EOR_ABS,`EOR_ABSX,`EOR_RIND: begin res <= a ^ b; end
|
`AND_ZPX,`AND_IX,`AND_IY,`AND_ABS,`AND_ABSX,`AND_RIND: begin res <= a & b; end // Also BIT
|
|
`OR_ZPX,`OR_IX,`OR_IY,`OR_ABS,`OR_ABSX,`OR_RIND: begin res <= a | b; end // Also LD
|
|
`EOR_ZPX,`EOR_IX,`EOR_IY,`EOR_ABS,`EOR_ABSX,`EOR_RIND: begin res <= a ^ b; end
|
`LDX_ZPY,`LDX_ABS,`LDX_ABSY: begin res <= b; end
|
`LDX_ZPY,`LDX_ABS,`LDX_ABSY: begin res <= b; end
|
`LDY_ZPX,`LDY_ABS,`LDY_ABSX: begin res <= b; end
|
`LDY_ZPX,`LDY_ABS,`LDY_ABSX: begin res <= b; end
|
`CPX_IMM32,`CPX_ZPX,`CPX_ABS: begin res <= x - b; end
|
`CPX_ZPX,`CPX_ABS: begin res <= x - b; end
|
`CPY_IMM32,`CPY_ZPX,`CPY_ABS: begin res <= y - b; end
|
`CPY_ZPX,`CPY_ABS: begin res <= y - b; end
|
`ASL_RR: begin res <= {a,1'b0}; end
|
`ASL_IMM8: res <= shlo;
|
`ROL_RR: begin res <= {a,cf}; end
|
`LSR_IMM8: res <= shro;
|
`LSR_RR: begin res <= {a[0],1'b0,a[31:1]}; end
|
//The following handled in the DECODE stage which reduces the CPI at a cost of clock frequency.
|
`ROR_RR: begin res <= {a[0],cf,a[31:1]}; end
|
// `ASL_RR: begin res <= {a,1'b0}; end
|
|
// `ROL_RR: begin res <= {a,cf}; end
|
|
// `LSR_RR: begin res <= {a[0],1'b0,a[31:1]}; end
|
|
// `ROR_RR: begin res <= {a[0],cf,a[31:1]}; end
|
`ASL_ZPX,`ASL_ABS,`ASL_ABSX: begin res <= {b,1'b0}; wdat <= {b,1'b0}; wadr <= radr; wadr2LSB <= radr2LSB; state <= STORE1; end
|
`ASL_ZPX,`ASL_ABS,`ASL_ABSX: begin res <= {b,1'b0}; wdat <= {b,1'b0}; wadr <= radr; wadr2LSB <= radr2LSB; state <= STORE1; end
|
`ROL_ZPX,`ROL_ABS,`ROL_ABSX: begin res <= {b,cf}; wdat <= {b,cf}; wadr <= radr; wadr2LSB <= radr2LSB; state <= STORE1; end
|
`ROL_ZPX,`ROL_ABS,`ROL_ABSX: begin res <= {b,cf}; wdat <= {b,cf}; wadr <= radr; wadr2LSB <= radr2LSB; state <= STORE1; end
|
`LSR_ZPX,`LSR_ABS,`LSR_ABSX: begin res <= {b[0],1'b0,b[31:1]}; wdat <= {b[0],1'b0,b[31:1]}; wadr <= radr; wadr2LSB <= radr2LSB; state <= STORE1; end
|
`LSR_ZPX,`LSR_ABS,`LSR_ABSX: begin res <= {b[0],1'b0,b[31:1]}; wdat <= {b[0],1'b0,b[31:1]}; wadr <= radr; wadr2LSB <= radr2LSB; state <= STORE1; end
|
`ROR_ZPX,`ROR_ABS,`ROR_ABSX: begin res <= {b[0],cf,b[31:1]}; wdat <= {b[0],cf,b[31:1]}; wadr <= radr; wadr2LSB <= radr2LSB; state <= STORE1; end
|
`ROR_ZPX,`ROR_ABS,`ROR_ABSX: begin res <= {b[0],cf,b[31:1]}; wdat <= {b[0],cf,b[31:1]}; wadr <= radr; wadr2LSB <= radr2LSB; state <= STORE1; end
|
`INC_ZPX,`INC_ABS,`INC_ABSX: begin res <= b + 1; wdat <= b + 1; wadr <= radr; wadr2LSB <= radr2LSB; state <= STORE1; end
|
`INC_ZPX,`INC_ABS,`INC_ABSX: begin res <= b + 1; wdat <= b + 1; wadr <= radr; wadr2LSB <= radr2LSB; state <= STORE1; end
|