whitequark changed the topic of #amaranth-lang to: Amaranth hardware definition language · weekly meetings on Mondays at 1700 UTC · code https://github.com/amaranth-lang · logs https://libera.irclog.whitequark.org/amaranth-lang
Degi_ has joined #amaranth-lang
Degi has quit [Ping timeout: 256 seconds]
Degi_ is now known as Degi
FFY00_ has joined #amaranth-lang
FFY00 has quit [Ping timeout: 240 seconds]
bl0x_ has joined #amaranth-lang
bl0x has quit [Ping timeout: 240 seconds]
Degi has quit [Quit: ZNC 1.7.5+deb4 - https://znc.in]
Degi has joined #amaranth-lang
bl0x has joined #amaranth-lang
bl0x_ has quit [Ping timeout: 265 seconds]
urja has quit [Read error: Connection reset by peer]
urja has joined #amaranth-lang
<_whitenotifier-8> [rfcs] whitequark commented on pull request #10: Move `Repl` to `Value.replicate` - https://github.com/amaranth-lang/rfcs/pull/10#issuecomment-1543992521
<d1b2> <Olivier Galibert> Hmmm, what's recommended for n-way one-hot Mux?
<_whitenotifier-8> [amaranth] whitequark opened issue #770: Implement RFC 10: Move `Repl` to `Value.replicate` - https://github.com/amaranth-lang/amaranth/issues/770
<d1b2> <Olivier Galibert> aka x.eq((a1 & Repl(en1, 8)) | (a2 & Repl(en2, 8)) | (...) | (an & Repl(~(en1|en2|...)))
<_whitenotifier-8> [amaranth-lang/rfcs] whitequark pushed 2 commits to main [+2/-0/±0] https://github.com/amaranth-lang/rfcs/compare/460fd984bf04...632560717252
<_whitenotifier-8> [amaranth-lang/rfcs] whitequark 466a16f - RFC: Move `Repl` to `Value.replicate`
<_whitenotifier-8> [amaranth-lang/rfcs] whitequark 6325607 - Merge RFC #10: Move `Repl` to `Value.replicate`
<_whitenotifier-8> [rfcs] whitequark closed pull request #10: Move `Repl` to `Value.replicate` - https://github.com/amaranth-lang/rfcs/pull/10
<_whitenotifier-8> [amaranth-lang/amaranth-lang.github.io] whitequark pushed 1 commit to main [+1/-0/±10] https://github.com/amaranth-lang/amaranth-lang.github.io/compare/2d69340183d1...4767344e7309
<_whitenotifier-8> [amaranth-lang/amaranth-lang.github.io] whitequark 4767344 - Deploying to main from @ amaranth-lang/rfcs@632560717252abeb275b80d50ccd2552783635b3 🚀
<_whitenotifier-8> [rfcs] whitequark commented on pull request #9: Constant initialization for shape-castable objects - https://github.com/amaranth-lang/rfcs/pull/9#issuecomment-1544004647
<_whitenotifier-8> [amaranth] whitequark opened issue #771: Implement RFC 9: Constant initialization for shape-castable objects - https://github.com/amaranth-lang/amaranth/issues/771
<_whitenotifier-8> [amaranth-lang/rfcs] whitequark pushed 2 commits to main [+2/-0/±0] https://github.com/amaranth-lang/rfcs/compare/632560717252...47d49effe8b7
<_whitenotifier-8> [amaranth-lang/rfcs] whitequark 2d3b0d3 - RFC: Constant initialization for shape-castable objects
<_whitenotifier-8> [amaranth-lang/rfcs] whitequark 47d49ef - Merge RFC #9: Constant initialization for shape-castable objects
<_whitenotifier-8> [rfcs] whitequark closed pull request #9: Constant initialization for shape-castable objects - https://github.com/amaranth-lang/rfcs/pull/9
<_whitenotifier-8> [amaranth-lang/amaranth-lang.github.io] whitequark pushed 1 commit to main [+1/-0/±11] https://github.com/amaranth-lang/amaranth-lang.github.io/compare/4767344e7309...80360a7cb200
<_whitenotifier-8> [amaranth-lang/amaranth-lang.github.io] whitequark 80360a7 - Deploying to main from @ amaranth-lang/rfcs@47d49effe8b739e4f8facffa8984f3c47ffcb259 🚀
<jfng[m]> <d1b2> "<Olivier Galibert> Hmmm, what'..." <- i'd use something like this:... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/0425bd73d9ada54eed28b4379fc0393e51b3a5b8>)
<_whitenotifier-8> [amaranth] whitequark opened issue #772: Implement RFC 8: Aggregate data structure extensibility - https://github.com/amaranth-lang/amaranth/issues/772
<whitequark> github is really struggling today huh
<whitequark> (gives me 500's)
<FL4SHK> hm, that's not good
<_whitenotifier-8> [amaranth-lang/rfcs] whitequark pushed 1 commit to main [+0/-0/±1] https://github.com/amaranth-lang/rfcs/compare/096c78d4f15f...04b2370973eb
<_whitenotifier-8> [amaranth-lang/rfcs] whitequark 04b2370 - Describe the process for RFC postponement.
<_whitenotifier-8> [rfcs] whitequark closed pull request #8: Aggregate data structure extensibility - https://github.com/amaranth-lang/rfcs/pull/8
<_whitenotifier-8> [rfcs] whitequark commented on pull request #11: Minimal type annotation support - https://github.com/amaranth-lang/rfcs/pull/11#issuecomment-1544033757
<_whitenotifier-8> [rfcs] whitequark closed pull request #11: Minimal type annotation support - https://github.com/amaranth-lang/rfcs/pull/11
<_whitenotifier-8> [rfcs] whitequark commented on pull request #7: Const-castable Amaranth value to Python value conversions - https://github.com/amaranth-lang/rfcs/pull/7#issuecomment-1544039044
<_whitenotifier-8> [amaranth-lang/amaranth-lang.github.io] whitequark pushed 1 commit to main [+1/-0/±12] https://github.com/amaranth-lang/amaranth-lang.github.io/compare/80360a7cb200...dec4385b3913
<_whitenotifier-8> [amaranth-lang/amaranth-lang.github.io] whitequark dec4385 - Deploying to main from @ amaranth-lang/rfcs@04b2370973eb3d7f54561df12145a7c53166f60a 🚀
<d1b2> <Olivier Galibert> Records are also on the chopping block
<whitequark> re: one-hot mux
<whitequark> I'd probably use an Array([a, b, c])[sel.find_first_one()]... except we don't have an ff1 operation
<jfng[m]> .find_first_one() would be equivalent to using a priority encoder ?
<whitequark> oh yeah
<d1b2> <Olivier Galibert> How do I tell the synth that I'm sure there wont be two active at the same time so that it doesn't route more than necessary?
<d1b2> <Olivier Galibert> at least or-of-and isn't perfect but trees relatively easily
<whitequark> you can't do this in Amaranth
<whitequark> (intentionally)
<whitequark> hm, so if the invariant is that it's exactly one hot (or at most one hot), then you can do..
<whitequark> oh, nevermind, I was about to suggest the exact same thing jfng said, but in slightly different words
<whitequark> that produces the best RTL you can get in Amaranth
<whitequark> I'm not actually sure if you can do better in Verilog
<mwk> Verilog would use parallel_case casez with selects like 5'???1?
<whitequark> oh yeah, but in this specific case, |([x,y,z]&repl([selx,sely,selz])) is probably the optimal RTL
<mwk> (or without parallel_case, you can do a lot of one-hot selects, plus assign all-x in the default)
<whitequark> so having 'x doesn't help you get better
<mwk> quite possibly, yes
<mwk> it may unlock more optimizations somewhere?
<whitequark> mhm, true
<d1b2> <Olivier Galibert> that muxing is currently my only use of Repl. I'm always annoying by principle when doing the same thing ends ups using longer words 🙂
<d1b2> <Olivier Galibert> but it looks like the Repl-and or the pileof-Mux with zero (which is ugly too) is the best solution
<d1b2> <Olivier Galibert> I wonder if my use of that is specific of my reimplementation of nmos/cmos circuits, or if it's really often useful in "normal" designs.
<whitequark> no, that sort of thing is fairly common. it's used in amaranth-soc already
<d1b2> <Olivier Galibert> Would a one-hot-select top level function make sense then?
<whitequark> absolutely not, let's not add more stuff to the prelude
<whitequark> it already has too much
<d1b2> <Olivier Galibert> ok
<d1b2> <Olivier Galibert> couldn't be an override of Mux, e.g. give it 2n+1 parameters for any n>=1 instead of always 3?
<d1b2> <Olivier Galibert> extension more than override
<whitequark> I don't think that's a good idea either
<whitequark> it's another case where one is overly focusing on some very specific use case and making it expressible in a concise way, but not necessarily noticing that this adds cognitive burden on everyone reading any use of Mux
<d1b2> <Olivier Galibert> Yeah
<d1b2> <Olivier Galibert> of course Mux itself is (b & a.replicate(b.shape)) | (c & (~a).replicate(b.shape)), but writing Mux is nice. I wonder where the line should be. Good thing I'm not the one who has to decide 🙂
<d1b2> <Olivier Galibert> (b.shape is subtly incorrect, but we all know that)
<whitequark> Mux is actually a primitive
<whitequark> it's lowered by the backend directly to a $mux cell if we're talking about yosys
<whitequark> and you end up with a?b:c in verilog
<whitequark> Repl is also a primitive, which could be used to output a {n{v}} construct in Verilog, but because it roundtrips through Yosys it doesn't happen
<whitequark> and also any half-decently written backend should automatically detect replications anyway
<d1b2> <Olivier Galibert> hopefully 🙂
<d1b2> <Olivier Galibert> of course I could always write (b & a) | (c & ~a) if I make a signed(1)
<d1b2> <Olivier Galibert> but now that would be kinda horrible
<d1b2> <Olivier Galibert> subtletly is amusing but Bad in practice
<whitequark> what would be?
<d1b2> <Olivier Galibert> using the sign-extension to have an automatically sized replication done
<whitequark> huh? I don't understand where sign extension comes in
<whitequark> oh, the Matrix bridge has dropped a message
<d1b2> <Olivier Galibert> og
<d1b2> <Olivier Galibert> oh
<d1b2> <Olivier Galibert> I understand your reaction then 🙂
<whitequark> that's a little cursed but I guess it works?
<whitequark> it's explicitly specified to do what you want
<d1b2> <Olivier Galibert> yeah, taht's the problem, it works. I'm old enough to know it's not a good idea, maintainability-wise though
<d1b2> <Olivier Galibert> 20 years ago I would probably have done it 🙂
<d1b2> <Olivier Galibert> It’s interesting that rtlil has an explicit Mux, because from what I see it’s not really a hardware primitive, at least since cmos
<whitequark> it's for optimization
<whitequark> also there's patterns that need to be inferred from input Verilog and you recognize those by looking at $mux and $pmux (which is just Verilog if much of the time)
<d1b2> <Olivier Galibert> Oh, it’s very verilog then
pbsds has quit [Ping timeout: 240 seconds]
pbsds has joined #amaranth-lang
lf has quit [Ping timeout: 240 seconds]
lf has joined #amaranth-lang