amaranth icon indicating copy to clipboard operation
amaranth copied to clipboard

vendor.lattice_machxo_2_3l: fix sdc generation

Open anuejn opened this issue 5 years ago • 14 comments

This PR fixes both issues reported in #546 . Probably there is a similiar issue for ecp5 and ice40 since they both use synplify.

anuejn avatar Nov 19 '20 23:11 anuejn

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.

codecov[bot] avatar Nov 19 '20 23:11 codecov[bot]

Why not use tcl_quote?

whitequark avatar Nov 20 '20 12:11 whitequark

I thought that this way it is more clear that we are working around a bug here. But I can change that.

anuejn avatar Nov 20 '20 12:11 anuejn

Also if we simply chain tcl_escape and tcl_quote, we end up transforming \ to \\\\

anuejn avatar Nov 20 '20 12:11 anuejn

That function is also for working around a similar issue in Vivado...

whitequark avatar Nov 20 '20 12:11 whitequark

So is it safe to just use tcl_quote even if it doesnt escape { and }?

anuejn avatar Nov 20 '20 12:11 anuejn

Yes, tcl_escape and tcl_quote are mutually exclusive and they have the same function.

whitequark avatar Nov 20 '20 13:11 whitequark

Please do the same for (at least) ECP5, though if you have iCECube, then iCE40 as well, and verify that it works.

whitequark avatar Nov 20 '20 16:11 whitequark

Should I do it as part of this pr?

anuejn avatar Nov 20 '20 16:11 anuejn

Yup.

whitequark avatar Nov 20 '20 17:11 whitequark

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 :(.

anuejn avatar Nov 22 '20 19:11 anuejn

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.)

whitequark avatar Nov 23 '20 01:11 whitequark

@anuejn Have you had a chance to give this another look?

whitequark avatar Dec 28 '20 06:12 whitequark

sorry for the long delay. the code I pushed now seems to work for me.

anuejn avatar Dec 31 '20 15:12 anuejn

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.

whitequark avatar Feb 29 '24 19:02 whitequark

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.

whitequark avatar Feb 29 '24 19:02 whitequark