Catherine[m] 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 · Matrix #amaranth-lang:matrix.org
jfng[m]1 has joined #amaranth-lang
TD--Linux is now known as TD-Linux
smkz has quit [Quit: smkz]
charlotte[m] has joined #amaranth-lang
charlottia is now known as charlottia[mx]
charlotte[m] is now known as charlotte
charlotte is now known as Guest858
smkz has joined #amaranth-lang
Guest858 is now known as charlottia
Degi_ has joined #amaranth-lang
Degi has quit [Ping timeout: 252 seconds]
Degi_ is now known as Degi
adamgreig[m] has left #amaranth-lang [#amaranth-lang]
<galibert[m]> Does C(0) work?
<galibert[m]> instead of 0 of course
<jfng[m]1> TypeError: int() argument must be a string, a bytes-like object or a real number, not a 'Const', during Signal instantiation this time
<galibert[m]> wow, didn't expect that one
<jfng[m]1> 0 works with other kinds of layouts, e.g. StructLayout, so i don't think that's the problem
<jfng[m]1> galibert[m]: it tries to do Const(Const(0)), i think
<jfng[m]1> found one way to do it: Value.cast(a).reset
charlottia[mx] has left #amaranth-lang [#amaranth-lang]
<_whitenotifier-6> [amaranth-soc] jfng opened pull request #40: CSR register API prototype - https://github.com/amaranth-lang/amaranth-soc/pull/40
<_whitenotifier-6> [amaranth-soc] jfng edited pull request #40: CSR register API prototype - https://github.com/amaranth-lang/amaranth-soc/pull/40
<charlottia> <jfng[m]1> "found one way to do it: Value...." <- `a.as_value().reset` too. `a.reset` where `a` is a `View` is equal to `a["reset"]`, which for underlying `ArrayLayout`s, does a `word_select` (i.e. tries to slice the underlying signal, which would be desirable if you said `a[2]` or something). It tries to value-cast the string `"reset"` to use as an offset, which is the error you see there.
<jfng[m]1> i see, that aligns with what the stacktrace reported
<jfng[m]1> i'm just a bit surprised to step on a `TypeError` just by referencing an attribute of an object
<charlottia> I think it can be a little confusing, because Signal(shape, ...) where shape is a ShapeCastable subclass instance wraps the newly created Signal in that class, so while it looks like you just made a Signal which is now in a, you actually made a Signal and a View, and the View's in a and the Signal's its target/as_value().
<charlottia> > <@jfng:matrix.org> i see, that aligns with what the stacktrace reported
<charlottia> > i'm just a bit surprised to step on a `TypeError` just by referencing an attribute of an object
<charlottia> Yes; it's an "interesting" effect of the `getattr`->`getitem` forwarding `View` does, I guess?
<jfng[m]1> charlottia: yeah, and it won't be a `Signal` until you `Value.cast()` it
<charlottia> Yes, or as_value().
<charlottia> Maybe it'd be better if ArrayLayout-backed Views didn't do the getattr forwarding, to avoid this.
<charlottia> (right now View is generic enough to work for struct/union/array/flexible layout happy paths without any modification, but it complicates the non-happy paths like these.)
<jfng[m]1> agreed, gettattr forwarding is useful when your field have names (i.e. strings); since array fields use indices, you couldn't access them like that anyway
<charlottia> Indeed!
Bluefoxicy has quit [Quit: ZNC - http://znc.in]
Bluefoxicy has joined #amaranth-lang
jjsuperpower has joined #amaranth-lang
sauce has quit [Ping timeout: 258 seconds]
sauce has joined #amaranth-lang