3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-31 23:34:57 +00:00

cxxrtl: WIP: adjust comb display cells to only fire on change

Naming and use of statics to be possibly revised.
This commit is contained in:
Charlotte 2023-06-28 11:51:30 +10:00 committed by Marcelina Kościelnicka
parent 7f7c61c9f0
commit 843ad9331b
8 changed files with 95 additions and 16 deletions

24
tests/fmt/always_comb.v Normal file
View file

@ -0,0 +1,24 @@
module top(input clk);
reg a = 0;
reg b = 0;
wire y;
sub s (.a(a), .b(b), .y(y));
always @(posedge clk) begin
a <= (!a && !b) || (a && !b);
b <= (a && !b) || (a && b);
end
endmodule
module sub(input a, input b, output wire y);
assign y = a & b;
// Not fit for our purposes: always @* if (a) $display(a, b, y);
//
// We compare output against iverilog, but async iverilog $display fires
// even before values have propagated -- i.e. combinations of a/b/y will be
// shown where a & b are both 1, but y has not yet taken the value 1. We
// don't, so we specify it in the conditional.
always @* if (y & (y == (a & b))) $display(a, b, y);
endmodule