Skip to content
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

write_verilog: emit $check cell names as labels #4877

Merged
merged 2 commits into from
Jan 30, 2025

Conversation

rroohhh
Copy link
Contributor

@rroohhh rroohhh commented Jan 30, 2025

Right now assert/assume/cover cell labels get parsed as the cell name of the $check cell, but the verilog backend does not use that information again.

This now emits public names again as labels in the verilog backend.

Running the following script:

read -sv -formal <<EOF
module test();
    always test : assert(1);
endmodule
EOF
prep -top test
write_verilog

used to result in

(* keep =  1  *)
(* hdlname = "test" *)
(* top =  1  *)
(* src = "<<EOF:1.1-3.10" *)
module test();
  (* src = "<<EOF:2.9-2.25" *)
  wire test_EN;
  always @*
    if (1'h1) begin
      assert (1'h1);
    end
  assign test_EN = 1'h1;
endmodule

and with this change results in

(* keep =  1  *)
(* hdlname = "test" *)
(* top =  1  *)
(* src = "<<EOF:1.1-3.10" *)
module test();
  (* src = "<<EOF:2.9-2.25" *)
  wire test_EN;
  always @*
    if (1'h1) begin
      test: assert (1'h1);
    end
  assign test_EN = 1'h1;
endmodule

backends/verilog/verilog_backend.cc Outdated Show resolved Hide resolved
Copy link
Member

@whitequark whitequark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@whitequark whitequark merged commit 0ab1392 into YosysHQ:main Jan 30, 2025
25 checks passed
@whitequark
Copy link
Member

Let me know if you want a bump of amaranth-yosys with this commit included.

@rroohhh rroohhh deleted the assert_label branch January 30, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants