rotate instructions now handled in ZBB unit

This commit is contained in:
Kevin Kim 2023-02-18 19:56:54 -08:00
parent e47cc222a6
commit bec2905ee5
2 changed files with 4 additions and 1 deletions

View File

@ -145,7 +145,7 @@ module alu #(parameter WIDTH=32) (
end else assign ZBCResult = 0; end else assign ZBCResult = 0;
if (`ZBB_SUPPORTED) begin: zbb if (`ZBB_SUPPORTED) begin: zbb
zbb #(WIDTH) ZBB(.A(A), .B(B), .W64(W64), .ZBBSelect(ZBBSelect), .ZBBResult(ZBBResult)); zbb #(WIDTH) ZBB(.A(A), .B(B), .ALUResult(ALUResult), .W64(W64), .ZBBSelect(ZBBSelect), .ZBBResult(ZBBResult));
end else assign ZBBResult = 0; end else assign ZBBResult = 0;
// Final Result B instruction select mux // Final Result B instruction select mux
@ -156,6 +156,7 @@ module alu #(parameter WIDTH=32) (
4'b0001: Result = FullResult; 4'b0001: Result = FullResult;
4'b0010: Result = ZBCResult; 4'b0010: Result = ZBCResult;
4'b1000: Result = FullResult; // NOTE: We don't use ALUResult because ZBA instructions don't sign extend the MSB of the right-hand word. 4'b1000: Result = FullResult; // NOTE: We don't use ALUResult because ZBA instructions don't sign extend the MSB of the right-hand word.
4'b0100: Result = ZBBResult;
default: Result = ALUResult; default: Result = ALUResult;
endcase endcase
end else assign Result = ALUResult; end else assign Result = ALUResult;

View File

@ -32,6 +32,7 @@
module zbb #(parameter WIDTH=32) ( module zbb #(parameter WIDTH=32) (
input logic [WIDTH-1:0] A, B, // Operands input logic [WIDTH-1:0] A, B, // Operands
input logic [WIDTH-1:0] ALUResult, // ALU Result
input logic W64, // Indicates word operation input logic W64, // Indicates word operation
input logic [2:0] ZBBSelect, // Indicates word operation input logic [2:0] ZBBSelect, // Indicates word operation
output logic [WIDTH-1:0] ZBBResult); // ZBB result output logic [WIDTH-1:0] ZBBResult); // ZBB result
@ -57,6 +58,7 @@ module zbb #(parameter WIDTH=32) (
//can replace with structural mux by looking at bit 4 in rs2 field //can replace with structural mux by looking at bit 4 in rs2 field
always_comb begin always_comb begin
case (ZBBSelect) case (ZBBSelect)
3'b111: ZBBResult = ALUResult;
/*15'b0010100_101_00111: ZBBResult = OrcBResult; /*15'b0010100_101_00111: ZBBResult = OrcBResult;
15'b0110100_101_11000: ZBBResult = Rev8Result; 15'b0110100_101_11000: ZBBResult = Rev8Result;
15'b0110101_101_11000: ZBBResult = Rev8Result; 15'b0110101_101_11000: ZBBResult = Rev8Result;