mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Reordered Zicond support in ALU
This commit is contained in:
parent
a17204b0fe
commit
3ad815ce34
@ -61,6 +61,21 @@ module alu import cvw::*; #(parameter cvw_t P) (
|
|||||||
assign CondMaskInvB = SubArith ? ~CondMaskB : CondMaskB;
|
assign CondMaskInvB = SubArith ? ~CondMaskB : CondMaskB;
|
||||||
assign {Carry, Sum} = CondShiftA + CondMaskInvB + {{(P.XLEN-1){1'b0}}, SubArith};
|
assign {Carry, Sum} = CondShiftA + CondMaskInvB + {{(P.XLEN-1){1'b0}}, SubArith};
|
||||||
|
|
||||||
|
// Zicond block conditionally zeros B
|
||||||
|
if (P.ZICOND_SUPPORTED) begin: zicond
|
||||||
|
logic BZero;
|
||||||
|
|
||||||
|
assign BZero = (B == 0); // check if rs2 = 0
|
||||||
|
// Create a signal that is 0 when czero.* instruction should clear result
|
||||||
|
// If B = 0 for czero.eqz or if B != 0 for czero.nez
|
||||||
|
always_comb
|
||||||
|
case (CZero)
|
||||||
|
2'b01: ZeroCondMaskInvB = {P.XLEN{~BZero}}; // czero.eqz: kill if B = 0
|
||||||
|
2'b10: ZeroCondMaskInvB = {P.XLEN{BZero}}; // czero.nez: kill if B != 0
|
||||||
|
default: ZeroCondMaskInvB = CondMaskInvB; // otherwise normal behavior
|
||||||
|
endcase
|
||||||
|
end else assign ZeroCondMaskInvB = CondMaskInvB; // no masking if Zicond is not supported
|
||||||
|
|
||||||
// Shifts (configurable for rotation)
|
// Shifts (configurable for rotation)
|
||||||
shifter #(P) sh(.A, .Amt(B[P.LOG_XLEN-1:0]), .Right(Funct3[2]), .W64, .SubArith, .Y(Shift), .Rotate(BALUControl[2]));
|
shifter #(P) sh(.A, .Amt(B[P.LOG_XLEN-1:0]), .Right(Funct3[2]), .W64, .SubArith, .Y(Shift), .Rotate(BALUControl[2]));
|
||||||
|
|
||||||
@ -105,18 +120,4 @@ module alu import cvw::*; #(parameter cvw_t P) (
|
|||||||
assign CondShiftA = A;
|
assign CondShiftA = A;
|
||||||
end
|
end
|
||||||
|
|
||||||
// Zicond block
|
|
||||||
if (P.ZICOND_SUPPORTED) begin: zicond
|
|
||||||
logic BZero;
|
|
||||||
|
|
||||||
assign BZero = (B == 0); // check if rs2 = 0
|
|
||||||
// Create a signal that is 0 when czero.* instruction should clear result
|
|
||||||
// If B = 0 for czero.eqz or if B != 0 for czero.nez
|
|
||||||
always_comb
|
|
||||||
case (CZero)
|
|
||||||
2'b01: ZeroCondMaskInvB = {P.XLEN{~BZero}}; // czero.eqz: kill if B = 0
|
|
||||||
2'b10: ZeroCondMaskInvB = {P.XLEN{BZero}}; // czero.nez: kill if B != 0
|
|
||||||
default: ZeroCondMaskInvB = CondMaskInvB; // otherwise normal behavior
|
|
||||||
endcase
|
|
||||||
end else assign ZeroCondMaskInvB = CondMaskInvB; // no masking if Zicond is not supported
|
|
||||||
endmodule
|
endmodule
|
||||||
|
Loading…
Reference in New Issue
Block a user