mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-03 10:15:19 +00:00
Cleaned up Zicond implementation
This commit is contained in:
parent
9eb6d9c8b8
commit
d7b016e8f3
@ -101,11 +101,16 @@ module alu import cvw::*; #(parameter cvw_t P) (
|
|||||||
|
|
||||||
// Zicond block
|
// Zicond block
|
||||||
if (P.ZICOND_SUPPORTED) begin: zicond
|
if (P.ZICOND_SUPPORTED) begin: zicond
|
||||||
logic BZero, KillB;
|
logic BZero;
|
||||||
|
|
||||||
assign BZero = (B == 0); // check if rs2 = 0
|
assign BZero = (B == 0); // check if rs2 = 0
|
||||||
// Create a signal that is 0 when czero.* instruction should clear result
|
// 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
|
// If B = 0 for czero.eqz or if B != 0 for czero.nez
|
||||||
assign KillB = BZero & CZero[0] | ~BZero & CZero[1];
|
always_comb
|
||||||
assign ZeroCondMaskInvB = |CZero ? {P.XLEN{~KillB}} : CondMaskInvB; // extend to full width
|
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
|
end else assign ZeroCondMaskInvB = CondMaskInvB; // no masking if Zicond is not supported
|
||||||
endmodule
|
endmodule
|
||||||
|
Loading…
Reference in New Issue
Block a user