Closed flaviens closed 1 year ago
Thank you for sharing this issue! I'm glad to hear you've been able to work around it.
I believe sv2v's behavior can be improved here. The illegal output is generated because:
axi_demux
have type parameters that default to logic
. However, these modules are invalid when instantiated with their default type parameters.I see a few different ways to address this:
--top
parameter to sv2v. In this case, removing uninstantiated modules except ariane_mem_top
fixes the issue, shrinks the output, and speeds up conversion a bit. This flag could lend itself to a nice workflow: pass everything into sv2v, specify your top module (like you would downstream), and get exactly the output you need. This may not be clear to users, however.I've greatly appreciated your input on past issues. Can you share your thoughts on the above?
Hi Zach! Thank you for looking into it! Indeed there seems to be no perfect solution that would fit all cases. imo the --top flag (whose potential confusion could be alleviated by another flag name, but I have no great suggestion on top of my head ^^') seems to be the most reasonable alternative, even though arguably this could be considered not to be the job of sv2v. One could argue that it's not great if some other source code uses the big Verilog file as a kind of module library, but kn general this is already problematic as soon as there are module parameters. I agree with your last point as well. We cannot hope to enforce (even very reasonable) "sv2v best practices" everywhere and forever and should probably minimally rely on them.
Also, this issue seems to be a rare issue that is fairly easy to solve without sv2v modifications. While it would be nice, maybe resolving it is not worth your time at this point.
Thank you for your feedback! In 911243dac428c3145ac68e12a3f56bc5b8db58f7, I added a --top
flag which can filter modules in the intuitive way (e.g., -s
in iverilog). When using --top ariane_mem_top
on your original test case, the invalid modules are filtered away. This may be a nice flag to use in general: on your test case, the conversion is about 30% faster and the output is nearly 50% shorter.
Thanks! That looks great! I think it resolves the issue, I'll close it :+1:
Hi Zach!
I'm trying to bring the following sv file into yosys: ariane_pickled.zip.
sv2v does not complain (the
-E
flag does not seem to influence here) but Yosys says the following:The problem seems related to a cast with casts inside:
I'm using the newest versions of both sv2v and yosys.
EDIT: I resolved the issue by refactoring code but it may still be an interesting point.
How would you recommend solving this problem? Thanks!