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
<Wanda[cis]> hm, there are actually two tests that verify range(1) evaluates to unsigned(1) as shape...
lf_ has joined #amaranth-lang
lf has quit [Ping timeout: 276 seconds]
<whitequark[cis]> <Wanda[cis]> "Catherine: ... do we actually..." <- I ... don't know. probably not tbh? should we recommend just casting to a const instead?
<Wanda[cis]> idk what use cases it has in the first place
<whitequark[cis]> its basically len(Const(n)) but we did not even have the concept of shapes then
<Wanda[cis]> mhm.
<Wanda[cis]> but to be clear on the main issue
<Wanda[cis]> what is len(Signal(range(1))) supposed to be?
<whitequark[cis]> I am not sure I ever intentionally gave that a value >_>
<whitequark[cis]> maybe check if it was diff in initial commit?
<Wanda[cis]> ... okay let's do some archeology
Guest89 has quit [Quit: Client closed]
<Wanda[cis]> it's been 1 because of bits_for interaction ever since Shape existed
<Wanda[cis]> it's even older in fact; the code was copied from Signal.range
Guest89 has joined #amaranth-lang
<whitequark[cis]> was the behavior of that ever different?
<Wanda[cis]> before Signal.range existed, yes
<Wanda[cis]> Signal(min=0, max=1) would give you 0-bit signal
<Wanda[cis]> ... actually, so did Signal(min=1, max=2) which was obviously wrong
<Wanda[cis]> ever since Signal.range existed, it and Shape used the exact same bits_for based computation, which changed only once (and not much) to fix an unrelated bug
<Wanda[cis]> in other words, I think this is something that just ... happened
<whitequark[cis]> yep, I thought so
<whitequark[cis]> we can fix that
<Wanda[cis]> rfc?
<whitequark[cis]> yep
<whitequark[cis]> can't imagine it'll be controversial
<Wanda[cis]> I'll write it then
<whitequark[cis]> thank you ^^
<galibert[m]> Can we just vote merge and be done with it ? ;-)
Guest89 has quit [Quit: Client closed]
<Wanda[cis]> hm
<Wanda[cis]> "a range, where the result is wide enough to represent any element of the range, and is signed if any element of the range is signed;"
<Wanda[cis]> this just says its "wide enough", not that it's the minimal width
<galibert[m]> Minimal width is kind of expected though
<galibert[m]> Is signal(range(10,14)) 2 bits or 4?
<Wanda[cis]> 4
<galibert[m]> Ok
<Wanda[cis]> otherwise we'd need to have signals with implicit non-zero high bits which would be a massive pain
<galibert[m]> So Signal(range(65536,65536)) is 17 bits?
<Wanda[cis]> that one has an empty range so is 0 bits
<galibert[m]> Ah, and ,65537 would be 17 though
<Wanda[cis]> yes
<Wanda[cis]> as per the wording, the signal needs to be capable of actually representing 65536
<galibert[m]> That make range(1) interesting indeed
<Wanda[cis]> the minimal shape the satisfies that is unsigned(17)
<_whitenotifier-3> [rfcs] wanda-phi opened pull request #46: Add RFC for `Shape(range(1))` change. - https://github.com/amaranth-lang/rfcs/pull/46
<_whitenotifier-3> [rfcs] wanda-phi edited pull request #46: Add RFC for `Shape(range(1))` change. - https://github.com/amaranth-lang/rfcs/pull/46
<Wanda[cis]> there goes the RFC
<_whitenotifier-c> [rfcs] whitequark commented on pull request #46: Add RFC for `Shape(range(1))` change. - https://github.com/amaranth-lang/rfcs/pull/46#issuecomment-1925019848
<Wanda[cis]> ... wait, it's Shape.cast(range(1)), isn't it
<Wanda[cis]> yay I fucked up the RFC title
<_whitenotifier-c> [rfcs] wanda-phi edited pull request #46: Add RFC for `Shape.cast(range(1))` change. - https://github.com/amaranth-lang/rfcs/pull/46
<_whitenotifier-3> [rfcs] wanda-phi commented on pull request #46: Add RFC for `Shape.cast(range(1))` change. - https://github.com/amaranth-lang/rfcs/pull/46#issuecomment-1925021749
<_whitenotifier-3> [amaranth] wanda-phi opened pull request #1077: Implement RFC 46: Change `Shape.cast(range(1))` to `unsigned(0)`. - https://github.com/amaranth-lang/amaranth/pull/1077
<_whitenotifier-c> [rfcs] whitequark commented on pull request #46: Add RFC for `Shape.cast(range(1))` change. - https://github.com/amaranth-lang/rfcs/pull/46#issuecomment-1925022628
<_whitenotifier-3> [rfcs] wanda-phi edited pull request #46: Add RFC for `Shape.cast(range(1))` change. - https://github.com/amaranth-lang/rfcs/pull/46
<_whitenotifier-c> [rfcs] wanda-phi edited pull request #46: Add RFC for `Shape.cast(range(1))` change. - https://github.com/amaranth-lang/rfcs/pull/46
<whitequark[cis]> btw, there was a semi related question
<_whitenotifier-3> [rfcs] wanda-phi commented on pull request #46: Add RFC for `Shape.cast(range(1))` change. - https://github.com/amaranth-lang/rfcs/pull/46#issuecomment-1925022954
<whitequark[cis]> where should ceil_log2 be documented?
<whitequark[cis]> is it a part of the languagem
<Wanda[cis]> I was wondering about the same thing actually
<whitequark[cis]> s/languagem/language?/
<Wanda[cis]> .. it could get its own utils page
<Wanda[cis]> but it feels weird to have it
<Wanda[cis]> throw it in with language, I guess?
<Wanda[cis]> it's conceptually as low-level as amaranth.hdl
<_whitenotifier-c> [amaranth] codecov[bot] commented on pull request #1077: Implement RFC 46: Change `Shape.cast(range(1))` to `unsigned(0)`. - https://github.com/amaranth-lang/amaranth/pull/1077#issuecomment-1925023268
<Wanda[cis]> well, slightly lower, but whatever
<_whitenotifier-c> [rfcs] whitequark commented on pull request #46: Add RFC for `Shape.cast(range(1))` change. - https://github.com/amaranth-lang/rfcs/pull/46#issuecomment-1925023349
<whitequark[cis]> Wanda[cis]: should we export it from there?
<Wanda[cis]> ... maybe?
<Wanda[cis]> hm
<Wanda[cis]> tbh it could have just as well been in amarath.hdl.utils before the recent hdl merge
<Wanda[cis]> so I guess
<whitequark[cis]> right. I'll handle that later I guess
Guest20 has joined #amaranth-lang
Guest20 has quit [Client Quit]
skipwich has quit [Quit: DISCONNECT]
skipwich has joined #amaranth-lang
Degi_ has joined #amaranth-lang
Degi has quit [Ping timeout: 260 seconds]
Degi_ is now known as Degi
jjsuperpower has quit [Ping timeout: 264 seconds]
<jfng[m]> <zyp[m]> "for RW1C and RW1S, what is..." <- the setting effect always has precedence
<jfng[m]> i.e. in `RW1C`, `set` precedes `port.w_data`, but in `RW1S`, `port.w_data` precedes `clear`
<jfng[m]> the behavior is implied in this section, but it should also be mentioned in the reference for `RW1S`/`RW1C`
notgull has joined #amaranth-lang
notgull has quit [Ping timeout: 246 seconds]
SpaceCoaster has quit [Quit: Bye]
SpaceCoaster has joined #amaranth-lang
<_whitenotifier-3> [amaranth] wanda-phi commented on issue #1061: `Const(obj, shape)` should use RFC 9 to cast `obj` to `shape` - https://github.com/amaranth-lang/amaranth/issues/1061#issuecomment-1925431708