From 2ccbde9d09932384bd02b15f04603b3c33cf0c1d Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Fri, 17 Feb 2023 21:58:49 -0800 Subject: [PATCH] configured shifter in alu --- src/ieu/alu.sv | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ieu/alu.sv b/src/ieu/alu.sv index d880e6535..fa5df225f 100644 --- a/src/ieu/alu.sv +++ b/src/ieu/alu.sv @@ -75,6 +75,10 @@ module alu #(parameter WIDTH=32) ( endcase end else assign CondShiftA = A; + if (`ZBB_SUPPORTED) begin: rotatelogic + assign Rotate = BSelect[2] & (ALUSelect == 3'b001); //NOTE: Do we want to move this logic into the Decode Stage? + end else assign Rotate = 1'b0; + // Extract control signals from ALUControl. assign {W64, SubArith, ALUOp} = ALUControl; @@ -83,7 +87,7 @@ module alu #(parameter WIDTH=32) ( assign {Carry, Sum} = CondShiftA + CondInvB + {{(WIDTH-1){1'b0}}, SubArith}; // Shifts - shifter sh(.A, .Amt(B[`LOG_XLEN-1:0]), .Right(Funct3[2]), .Arith(SubArith), .W64, .Y(Shift), .Rotate(1'b0)); + shifter sh(.A, .Amt(B[`LOG_XLEN-1:0]), .Right(Funct3[2]), .Arith(SubArith), .W64, .Y(Shift), .Rotate(Rotate)); // Condition code flags are based on subtraction output Sum = A-B. // Overflow occurs when the numbers being subtracted have the opposite sign