whitequark[cis] changed the topic of #amaranth-lang to: Amaranth hardware definition language · weekly meetings: Amaranth each Mon 1700 UTC, Amaranth SoC each Fri 1700 UTC · code https://github.com/amaranth-lang · logs https://libera.irclog.whitequark.org/amaranth-lang · Matrix #amaranth-lang:matrix.org
lf_ has quit [Ping timeout: 246 seconds]
lf has joined #amaranth-lang
notgull has joined #amaranth-lang
nfbraun has quit [Quit: leaving]
jjsuperpower has quit [Ping timeout: 264 seconds]
jjsuperpower has joined #amaranth-lang
jjsuperpower has quit [Ping timeout: 276 seconds]
notgull has quit [Ping timeout: 256 seconds]
notgull has joined #amaranth-lang
notgull has quit [Ping timeout: 264 seconds]
notgull has joined #amaranth-lang
nak has quit [Ping timeout: 264 seconds]
nak has joined #amaranth-lang
notgull has quit [Ping timeout: 268 seconds]
GenTooMan has quit [Ping timeout: 276 seconds]
<_whitenotifier-5> [amaranth] anuejn commented on pull request #514: Individual Pin Inversion - https://github.com/amaranth-lang/amaranth/pull/514#issuecomment-1937019340
<anuejn> whitequark[cis]: now that I am looking at prs that are laying around: there is https://github.com/amaranth-lang/amaranth/pull/547
<anuejn> I think it just needs someone testing it for ice40
<whitequark[cis]> oh yeah!
<anuejn> I posted a testcase under the PR but I do not have Icecube and thus did not do the changes for ice40
<anuejn> if you have that installed and feel like it, it would be nice if you could do that
<_whitenotifier-7> [amaranth] whitequark commented on pull request #514: Individual Pin Inversion - https://github.com/amaranth-lang/amaranth/pull/514#issuecomment-1937021040
<whitequark[cis]> ah yeah, I can schedule it for 0.5
<whitequark[cis]> I do have every toolchain installed
<anuejn> thats nice :)
<whitequark[cis]> but I want you to rebase it first
<anuejn> 547?
<anuejn> I can do that :)
<anuejn> done :)
<whitequark[cis]> thanks
<whitequark[cis]> so my main objection to this PR is still that you have "sdc_quote" in build.plat that has a generic name but refers to lattice diamond
<anuejn> ah I see
<whitequark[cis]> can you find and collate the quoting rules for Synplify and Tcl in general, and include them in the PR?
<whitequark[cis]> then, since every platform that has SDC files will follow Synplify rules, you can safely replace tcl_quote with sdc_quote there
<whitequark[cis]> it's the same codebase reading it after all
<whitequark[cis]> then I'll be able to test it and approve if it all works
<whitequark[cis]> tbf, we should probably have LatticePlatform and SiliconBluePlatform, aliased to the MachXO*/ECP5 and iCE40 families respectievly
<whitequark[cis]> actually
<whitequark[cis]> anuejn: can't we entirely replace tcl_quote with sdc_quote?
<whitequark[cis]> because, I think, the curly braces thing creates valid tcl strings
<anuejn> I actually have no idea about tcl at all
<whitequark[cis]> lemme look at the rules for tcl quoting
<anuejn> and just figured this out by twiddling the knobs until it works
<whitequark[cis]> ok, well, that's not the type of PR i generally accept
<anuejn> so I feel a bit overwhelmed 🙈
<whitequark[cis]> because it usually just shifts fragility from one place to another
<anuejn> okay I can understand that. Still it feels nice to have the bug fixed (or at least documented)
<whitequark[cis]> I don't tend to document bugs either; if you understand enough to document it you understand enough to fix it
<whitequark[cis]> this is different from many popular projects but I want a higher bar in the software I maintain
<whitequark[cis]> it's actually oddly difficult to find the docs for string quoting
<anuejn> yes :D
* anuejn is currently doing the same
<whitequark[cis]> it looks like inside {}, you shouldn't be escaping anything but }
<whitequark[cis]> oh, actually, { too
<whitequark[cis]> ```
<whitequark[cis]> % puts {{\n\r\""}}
<whitequark[cis]> {\n\r\""}
<whitequark[cis]> and escaping the backslash, except one that's right before a { or }, is actually wrong
<whitequark[cis]> interestingly, if you put a backslash before {, you get a \{ combo within the resulting string
<whitequark[cis]> % puts {{\\\n\r\"" \}\{\[[1+2]}}
<whitequark[cis]> {\\\n\r\"" \}\{\[[1+2]}
<whitequark[cis]> I think I should just read the source code
<whitequark[cis]> so it seems to parse the backslash escape sequence and then just append them as-is, except for the case of \newline
<whitequark[cis]> and it appears outright impossible to write an unbalanced } inside of a {} string?
<whitequark[cis]> that's bizarre
<Wanda[cis]> oh. yeah. tcl.
<Wanda[cis]> dear gods.
<Wanda[cis]> sigh, so
<Wanda[cis]> in tcl, {} is kinda meant for use as a code block, so it doesn't really do escaping
<Wanda[cis]> (since this is tcl, code blocks are, in fact, strings passed to the for command or whatever)
<Wanda[cis]> it cannot do escaping by design, because then you'd get progressively more insane escape sequences inside deeply nested code blocks
<whitequark[cis]> so i know how tcl works, but i never thought exactly how you'd implement escaping
<whitequark[cis]> you are right
<Wanda[cis]> so I think you need "" strings?
<Wanda[cis]> hm
<Wanda[cis]> <del>how bad can the escaping rules be</del>
<whitequark[cis]> we do have "" strings but anuejn concluded they're not properly usable in sdc files for some reason?
<Wanda[cis]> oh.
<Wanda[cis]> oh gods.
<Wanda[cis]> .... it might be easier to just disallow unmatched {}
<whitequark[cis]> but uh
<whitequark[cis]> there's not many choices if we want to escape [] because it makes gtkwave and friends go instane
<whitequark[cis]> or like, toolchains
<whitequark[cis]> * there's not many choices if we want to escape [] because it makes gtkwave and friends go insane
<whitequark[cis]> iirc quartus would segfault if you had a () where it didn't expect it? might've been another brace
<whitequark[cis]> we could use canadian aboriginal syllabics i guess
<anuejn> my problem was specifically with $ in clock domain names
<whitequark[cis]> the \$ must get escaped in "" strings
<Wanda[cis]> ... may I propose a perfect solution
<whitequark[cis]> and i think we do do that?
<whitequark[cis]> ... hm
<Wanda[cis]> hm
<Wanda[cis]> this is actually not the insane mangling that I was thinking of
<Wanda[cis]> I recall seeing something worse in yosys code
<whitequark[cis]> ... go on
<whitequark[cis]> i want my daily dose of self-harm
<anuejn> whitequark[cis]: but that did not work last time I checked with lattice tiamond
<whitequark[cis]> did not work in what way?
<Wanda[cis]> I think for self-harm you'd need to find it yourself?
<whitequark[cis]> self-harm through others (advanced tactic)
<anuejn> in this testcase, the clock was not constrained 2Mhz with upstream amaranth
<whitequark[cis]> ok, i see
<whitequark[cis]> Wanda: wanna take a look at why?
<Wanda[cis]> hm?
<Wanda[cis]> why what?
<whitequark[cis]> anuejn: at why this fails
<anuejn> do you think, they use a real tcl interpreter for the sdc files?
<Wanda[cis]> I don't think I have the requisite toolchain installed
<whitequark[cis]> anuejn: yes
<whitequark[cis]> xilinx uses a parser for xdc files, but not sdc
<whitequark[cis]> Wanda: ah hm
<whitequark[cis]> let me just give you a shell
notgull has joined #amaranth-lang
notgull has quit [Ping timeout: 240 seconds]
notgull has joined #amaranth-lang
notgull has quit [Ping timeout: 272 seconds]
vegard_e[m] has quit [Quit: Idle timeout reached: 172800s]
GenTooMan has joined #amaranth-lang
jjsuperpower has joined #amaranth-lang
josuah has joined #amaranth-lang
<tpw_rules> whitequark[cis]: if you are around: https://github.com/YosysHQ/yosys/pull/4199
<whitequark[cis]> huh, yosys does have macos runners
<tpw_rules> quite possibly homebrew or something installs its own tail
<whitequark[cis]> i was more thinking about /tmp
<tpw_rules> oh, that i just changed cause was right there and i've been bitten by similar in the past. it works on my machine right now
<whitequark[cis]> ah
<_whitenotifier-5> [amaranth] whitequark opened issue #1100: Refactor `back.rtlil` to convert Amaranth IR structures to Yosys IR structures - https://github.com/amaranth-lang/amaranth/issues/1100