-
Notifications
You must be signed in to change notification settings - Fork 8
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
Width cast of expression not propagating #78
Comments
Appears to be a casting issue, as this patch produces identical output in testcase1 / testcase2):
I believe that the constant should be promoted, but I'll check the SV spec to see if yosys is just too generous :) |
Indeed! So far I've found:
I will make a report upstream and/or look for a fix later. |
Thanks! As an additional data point, read_verilog works without the cast so presumably the LHS makes an implicit cast. I thought verilator might have lint problems without the cast, but seems okay with it |
read_verilog and read_slang both, right? So it's only with the cast that there seems to be an issue with yosys-slang |
The text in 1800-2023 about these kinds of casts on p. 140-141 is conflicting to me. First it says
but further down it goes on to say
Still the second quote is more specific, and it's how other tools seem to interpret the cast, so I expect that's the right interpretation. |
EDIT: nope |
That's not what I see. If I read:
and use testcase1.tcl, I get
|
ignore me; you're right. I was looking at stale output. Rerunning, I see correct output. Interestingly, there is a slight difference in the netlist without the cast. read_verilog has the A_WIDTH of the shifter at width=1, whereas read_slang has A_WIDTH at width=8. Probably this will get optimized at a future constant prop pass, but flagging that the internal representation may be different between the two right after reading
|
Hello! I've found an apparent discrepancy in a basic synthesis. This is a minimized testcase when trying to synthesize https://github.com/bespoke-silicon-group/basejump_stl/blob/master/bsg_misc/bsg_decode.sv (in a larger design).
testcase1.tcl uses read_slang whereas testcase2.tcl uses read_verilog. The output is a $shl in both, but the width in the slang version is only a single bit instead of multi-bit. The output width is corrected by 0-padding so there is no warning, but the functionality is broken.
testcase.sv:
testcase1.tcl:
testcase1.out.v:
testcase2.tcl:
testcase2.out.v
diff.txt:
The text was updated successfully, but these errors were encountered: