diff --git a/rtl/serv_alu.v b/rtl/serv_alu.v index e48812b..d6c2176 100644 --- a/rtl/serv_alu.v +++ b/rtl/serv_alu.v @@ -11,7 +11,7 @@ module serv_alu input wire i_cnt_done, input wire i_sub, input wire [1:0] i_bool_op, - input wire i_cmp_sel, + input wire i_cmp_eq, input wire i_cmp_uns, output wire o_cmp, input wire i_shamt_en, @@ -98,7 +98,7 @@ module serv_alu .o_q (result_lt)); assign plus_1 = i_en & !en_r; - assign o_cmp = (i_cmp_sel == ALU_CMP_EQ) ? result_eq : result_lt; + assign o_cmp = i_cmp_eq ? result_eq : result_lt; localparam [15:0] BOOL_LUT = 16'h8E96;//And, Or, =, xor wire result_bool = BOOL_LUT[{i_bool_op, i_rs1, i_op_b}]; diff --git a/rtl/serv_decode.v b/rtl/serv_decode.v index 28dbf92..8fbb819 100644 --- a/rtl/serv_decode.v +++ b/rtl/serv_decode.v @@ -33,7 +33,7 @@ module serv_decode output wire o_alu_init, output wire o_alu_sub, output wire [1:0] o_alu_bool_op, - output reg o_alu_cmp_sel, + output wire o_alu_cmp_eq, output reg o_alu_cmp_uns, input wire i_alu_cmp, output wire o_alu_shamt_en, @@ -161,14 +161,10 @@ module serv_decode assign o_csr_mcause_en = csr_en & op21 & !op20; - always @(o_funct3, o_rf_rs1_addr, o_ctrl_trap, o_ctrl_mret) begin - casez (o_funct3) - 3'b00? : o_alu_cmp_sel = ALU_CMP_EQ; - 3'b01? : o_alu_cmp_sel = ALU_CMP_LT; - 3'b1?? : o_alu_cmp_sel = ALU_CMP_LT; - default : o_alu_cmp_sel = 1'bx; - endcase + assign o_alu_cmp_eq = o_funct3[2:1] == 2'b00; + + always @(o_funct3, o_rf_rs1_addr, o_ctrl_trap, o_ctrl_mret) begin casez (o_funct3) 3'b00? : o_alu_cmp_uns = 1'b0; 3'b010 : o_alu_cmp_uns = 1'b0; diff --git a/rtl/serv_params.vh b/rtl/serv_params.vh index 8d49c9c..3f74c5e 100644 --- a/rtl/serv_params.vh +++ b/rtl/serv_params.vh @@ -8,20 +8,6 @@ localparam[1:0] ALU_RESULT_LT = 2'd2, ALU_RESULT_BOOL = 2'd3; -localparam [0:0] - ALU_CMP_LT = 1'b0, - ALU_CMP_EQ = 1'b1; - -/* - source - ADD, SUB - SL,SR - SLT - XOR, - OR - AND -*/ - localparam [1:0] CSR_SOURCE_CSR = 2'b00, CSR_SOURCE_EXT = 2'b01, diff --git a/rtl/serv_top.v b/rtl/serv_top.v index 2e61c89..d424845 100644 --- a/rtl/serv_top.v +++ b/rtl/serv_top.v @@ -85,7 +85,7 @@ module serv_top wire alu_init; wire alu_sub; wire [1:0] alu_bool_op; - wire alu_cmp_sel; + wire alu_cmp_eq; wire alu_cmp_uns; wire alu_cmp; wire alu_shamt_en; @@ -161,7 +161,7 @@ module serv_top .o_alu_init (alu_init), .o_alu_sub (alu_sub), .o_alu_bool_op (alu_bool_op), - .o_alu_cmp_sel (alu_cmp_sel), + .o_alu_cmp_eq (alu_cmp_eq), .o_alu_cmp_uns (alu_cmp_uns), .i_alu_cmp (alu_cmp), .o_alu_shamt_en (alu_shamt_en), @@ -260,7 +260,7 @@ module serv_top .i_cnt_done (cnt_done), .i_sub (alu_sub), .i_bool_op (alu_bool_op), - .i_cmp_sel (alu_cmp_sel), + .i_cmp_eq (alu_cmp_eq), .i_cmp_uns (alu_cmp_uns), .o_cmp (alu_cmp), .i_shamt_en (alu_shamt_en),