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

Adding autoname and opt_clean -purge Yosys pass to synth.tcl #183

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

mithro
Copy link
Member

@mithro mithro commented Sep 13, 2023

Fixes #182.

The opt_clean pass removes unused items, the -purge is needed to remove the duplicate private names.

The autoname pass converts the internal _<random number>_ names into something which is a lot more readable (as it is based on the input and outputs).

Before;

  (* src = "adders/top_ff.sv:22.3-23.13" *)
  sky130_fd_sc_hd__dfxtp_1 _47_ (
    .CLK(clk),
    .D(a[8]),
    .Q(a_[8])
  );
  (* src = "adders/top_ff.sv:28.3-29.13" *)
  sky130_fd_sc_hd__dfxtp_1 _48_ (
    .CLK(clk),
    .D(i_[0]),
    .Q(x[0])
  );

image

After;

  (* src = "adders/top_ff.sv:22.3-23.13" *)
  sky130_fd_sc_hd__dfxtp_1 \a__$_DFF_P__Q  (
    .CLK(clk),
    .D(a[8]),
    .Q(a_[8])
  );
  (* src = "top_ff.sv:28.3-29.13" *)
  sky130_fd_sc_hd__dfxtp_1 \x_$_DFF_P__Q_5  (
    .CLK(clk),
    .D(i_[0]),
    .Q(x[0])
  );

image

The [`opt_clean` pass](https://yosyshq.readthedocs.io/projects/yosys/en/latest/cmd/opt_clean.html)
removes unused items, the `-purge` is needed to remove the duplicate private
names.

The [`autoname` pass](https://yosyshq.readthedocs.io/projects/yosys/en/latest/cmd/autoname.html)
converts the internal `_<random number>_` names into something which is a lot
more readable (as it is based on the input and outputs).

Before;
```
  (* src = "adders/top_ff.sv:22.3-23.13" *)
  sky130_fd_sc_hd__dfxtp_1 _47_ (
    .CLK(clk),
    .D(a[8]),
    .Q(a_[8])
  );
  (* src = "adders/top_ff.sv:28.3-29.13" *)
  sky130_fd_sc_hd__dfxtp_1 _48_ (
    .CLK(clk),
    .D(i_[0]),
    .Q(x[0])
  );
```

After;
```
  (* src = "adders/top_ff.sv:22.3-23.13" *)
  sky130_fd_sc_hd__dfxtp_1 \a__$_DFF_P__Q  (
    .CLK(clk),
    .D(a[8]),
    .Q(a_[8])
  );
  (* src = "top_ff.sv:28.3-29.13" *)
  sky130_fd_sc_hd__dfxtp_1 \x_$_DFF_P__Q_5  (
    .CLK(clk),
    .D(i_[0]),
    .Q(x[0])
  );
```

Signed-off-by: Tim Ansell <[email protected]>
@mithro mithro requested a review from QuantamHD September 13, 2023 00:43
@QuantamHD QuantamHD merged commit 21e294b into hdl:main Sep 18, 2023
4 checks passed
@mithro mithro deleted the autoname branch September 18, 2023 20:59
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.

synth.tcl should call autoname function (and opt_clean -purge)
2 participants