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
lf has quit [Ping timeout: 252 seconds]
lf has joined #amaranth-lang
<_whitenotifier-9> [YoWASP/yosys] whitequark pushed 1 commit to develop [+0/-0/±1] https://github.com/YoWASP/yosys/compare/fe89d9675d06...3d25a291cc43
<_whitenotifier-9> [YoWASP/yosys] whitequark 3d25a29 - Update dependencies.
<_whitenotifier-9> [YoWASP/nextpnr] whitequark pushed 1 commit to develop [+0/-0/±1] https://github.com/YoWASP/nextpnr/compare/6040032faace...e8144d583944
<_whitenotifier-9> [YoWASP/nextpnr] whitequark e8144d5 - Update dependencies.
ydnatag has joined #amaranth-lang
bl0x_ has joined #amaranth-lang
bl0x has quit [Ping timeout: 252 seconds]
Degi_ has joined #amaranth-lang
Degi has quit [Ping timeout: 255 seconds]
Degi_ is now known as Degi
ydnatag has quit [Quit: Connection closed for inactivity]
<_whitenotifier-9> [amaranth-boards] neuschaefer opened pull request #214: Add MachXO2 Breakout board - https://github.com/amaranth-lang/amaranth-boards/pull/214
byteit101 has joined #amaranth-lang
<byteit101> I have two questions: 1) is it possible to change state machine states from outside of a state machine, and 2) Is it possible to wire up a reset signal in a submodule to a different signal?
<whitequark> 1) do you mean outside of `with m.FSM():`?
<whitequark> 2. yes; see `ResetInserter()`
<byteit101> I don't see any documentation on that, and this is the ony place I can find usage of that: https://github.com/GlasgowEmbedded/glasgow/blob/main/software/glasgow/gateware/fx2_crossbar.py#L441 How do I use it?
<whitequark> yeah, the documentation is unfortunately not comprehensive at the moment
<byteit101> 1) yes, I have one state machine that I'd like to trigger a second, asynchronous state machine
<whitequark> ResetInserter wraps another module, so instead of m.submodules += foo you would use m.submodules += ResetInserter(new_rst)(foo)
<whitequark> then, you can drive new_rst to reset the flops inside foo
<byteit101> new_rst is the signal? and foo is... ah the submodule?
<whitequark> it doesn't have to be a signal, it's any expression
<whitequark> foo is the submodule, yes
<byteit101> the thing that replaces the reset signal that is
<byteit101> ok
<whitequark> it doesn't replace the reset signal
<whitequark> it adds to it
<byteit101> right
<whitequark> logically OR'd with all the other resets it might have
<whitequark> regarding FSMs, there is an open issue for FSM improvements: https://github.com/amaranth-lang/amaranth/issues/207
<byteit101> yup, makes sense
<whitequark> right now you can only add an intermediate signal and wait on it in the other FSM
<whitequark> or otherwise react to it
<byteit101> Ah, ok
ydnatag has joined #amaranth-lang
<byteit101> side note: I've created a "literal" pre-processor for test benches and elaborations yesterday. ie: transforming python `if foo:` to `with m.If(foo):` and so forth. Is that a sort of thing that would be helpful to others?
<whitequark> it's something that Amaranth is actively avoiding
<whitequark> it's easy to make such a preprocessor; what is hard is making an antiquotation mechanism to enable metaprogramming with it
<whitequark> Amaranth code will always be true Python; an if means a Python if. there's a section of the manual that describes it, but maybe it needs to be expanded to make that explicit https://amaranth-lang.org/docs/amaranth/latest/lang.html#performing-or-describing-computations
<byteit101> fair enough, but this is so much more readable!
<whitequark> what is "readable"?
<byteit101> if's look like an if
<whitequark> I find that having to backtrack to see if an if means one thing or a completely different one makes it hard to read code!
<whitequark> for the same reasons Amaranth doesn't override <=
<byteit101> for heavily metaprogrammed things I could see that
<whitequark> ultimately I think there is a lot of value in simplicity and keeping the heavily metaprogrammed things the same, fundamentally, as the most basic ones
<whitequark> otherwise you end up with people unable to understand the former, if they didn't write it
<whitequark> this is actually an argument against what you're suggesting even if it would have antiquotation
<whitequark> though the lack of antiquotation makes it essentially a non-starter
<byteit101> Don't most metaprogramming/macro systems have the same syntax in both places, C/C++ being a notable exception?
<whitequark> if you consider templates C++'s metaprogramming system then it counts as well
<cr1901> What is antiquotation?
<whitequark> cr1901: do you know what quasiquotation is?
<whitequark> byteit101: anyway, Amaranth isn't a macro system, it's a language embedded in another language
<cr1901> whitequark: I've heard of it from Scheme, but I don't quite understand it.
<whitequark> oh, actually, Python has quasiquotation for strings now
<whitequark> f" is quasiquote, { is antiquote
<whitequark> i.e. an antiquote undoes the quasiquote
<whitequark> and lets you insert code into what is otherwise data
<cr1901> aaaaaaah
<cr1901> interesting :o
<whitequark> you could imagine with amaranth: being a quasiquote, and (something else) being an antiquote, in the same way
<whitequark> except there's no (something else) that would work
<whitequark> or at least, I never found a satisfying option
<cr1901> Btw, what is the character after "imagine"? My client's rendering it as... well garbage, and I assume "Unicode unknown char" is not intended to be amaranth's quasiquote :D
* cr1901 is uploading a screenshot
crzwdjk has joined #amaranth-lang
<whitequark> i have no idea. on the Matrix side it's uh, the markdown for <tt>with amaranth:</tt>
<crzwdjk> It's a u+0011, aka ctrl-q aka DC1 in the archive html
<whitequark> that's interesting
<whitequark> that has absolutely no defined meaning
<cr1901> Yea, that tracks w/ my hexchat buffer too
<whitequark> wait, it's XON?
<whitequark> okay, what the heck is the libera.chat bridge doing
<cr1901> tt is TELETYPE text
<whitequark> yes but why XON
<mwk> I think it's something derived from mIRC color codes?
<mwk> they also use random control chars
<cr1901> Trying to talk to a tty :P
<mwk> ... but irssi doesn't understand it either
<whitequark> oh okay
<mwk> so it's some after-the-fact extension?
<mwk> IIRC ^B was bold
<mwk> yup
<cr1901> ^Btest
<cr1901> test
<cr1901> theeere we go
<mwk> normal way to do markup
<cr1901> Okay, I understand now... anytime I see "11" in the buffer or logs, the following words/context were meant to be a code snippet
<mwk> https://www.mirc.com/help/html/index.html?control_codes.html this is the original list; I have no idea who defined Ctrl-Q, but it'd fit right in
<cr1901> CTRL+Q attempts to quit my client (as is the default keybinding on Windoze)
ydnatag has quit [Quit: Connection closed for inactivity]
<byteit101> What's the default case? m.Case() with no args?
<whitequark> m.Default() is strongly preferred
<byteit101> Ah excellent
Guest7578 has joined #amaranth-lang
<d1b2> <20goto10> Are there any particular areas that contributors can help with the documentation?
Guest7578 has quit [Client Quit]
<whitequark> not at the moment, I think
Guest7535688999 has joined #amaranth-lang
Guest7535688999 has quit [Client Quit]
<byteit101> I would have said FSM and switch/case/default, as those aren't documented in the official documentation at all
<whitequark> yeah. the thing is that i have a specific way in which i want the documentation to be written
<whitequark> this wouldn't normally be a problem but i've also had a chronic pain condition that left me essentially unable to work for three years or so (closer to five realistically)
<whitequark> and communicating exactly what i want to see in the documentation (or code for that matter) is often more work than doing it yourself, which i already can't do