amaranth
amaranth copied to clipboard
vendor.lattice_machxo_2_3l: fix sdc generation
This PR fixes both issues reported in #546 . Probably there is a similiar issue for ecp5 and ice40 since they both use synplify.
Codecov Report
Attention: 3 lines in your changes are missing coverage. Please review.
Comparison is base (
05ac367) 87.15% compared to head (50de645) 87.11%.
| Files | Patch % | Lines |
|---|---|---|
| amaranth/build/plat.py | 0.00% | 3 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #547 +/- ##
==========================================
- Coverage 87.15% 87.11% -0.04%
==========================================
Files 41 41
Lines 7427 7430 +3
Branches 1767 1767
==========================================
Hits 6473 6473
- Misses 778 780 +2
- Partials 176 177 +1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Why not use tcl_quote?
I thought that this way it is more clear that we are working around a bug here. But I can change that.
Also if we simply chain tcl_escape and tcl_quote, we end up transforming \ to \\\\
That function is also for working around a similar issue in Vivado...
So is it safe to just use tcl_quote even if it doesnt escape { and }?
Yes, tcl_escape and tcl_quote are mutually exclusive and they have the same function.
Please do the same for (at least) ECP5, though if you have iCECube, then iCE40 as well, and verify that it works.
Should I do it as part of this pr?
Yup.
What we need here is actually really something different than tcl_quote. It seems like synplify really expects the net to be wrapped in curly braces but escaped as if they were wrapped in quotation marks. Just using tcl_quote doesnt work :(.
Ok well that's horrible (and explains why I couldn't get it right several times already...) In that case please add sdc_quote or something like that. (I strongly suspect this requirement is exclusive to sdc files, though it's been a while since I experimented with this stuff.)
@anuejn Have you had a chance to give this another look?
sorry for the long delay. the code I pushed now seems to work for me.
I don't believe this PR fixes the issue it claims to fix. I still get this error:
@W: MT548 :"/home/whitequark/Projects/amaranth/build/top.sdc":2:0:2:0|Source for clock clk not found in netlist.
I've cherry-picked 306eb7e33abf550cd6684a2410b6bea82f38e874 into https://github.com/amaranth-lang/amaranth/pull/1177 (iCE40 needs the same fix, I think).
I'm going to close this PR in favor of that one since the sdc_quote function introduced here doesn't fix the bug and it also doesn't make any sense to me that it would, given Tcl quoting rules. Note that #1177 also changes quoting in a different way (to only use "" strings) which may or may not be a part of the solution.