<stevenjl>
Hi all! Anyone fancy helping a rookie out? I'd like to communicate with an input/output bus attached to my Artix 7 but I haven't found any examples of switching between input / output for some Signal connections. I found https://github.com/amaranth-lang/amaranth/blob/main/amaranth/compat/fhdl/specials.py#L34 but it's in compat/fhdl so I assume
<stevenjl>
there is a preferred alternative?
<adamgreig[m]>
stevenjl: the Resource on your Platform should have dir="io", and then you'll get an object that has `.i`, `.o`, and `.oe` signal attributes
<adamgreig[m]>
you can read from `.i` all the time, drive `.o`, and whenever `.oe` is asserted/1, the output is driven to the line
<adamgreig[m]>
use that right at the device edge, and inside your logic, use separate signals for i, o, and oe
<stevenjl>
aha, thanks!
<adamgreig[m]>
(for example for an open-drain bus, set `.o` to 0 always, and use `.oe` to control whether it's driven to 0 or high-z)
<adamgreig[m]>
you can't (generally speaking) have a tristate wire inside the fpga - it's always an input or an output, so best to represent that as separate i, o, oe signals, that eventually feed the special IO hardware block that has a tristate driver
<stevenjl>
Got it
<stevenjl>
so adding Resource("SomeName", 0, Pins("H8", dir="io")) in my board class would be an example for a single pin
<stevenjl>
which I can retrieve as x=platform.request("SomeName") and I can use the x.o, x.oe x.i just like any Signal?
Vonter has joined #amaranth-lang
<stevenjl>
And I guess I can do Resource("SomeName", 0, Pins("H8 XX YY ZZ", dir="io")) for 'bus' with some width?
<adamgreig[m]>
yep, exactly so
<stevenjl>
Perfect, thanks so much!
stevenjl has quit [Quit: Client closed]
Vonter has quit [Ping timeout: 256 seconds]
Vonter has joined #amaranth-lang
bl0x_ has quit [Ping timeout: 252 seconds]
bl0x_ has joined #amaranth-lang
Vonter has quit [Ping timeout: 256 seconds]
Vonter has joined #amaranth-lang
Degi_ has joined #amaranth-lang
Degi has quit [Ping timeout: 256 seconds]
Degi_ is now known as Degi
cr1901_ has joined #amaranth-lang
cr1901_ has quit [Remote host closed the connection]
Vonter has quit [Read error: Connection reset by peer]
wolfshappen has joined #amaranth-lang
Vonter has joined #amaranth-lang
<Sarayan>
d1b2: thanks
<Sarayan>
Yep, sounds like a very good idea
<cr1901>
FWIW, d1b2 is the Discord bridge, I think you meant to thank Hardkrash
<Sarayan>
Hardkrash: what I said :-)
<Sarayan>
indeed I did
<cr1901>
I mean, you can thank both! I just don't think d1b2 will feel the gratification :(.
<Sarayan>
Well, whitequark was saying she knows people arguing thermostats could be considered concious, so... :-)
<Sarayan>
conscious
<lethalbit>
has anyone designed an amaranth mascot yet? i feel as is it needs a cute mascot
<lethalbit>
(i would but my artistic skills are on part with a potato)
<lethalbit>
Maybe wq could ask Tyson Tan, they did the Krita mascot
cr1901 has quit [Quit: Leaving]
cr1901 has joined #amaranth-lang
cr1901 has quit [Client Quit]
cr1901 has joined #amaranth-lang
cr1901 has quit [Remote host closed the connection]
cr1901 has joined #amaranth-lang
cr1901 has quit [Client Quit]
cr1901 has joined #amaranth-lang
Vonter has quit [Ping timeout: 256 seconds]
Vonter has joined #amaranth-lang
<whitequark>
I'll consider it!
<lethalbit>
=^w^=
AviKav has quit [Remote host closed the connection]
nak has quit [Ping timeout: 260 seconds]
nak has joined #amaranth-lang
Wolfvak has quit [Ping timeout: 256 seconds]
Wolfvak has joined #amaranth-lang
Wolfvak has quit [Remote host closed the connection]
Wolfvak has joined #amaranth-lang
Wolfvak has joined #amaranth-lang
Wolfvak has quit [Changing host]
Vonter has quit [Ping timeout: 252 seconds]
Vonter has joined #amaranth-lang
bvernoux has quit [Quit: Leaving]
<key2>
is it possible to have an FSM inside another FSM?
Vonter has quit [Ping timeout: 252 seconds]
<d1b2>
<Herr Brain> That is how every large digital system is implemented.
<whitequark>
yeah
<d1b2>
<esden> state machines all the way down ๐
<d1b2>
<Conventia> I suppose it depends on how you define 'inside'... if you're being pedantic. ๐
<d1b2>
<TheManiacalLemon> I would assume it means using nested with m.FSM():
<d1b2>
<Conventia> I haven't actually used amaranth yet. I was mostly just making a joke about some hardware being inside other hardware, when that's impossible, even though that's conceptually what people think.
<d1b2>
<Herr Brain> Or up, depending on your perspective.
<d1b2>
<Conventia> But yes, state machines aren't particularly useful if you're only allowed one, in general.
<Sarayan>
ya dawg, I heard you liked state machines
benreynwar has quit [Read error: No route to host]
tucanae47_ has quit [Read error: No route to host]
tucanae47_ has joined #amaranth-lang
benreynwar has joined #amaranth-lang
Qyriad has quit [Read error: Connection reset by peer]
Qyriad has joined #amaranth-lang
peepsalot has quit [Ping timeout: 240 seconds]
peepsalot has joined #amaranth-lang
indy has quit [Ping timeout: 240 seconds]
indy has joined #amaranth-lang
cr1901 has quit [Remote host closed the connection]