-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected behaviour with asynchronous reset #255
Comments
I'm facing similar issue with version 0.38 on similar code I had to change your verilog to get it to compile with sby module counter(input clk, input rst, output reg [7:0] count);
always @(posedge clk or posedge rst) begin
if (rst)
count <= 0;
else
count <= count + 1;
end
always @(posedge rst)
assert property ( count == 0);
endmodule // counter |
Since your design uses asynchronous logic in the form of async reset, you need to set "multiclock on" in your [options] block. Without multiclock you cannot have different edge-sensitive triggers, i.e. "@(posedge clk)" and "@(posedge rst)". All edge-sensitive triggers must be synchronous to the edge of a single clock (which is the implied global clock). After enabling multiclock, the traces now correctly show the counter being reset to 0. Your assertion still fails, but I think that's because the assertion is allowed to run before the first always block and you maybe want something like |
By the way, why does |
@whitequark |
@jix I see. Can a check be added so that |
So the only thing that That said, as an aside, after having a look at this code I'm a little confused why the original code produces incorrect traces. Surely if yosys basically replaces |
@whitequark One issue is that using I'm not opposed to adding more checks that catch some of the obviously broken cases, e.g. I added one rather limited specific check a while ago (having a posedge and negedge of the same signal in the same module), but I'm sure there is more that can be safely rejected the way things currently work, even if that would still come short of exactly characterizing the supported use cases. Overall, I'm also not at all happy with how multiclock currently works. What I'd really want is to unconditionally have the |
After discussing this with @aiju and having a closer look at the input design and resulting trace I think there's a check that we can add to When the same signal is simultaneously used as a) a clock input of one FF and b) an async reset input of a different FF, the transformation done by |
I am attempting to verify a module with an asynchronous reset, and sby is giving me a counterexample trace that does not seem to match with what I get when simulating with icarus verilog.
counter.sv
counter.sby
The symbiyosys trace: trace.vcd.gz
I would expect the
rst
signal to always reset the counter, but the trace from sby shows it having no effect when anrst
andclk
edge arrive at the same time. Attempting to replicate this in simulation (using icarus verilog) showsrst
behaving as expected (resetting the counter) rather that what sby shows.The text was updated successfully, but these errors were encountered: