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 · play https://amaranth-lang.org/play/ · code https://github.com/amaranth-lang · logs https://libera.irclog.whitequark.org/amaranth-lang · Matrix #amaranth-lang:matrix.org
frgo has quit [Remote host closed the connection]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 272 seconds]
frgo has joined #amaranth-lang
frgo has quit [Remote host closed the connection]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 252 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 245 seconds]
Degi_ has joined #amaranth-lang
Degi has quit [Ping timeout: 248 seconds]
Degi_ is now known as Degi
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 246 seconds]
frgo has joined #amaranth-lang
frgo has quit [Read error: Connection reset by peer]
d_olex has quit [Remote host closed the connection]
d_olex has joined #amaranth-lang
Guest96 has joined #amaranth-lang
<Guest96> ImportError: cannot import name 'Record' from 'amaranth.lib.data' in version 0.6
galibert[m] has joined #amaranth-lang
<galibert[m]> Record was marked deprecated in 0.5 and removed in 0.6
<Guest96> Thanks. is there any alternative?
<galibert[m]> Replacement is Struct or Interface depending on what Record was used for
<galibert[m]> and the syntax is different (and fairly better)
<Guest96> so there is interface which is compatible to systemverilog interfcae. As i have to intantiate a SV module with interface
<galibert[m]> Errr not Interface, I meant Signature
<galibert[m]> Sorry
whitequark[cis] has joined #amaranth-lang
<whitequark[cis]> Amaranth Signature/Interface are not directly compatible with SV interfaces
<whitequark[cis]> this is for several reasons but a major one is Yosys limitations
<whitequark[cis]> instead, they get translated to a bunch of wires
<Guest96> So is there a way to attach amarnath signals to inetface of sv
<whitequark[cis]> yeah, you write a SV module that adapts one to the other
jorolf[m] has joined #amaranth-lang
<jorolf[m]> How can I wrap an existing Signal using data.Struct? Afaic the docs only mention creating a new signal?
<whitequark[cis]> if Foo is your data.Struct subclass, calling Foo(some_signal) should do it
<jorolf[m]> My IDE tells me that the first argument should be the layout? Because Struct is a subclass of View?
d_olex has quit [Ping timeout: 252 seconds]
<whitequark[cis]> the IDE is wrong
<whitequark[cis]> there is a __new__ method that passes cls as the first argument to View's constructor
<whitequark[cis]> the docs actually show that, albeit without emphasis
<jorolf[m]> Oh
<jorolf[m]> I guess I'm more used to other languages were constructors are more explicit?
<whitequark[cis]> it's using some metaprogramming to achieve that which confuses your IDE
<whitequark[cis]> we could probably fix that
<jorolf[m]> whitequark[cis]: I was also trying to understand the source code but the metaprogramming overwhelmed me a bit
<galibert[m]> Sadly making the language easy to use makes the implmentation a little harder to read
Guest96 has quit [Quit: Client closed]
Guest96 has joined #amaranth-lang
Guest96 has quit [Quit: Client closed]
d_olex has joined #amaranth-lang
EndlessKnot[m] has joined #amaranth-lang
<EndlessKnot[m]> Hi, I'm new to amaranth. I was trying to implement arithmetic right shift by ``` m.d.comb += self.o.eq(self.a.as_signed() >> (self.b[:5].as_unsigned())) ```
<EndlessKnot[m]> s/```/`/, s/```/`/
<EndlessKnot[m]> s/`/```/, s/`/```/
<EndlessKnot[m]> * Hi, I'm new to amaranth. I was trying to implement arithmetic right shift by
<EndlessKnot[m]> ` m.d.comb += self.o.eq(self.a.as_signed() >> (self.b[:5].as_unsigned())) `
<whitequark[cis]> i think you need three backticks
<EndlessKnot[m]> thanks
<EndlessKnot[m]> however, it gives me this: ` AssertionError: ASR failed, expected 0b11111100, got 4294967292 `
<whitequark[cis]> if you do {...:#b} it will format it as binary
<EndlessKnot[m]> LSR seems to working fine without ` .as_unsigned `
<whitequark[cis]> also, note that 0b11111100 != -4
<galibert[m]> alu.o is unsigned even if you did part of the computation as signed
<EndlessKnot[m]> whitequark[cis]: sure, but I'm asserting for -4
<EndlessKnot[m]> galibert[m]: How can I do this?
<galibert[m]> Catherine: can you .as_signed() in the get?
<whitequark[cis]> o: In(signed(32))
<whitequark[cis]> galibert[m]: yeah
<whitequark[cis]> iirc .get() accepts any Value
<EndlessKnot[m]> whitequark[cis]: thanks!
<galibert[m]> Cat: Nice
<galibert[m]> ok, back to Space Age :-)
frgo has joined #amaranth-lang
frgo has quit [Remote host closed the connection]
frgo has joined #amaranth-lang
<EndlessKnot[m]> If I want something like a RegisterFile, can I do `regs = Array([Signal(32)]*16)`?
<whitequark[cis]> that specific line is wrong: you'll get 16 references to the same signal
<whitequark[cis]> you could rewrite it as [Signal(32) for _ in range(16)] to avoid that
<whitequark[cis]> the other option is to use a Memory
<whitequark[cis]> the tradeoff between an Array and a Memory in this case is blurry, and either solution is likely going to be fine
<EndlessKnot[m]> Yeah this should work. Thanks!
frgo has quit [Remote host closed the connection]
Raito_Bezarius has quit [Ping timeout: 244 seconds]
Raito_Bezarius has joined #amaranth-lang
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 252 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 255 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 248 seconds]