<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)