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
nelgau_ has quit [Read error: Connection reset by peer]
nelgau has joined #amaranth-lang
nelgau has quit [Read error: Connection reset by peer]
nelgau has joined #amaranth-lang
adamgreig[m] has quit [Quit: Idle timeout reached: 172800s]
Degi_ has joined #amaranth-lang
SpaceCoaster has quit [Quit: Bye]
Degi has quit [Ping timeout: 255 seconds]
Degi_ is now known as Degi
SpaceCoaster has joined #amaranth-lang
SpaceCoaster has quit [Quit: Bye]
SpaceCoaster has joined #amaranth-lang
<cr1901> whitequark[cis]: If there's a meeting today, I'm unlikely to be there (and presumably Christmas and the next week are off :P)
<whitequark[cis]> yes
ravenslofty[m] has quit [Quit: Idle timeout reached: 172800s]
galibert[m] has quit [Quit: Idle timeout reached: 172800s]
cyrozap_ has quit [Quit: ZNC 1.8.2+deb3.1 - https://znc.in]
cyrozap has joined #amaranth-lang
feldim2425_ has joined #amaranth-lang
feldim2425 has quit [Ping timeout: 268 seconds]
crzwdjk has quit [Ping timeout: 268 seconds]
<whitequark[cis]> I'm going to cancel today's meeting; I think everyone is vying to get to the Christmas holidays
<whitequark[cis]> er
benny2366[m] has joined #amaranth-lang
<benny2366[m]> vying ?
<whitequark[cis]> everyone wants to just get to the part where you celebrate holidays
<whitequark[cis]> rather than be in more meetings
<whitequark[cis]> I think people will probably be drinking on or immediately before January 1st, so the next meeting will be on 8th of January
<benny2366[m]> tbh i would not but hey how
<whitequark[cis]> I wouldn't either but I could use some rest
galibert[m] has joined #amaranth-lang
<galibert[m]> I think postponing until next year is a perfect way to celebrate 0.4
<benny2366[m]> I mean i don't want to participate in the social part of the holidays , the rest part that i would like
<whitequark[cis]> I don't celebrate either Christmas or New Year
<whitequark[cis]> but I know lots of people do
<benny2366[m]> true true
Chips4MakersakaS has joined #amaranth-lang
<Chips4MakersakaS> I vying to go to 37c3.
<zyp[m]> I'm vying to get some more time to spend at the workshop, I ran it with the control loop written in amaranth for the first time yesterday: https://bin.jvnv.net/file/Vcfo3.mp4
<zyp[m]> (it being the robot arm)
<whitequark[cis]> wow, sweet
<whitequark[cis]> spacemouse too
<whitequark[cis]> really cool
vipqualitypost[m has quit [Quit: Idle timeout reached: 172800s]
<_whitenotifier-3> [amaranth] whitequark opened issue #1003: `Value.matches()` should evaluate to 0 and `with Case():` should never be active - https://github.com/amaranth-lang/amaranth/issues/1003
<_whitenotifier-3> [amaranth] whitequark commented on issue #1003: `Value.matches()` should evaluate to 0 and `with Case():` should never be active - https://github.com/amaranth-lang/amaranth/issues/1003#issuecomment-1861360439
jjsuperpower has joined #amaranth-lang
<_whitenotifier-3> [rfcs] wanda-phi opened pull request #39: Add RFC for no-argument `m.Case()` semantic change. - https://github.com/amaranth-lang/rfcs/pull/39
<_whitenotifier-3> [amaranth] whitequark opened pull request #1004: Expand language guide to include all control flow syntax - https://github.com/amaranth-lang/amaranth/pull/1004
<whitequark[cis]> lofty: finally, the `matches()` syntax is described in the docs
<galibert[m]> Catherine: just a suggestion, but what about making Case() and Matches() an error instead of a zero?
<lofty> whitequark[cis]: happy two year anniversary of that issue report
<_whitenotifier-3> [amaranth] codecov[bot] commented on pull request #1004: Expand language guide to include all control flow syntax - https://github.com/amaranth-lang/amaranth/pull/1004#issuecomment-1861610090
<whitequark[cis]> galibert[m]: it's an option, but I think it is useful for generated code
<_whitenotifier-3> [amaranth] whitequark edited pull request #1004: Expand language guide to include all control flow syntax - https://github.com/amaranth-lang/amaranth/pull/1004
<whitequark[cis]> sure
Wanda[cis] has joined #amaranth-lang
<Wanda[cis]> should I throw it in into alternatives section?
<galibert[m]> Generating code was what I wondered about, how high the probability was that it’s an error in the generation instead of what’s intended
<galibert[m]> Because it doesn’t look like a if(false), more like a default, especially in the case case
<lofty> whitequark[cis]: so, I was thinking "since I'm going to get this order wrong, why don't I make a wrapper type called `be_pattern()` or something which reverses the string order" and then I realised that the described semantics would instead try to cast that `be_pattern` to a Value
<lofty> which seems like it'd be a slight issue.
<whitequark[cis]> lofty: `"foo"[::-1]`
<lofty> I am well aware of how to reverse strings, thanks.
<whitequark[cis]> so be_pattern = lambda pattern: pattern[::-1] or something like that
<lofty> Okay, I guess your point is "it can't be a type it has to be a function"
<whitequark[cis]> (people are quite often unaware how to reverse strings in Python specifically)
<whitequark[cis]> (and it wasn't clear what the benefit of be_pattern would be other than reversing the string)
<lofty> Signal(2) and Signal(unsigned(2)) are identical semantically, but one person may prefer the explicitness of `unsigned` over knowing that shapes are unsigned by default
<lofty> something similar with be_pattern was what I had in mind.
<whitequark[cis]> right. that does make sense. however Amaranth doesn't have first-class patterns (we don't have a "pattern-like" definition) so it's not possible
<Wanda[cis]> that'd be an interesting RFC
<Wanda[cis]> anyway, added the "hard error" alternative
<whitequark[cis]> thanks!
<whitequark[cis]> I've wanted proper pattern matching for a while but the question is, how do you bind?
<lofty> ...this is cursed, but since I apparently have your attention
<Wanda[cis]> hmmm.
<whitequark[cis]> with m.Match(struc): with m.Case({ "type": Struc.Type.A, "a": ??? })
<Wanda[cis]> I should look at how the new match construct works in Python, some day
<whitequark[cis]> it's terrible
<Wanda[cis]> but... yeah, will probably be problematic
<lofty> ...functions would probably be too cursed
<whitequark[cis]> no, I've been thinking about adding functions
<Wanda[cis]> a = MatchVar() ; with m.Case({"type": Struct.Type.A, "a": a}): ...?
<whitequark[cis]> we should be able to do it after scopes land
<Wanda[cis]> idfk
<whitequark[cis]> with m.Case(str := Struc.match({ "type": Struct.Type.A }): ?
<whitequark[cis]> and then you can do str.a as usual
<Wanda[cis]> there's also with ... as ..., but ...
<whitequark[cis]> that doesn't let you extract inner bindings
<Wanda[cis]> I have no idea how to wire it well
<Wanda[cis]> yeah
<Wanda[cis]> with m.Case({"type": Struct.Type.A, "a": a := MatchVar()}):
<Wanda[cis]> that'd involve horrifying crimes to get it to work
ravenslofty[m] has joined #amaranth-lang
<ravenslofty[m]> meanwhile I'm sitting in the corner going "`with m.Case("0000 nnnn mmmm 0000", lambda n, m: ...)` would be fine for my use cases"
<ravenslofty[m]> (where the lambda just means "some python function")
<whitequark[cis]> with m.Case("0000 nnnn mmmm 0000") as captures: captures["n"] would work
<whitequark[cis]> it's unclear what v.matches("0000 nnnn mmmm 0000") should return
<whitequark[cis]> potentially a ValueCastable object Captures which becomes a boolean when cast to a value
<Wanda[cis]> hmmm
<Wanda[cis]> the captures thing is ... workable
<Wanda[cis]> not pretty, but workable
mcc111[m] has joined #amaranth-lang
<mcc111[m]> my mild suggestion is that if you do this it should be something like a with m.Capture because I think when you're not capturing erroring on nonsense input is desirable
<mcc111[m]> i'm particularly afraid of forgetting and typing _ instead of -
<whitequark[cis]> wait, how would that be a problem?
<whitequark[cis]> considering that both would match any bit
<mcc111[m]> hm. would _ be a capture pattern or an alias for - in this case
<mcc111[m]> i guess taking a capture pattern and never reading it has no downside except a very minor impact on compile time
<Wanda[cis]> _ to me feels like "discard this please"
<ravenslofty[m]> I'm tempted to say "capture characters" or whatever should be alphabetic
<whitequark[cis]> yeah there's no reason to have _
<ravenslofty[m]> On the one hand I feel there might be a complaint that single letters is limiting, but on the other hand I think minimalism is a useful starting point
<Wanda[cis]> <del>unicode has a lot of letters</del>
<ravenslofty[m]> Okay, but let's save using kanji in patterns for the international obfuscated amaranth code contest
<ravenslofty[m]> or emoticons
<mcc111[m]> Wanda[cis]: i think "ascii", "unicode L" or referencing something within UAX31 would all be sensible ways of defining a letter
<Wanda[cis]> with m.Case('AA ΑΑΑ ААА') as captures:
<Wanda[cis]> ... oh lol they actually look different in Element?
<whitequark[cis]> I have literally solved this exact problem before
<whitequark[cis]> and it got turned into an actual Unicode proposal by someone else
<ravenslofty[m]> I'm happy to just steal that section on unicode handling wholesale if that seems reasonable to others?
<ravenslofty[m]> ...except for the `COMMERCIAL AT` bit, which isn't all that relevant here
<ravenslofty[m]> I think treating newlines as whitespace is reasonable
<ravenslofty[m]> okay, for the sake of clarity, what about mnmn mnmn as a pattern? does that produce mmmm and nnnn? m0m0m0m0/0n0n0n0n? I think concatenation is reasonable, but I figure I should ask all the same
<whitequark[cis]> concatenation probably
<whitequark[cis]> consider riscv patterns
<galibert[m]> I was thinking about them, they’re batshit
<Wanda[cis]> weren't they non-monotonic anyway?
<galibert[m]> They are
<ravenslofty[m]> I shall endeavour not to curse you with the knowledge of the AT&T Hobbit I have recently acquired then, olivier
<galibert[m]> Huhuhu
<galibert[m]> We’re all cursed in here anyway
<galibert[m]> I managed yesterday to dump the internal rom of my psr540 as a stream of midi keyons
<ravenslofty[m]> I mean, I managed to revive the Hobbit disassembler from Plan 9 First Edition's debugger and make it standalone-enough for me to play around with in $CURRENT_YEAR
<galibert[m]> Superb
<galibert[m]> The patterns could get back-compatible extensions like 0101 a[7-0] 0101 a[15-8]
<galibert[m]> They don’t have to be 100% decided right now
<ravenslofty[m]> RFC-worthy?
<whitequark[cis]> what is?
<ravenslofty[m]> the idea of extending patterns to be more first-class
<whitequark[cis]> which of the things described above do you want to submit as an RFC?
<ravenslofty[m]> - `Case` and `matches` produce some kind of `Captures` object that is `ValueCastable` to a bool
<ravenslofty[m]> * "character" to be defined somehow, but non-numeric and non-punctuation?
<ravenslofty[m]> - pattern syntax is extended to also have characters*, which are stored in the `Captures` object as keys to be retrieved from it
<ravenslofty[m]> s/*/\*/
<whitequark[cis]> yes, RFC-worthy
<ravenslofty[m]> * - `Case` and `matches` produce some kind of `Captures` object that is `ValueCastable` to a bool
<ravenslofty[m]> - pattern syntax is extended to also have characters* which match any value and are stored in the `Captures` object as keys to be retrieved from it
<ravenslofty[m]> \* "character" to be defined somehow, but non-numeric and non-punctuation?
<_whitenotifier-3> [amaranth] whitequark edited pull request #1004: Expand language guide to include all control flow syntax - https://github.com/amaranth-lang/amaranth/pull/1004
notgull has quit [Ping timeout: 264 seconds]
notgull has joined #amaranth-lang
crzwdjk has joined #amaranth-lang