-
Notifications
You must be signed in to change notification settings - Fork 23
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
Invalid counter synthesis #2624
Comments
Might be related to #2618 |
I haven't tried exactly this test case, but it also might be related to: chipsalliance/Surelog#3979 If you want to investigate it further, you can add Then you can look at |
@kamilrakoczy, I've added
AST_CONSTANT <./counter.sv:0.0-0.0> [0x55db6df6f210] bits='1111'(4) range=[3:0] int=15
AST_CONSTANT <./counter.sv:0.0-0.0> [0x55db6df6f210] bits='1111'(4) basic_prep range=[3:0] int=15
module counter(clk, rstn, out);
input [0:0] clk;
input [0:0] rstn;
output reg [3:0] out;
always @(posedge 1'(clk))
case (|(!(rstn)))
1'b 1:
out <= 0;
default:
out <= (out)+(4'b 1111);
endcase
endmodule P.S. Should I run Surelog separately to generate UHDM tree? I haven't found a command to dump UHDM tree like in your example using synlig. |
Oh, sorry, I forgot that now we generate UHDM tree in-memory and UHDM dump isn't generated by default. Yes, you need to run Surelog separately to create UHDM file:
after that you can use
I confirmed, that Surelog expands unsized const to
I think, according to standard unsized const should have If you think it is a bug, please report it to Surelog, as I think it is a place where (if required) it should be fixed. |
@kamilrakoczy , thank you! I will report it to Surelog. |
I've found that Synlig, unlike Yosys1, generates an incorrect netlist for simple counter if the increment value is an integer literal constant specified in hexadecimal format without optional size constant.
For example,
out <= out + 'h1
gives wrong result,out <= out + 1'h1
orout <= out + 1
give correct results.I've tested it using Sky130 library. The test example with testbench & syn script: counter.tar.gz (modified version of this example).
Steps to reproduce:
0. Unpack the archive with the test example
tar xzvf counter.tar.gz ./ cd ./counter
1. Original RTL Verilog simulation:
2. Synthesis & simulation
iverilog -g2012 -s tb_counter ./syn/counter.syn.v tb_counter.v ./verilog/primitives.v ./verilog/sky130_fd_sc_hd.v -o counter.syn.out -DFUNCTIONAL -DUNIT_DELAY=#1 mv dump.vcd syn.vcd
4. As you can see, now counter counts in the wrong direction.
Footnotes
If you read input
counter.sv
using Yosysread_verilog -sv
command, generated netlist works & simulates correctly. ↩The text was updated successfully, but these errors were encountered: