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

netgen doesn't handle attributes correctly or escapes inside escapes. #82

Open
d-m-bailey opened this issue Sep 4, 2023 · 2 comments
Open

Comments

@d-m-bailey
Copy link
Contributor

Netgen 1.5.253

Sky130 MPW-4 Slot-029 coriolis_test_soc_-_mpw4

  1. (* ... *) denotes attributes in verilog that various tools can use as needed. In netgen, they should probably be treated as comments.
    This verilog
/* Generated by Yosys 0.12+1 (git sha1 0417528ff, clang 13.0.0 -fPIC -Os) */

(* \amaranth.hierarchy  = "user_project_core_lambdasoc" *)
(* top =  1  *)
(* generator = "Amaranth" *)
(* src = "build/sky130/top.v:22213.1-22612.10" *)
module user_project_core_lambdasoc_cts(io_out, io_oeb, io_in, vccd1, vssd1);

yields

Expected to find instance pin block but got "="
Expected to find end of instance but got ""user_project_core_lambdasoc""
line number 3 = '(* \amaranth.hierarchy  = "user_project_core_lambdasoc" *)'
Warning:  Cell (* has no pins
Creating placeholder cell definition for module (*.
Note:  Implicit pin (no pins) in instance \amaranth.hierarchy  of (* in cell user_project_core_lambdasoc.v
Expected to find instance pin block but got "top"
Expected to find end of instance but got "="
line number 4 = '(* top =  1  *)'
Warning:  Cell *) has no pins
Creating placeholder cell definition for module *).
Note:  Implicit pin (no pins) in instance (* of *) in cell user_project_core_lambdasoc.v
Expected to find instance pin block but got "(*"
Expected to find end of instance but got "generator"
...
  1. Removing the attributes. Uncovers another problem.
Badly formed subcircuit pin line at "[0]"
Expected to find end of instance but got ")"
line number 54517 = '  );'
Error:  Verilog backslash-escaped name does not end with a space.

Looking at line 54517

  nand2_x0 \$abc$109383$auto$blifparse.cc:381:parse_blif$110323  ( .vss(vssd1), .vdd(vccd1),
    .i0(\$abc$109383$new_n15674_ ),
    .i1(\$abc$109383$new_n15609_ ),
    .nq(\$\soc.cpu.minerva.gprf.mem._mem$rdreg[1]$d [0])
  );

There is a variable with 2 \ that seems to be causing a problem. Changing \$\soc to \$soc solves the problem. Maybe netgen does not process \ inside escaped variables (variables that start with \) correctly.

test_netgen.tgz

To reproduce:

tar xzf test_netgen.tgz
cd test_netgen
netgen -batch source lvs.script  # original file with all errors
netgen -batch source lvs.script.fix1  # attributes removed
netgen -batch source lvs.script.fix2  # attributes and double \ removed

Note: vdd and vss instance connections have been added to the original verilog files.

@RTimothyEdwards
Copy link
Owner

@d-m-bailey : Fixed in version 1.5.258.

@RTimothyEdwards
Copy link
Owner

@d-m-bailey : Thank you for the test case. It was pretty easy to track down the two places where the errors are happening.

RTimothyEdwards added a commit that referenced this issue Sep 5, 2023
response to Mitch Bailey's github issue #82:

(1) When skipping comments, skip the contents of "(* ... *)"
    delimiters as well as "/* ... */" delimiters.

(2) When checking for qflow's "\abcd\" names (final space
    replaced with a backslash for SPICE compatibility of
    names), make sure that the last "\" is followed by end-
    of-string.  Otherwise names like "\a\bcd " will fail to
    parse correctly.
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

No branches or pull requests

2 participants