YosysHQ / yosys

Yosys Open SYnthesis Suite
https://yosyshq.net/yosys/
ISC License
3.42k stars 872 forks source link

Appearance of `ifnone` in specify blocks crashes Verilog frontend #1719

Open thasti opened 4 years ago

thasti commented 4 years ago

While reading a verilog library with specify-blocks, yosys crashes on constructs such as the following:

    if (...) (B => Z) = (...);
    ifnone (B => Z) = (0, 0);

The error message is the following, with the line number corresponding to the line containing ifnone.

ERROR: syntax error, unexpected '='

It appears to me the ifnone-condition is not modeled in the verilog parser.

Ravenslofty commented 4 years ago

cc @eddiehung

eddiehung commented 4 years ago

Currently, ifnone is not a supported construct. A temporary workaround would be to rewrite as:

if (<condition>) (B => Z) = (...);
// ifnone (B => Z) = (0, 0);
if (!<condition>) (B => Z) = (0, 0);

I'll have a think about and discuss a more permanent solution.

mbiewlanz commented 3 years ago

Is there any script which edits "specify" blocks replacing `ifnone statement with equivalent "if" condition?

Thanks in advance!