Because each instruction is 2 bytes (16 bits), the PC increments by 2, not 1. This is a common pitfall for beginners.
8'h02: begin // ADD (ACC + XREG) alu_sel = 3'b000; // ADD operation reg_write = 1'b1; reg_sel = 2'b00; next_state = FETCH; end 8-bit microprocessor verilog code
4'b0010: begin // ADD A, B reg_sel_a <= 2'b00; reg_sel_b <= 2'b01; alu_op <= 3'b000; state <= EXECUTE; end Because each instruction is 2 bytes (16 bits),
Building a functional 8-bit microprocessor requires several distinct hardware blocks, typically following the Harvard or Von Neumann architecture . the PC increments by 2
4'b0011: begin // SUB A, B reg_sel_a <= 2'b00; reg_sel_b <= 2'b01; alu_op <= 3'b001; state <= EXECUTE; end
Result at address 0xFF: 8