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

Undefined behaviour generated when output is assigned to 0 #139

Open
Hellonity opened this issue Jun 16, 2020 · 1 comment
Open

Undefined behaviour generated when output is assigned to 0 #139

Hellonity opened this issue Jun 16, 2020 · 1 comment

Comments

@Hellonity
Copy link

Steps to reproduce the issue:

Consider the following verilog code.

module demo (output y);
  assign y = 0;
endmodule

when synthesized using

yosys -p 'synth_ice40 -blif demo.blif' demo.v

and the version of Yosys used is

Yosys 0.9+2406 (git sha1 5c426d2b, clang 9.0.0-2 -fPIC -Os)

The output blif is like this

.model demo
.inputs
.outputs y
.names $false
.names $true
1
.names $undef
.names $false y
1 1
.end

Then use arachne-pnr to transform into .asc

arachne-pnr -d 1k  demo.blif -o demo.asc

The arachne-pnr version

arachne-pnr 0.1+328+0 (git sha1 c40fb22, g++ 9.2.1-9ubuntu2 -O2)

And use icebox_vlog to transform back into verilog

icebox_vlog  demo.asc

Expected behavior

It is expected the output is also assigned to be zero like

module chip (output io_11_17_1);

wire io_11_17_1;

wire n2;

assign n2 =  1'b0;
assign io_11_17_1 = n2;

endmodule

The code above is also generated by icebox_vlog but the .asc is now generated by nextpnr instead of arachne-pnr

The commands used are

yosys -p 'synth_ice40 -json demo.json' demo.v
nextpnr-ice40 --hx1k --json demo.json --asc demo.asc
icebox_vlog demo.asc 

Actual behavior

However, arachne-pnr actually leaves the output as a wire. Therefore, this bit is giving undefined behavior during simulation.

module chip (output io_11_17_0);
wire io_11_17_0;
// (11, 17, 'io_0/D_OUT_0')
// (11, 17, 'io_0/PAD')
endmodule
@whitequark
Copy link
Member

Have you read the notice here? https://github.com/YosysHQ/arachne-pnr#arachne-pnr

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