Implemented BIT $n, r

First of the CB prefixed opcodes.
This commit is contained in:
2021-02-19 21:53:13 +00:00
parent 8c65e4a669
commit 93912e2089
5 changed files with 59 additions and 26 deletions

View File

@@ -9,6 +9,7 @@ module alu (
input logic alu_op_valid_i,
input alu_op_t alu_op_i,
input logic [7:0] operand_i,
input logic [2:0] inx8_i, // Only used for bit/set/res
input alu16_op_t alu16_op_i,
input logic [15:0] inx16_i,
@@ -31,6 +32,9 @@ module alu (
logic [ 7:0] a_xor;
logic [ 7:0] f_xor;
logic [ 7:0] a_bit; // Never written, only to test
logic [ 7:0] f_bit;
logic [16:0] out16_add;
logic [ 7:0] f16_add;
logic [15:0] out16_inc;
@@ -41,15 +45,19 @@ module alu (
assign a_we = alu_op_valid_i;
assign a_next = (alu_op_i == ALU_OP_XOR) ? a_xor :
a_xor;
a_r;
assign f_we = alu_op_valid_i;
assign f_next = (alu_op_i == ALU_OP_XOR) ? f_xor :
f_xor;
(alu_op_i == ALU_OP_BIT) ? f_bit :
f_r;
assign a_xor = (a_r ^ operand_i);
assign f_xor = {~(|a_xor), 3'b0, f_r[3:0]};
assign a_bit = (operand_i - {4'b0, inx8_i});
assign f_bit = {~(|a_bit), 2'b10, f_r[4:0]};
assign out16_dec = (inx16_i - 16'h01);
assign a_o = a_r;