Skip to content

Can I translate Structural Verilog to JSON with no optimizations? #3338

Answered by nakengelhardt
bkushigian asked this question in Q&A
Discussion options

You must be logged in to vote

Verilog is unfortunately the representation that is the furthest away from Yosys' internal representation (RTLIL), so there are more places for both the frontend and the backend to introduce differences. This would probably be much more likely to work if you were able to use RTLIL or JSON for the round-trip, but it seems that's not a possibility for your use case.

But generally, the shortest script to get json from a verilog file would be:

read_verilog out.sv
hierarchy -top example
proc
write_json out2.json

If your out.sv is actually structural, i.e. does not contain any always blocks, there is some chance that this will not be too far from the out.json of your first script. However, wri…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bkushigian
Comment options

Answer selected by bkushigian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants