Closed TheMatt2 closed 1 year ago
@Nic30 , any comment on how to handle this?
Update: The issue mentioned below does not exist. I am currently missing the instance name for dummy
module instantiated.
While trying to add this feature, I actually found another related issue.
For the following code example.v
:
module dummy(c, a, b);
output c;
input a, b;
assign c = a & b;
endmodule
module example (a, b, c, d);
input a, b, c;
output d;
wire tmp;
wire tmp2;
and a1 (tmp, a, b);
dummy(tmp2, b, c);
or o1 (d, tmp, tmp2);
endmodule
I am observing the following Verilog source being generated:
module dummy (
output wire c,
input wire a,
input wire b
);
assign c = a & b;
endmodule
module example (
input wire a,
input wire b,
input wire c,
output wire d
);
wire tmp;
wire tmp2;
and a1 (
tmp,
a,
b
);
or o1 (
d,
tmp,
tmp2
);
endmodule
The dummy
module instance is missing from the example
module.
Used following python source example.py
to generate verilog:
import sys
from hdlConvertorAst.language import Language
from hdlConvertor import HdlConvertor
c = HdlConvertor()
d = c.parse(["example.v"], Language.VERILOG, [], hierarchyOnly=False, debug=True)
# Convert to HDL
from hdlConvertorAst.to.verilog.verilog2005 import ToVerilog2005
tv = ToVerilog2005(sys.stdout)
tv.visit_HdlContext(d)
The PR #176 , has this particular test added. And it seems to be working, after providing the instance name it is part of the Generated Verilog Source.
HdlConvertor seems to throw and warning and not successfully parse structural verilog code.
The problem seems to appear in statements such as:
This is defined to be valid in IEEE 1800-2017, Section 28.4 "and, nand, nor, or, xor, and xnor gates" (page 803?)
Steps to Reproduce
An example code that will demonstrate the issue.
This can then be loaded and run with this Python code.
This shows the error message:
The parsed value can be returned by running this Python code:
Which prints the coverted Verilog code.
The
and
andor
definitions are now missing.By looking at the JSON, it seems the assignments are missing from parsed output.
You can see the
tmp
declaration, but there is nothing else here. This is where I expect the assignment to be (I'm new, I could be wrong).I trying to analyze some Verilog code, and unfortunate this issue is preventing the analysis from working correctly. hdlConvertor was installed via pip3 on Ubuntu.