whitequark changed the topic of #nmigen to: nMigen hardware description language · code https://github.com/nmigen · logs https://libera.irclog.whitequark.org/nmigen
<_whitenotifier-a> [YoWASP/nextpnr] whitequark pushed 1 commit to develop [+0/-0/±1] https://git.io/J4aOJ
<_whitenotifier-a> [YoWASP/nextpnr] whitequark c4a9071 - Update dependencies.
Degi_ has joined #nmigen
Degi has quit [Ping timeout: 258 seconds]
Degi_ is now known as Degi
Raito_Bezarius has quit [*.net *.split]
nak has quit [*.net *.split]
Lord_Nightmare has quit [*.net *.split]
d1b2 has quit [*.net *.split]
Ekho has quit [*.net *.split]
sensille has quit [*.net *.split]
pie_ has quit [*.net *.split]
sensille has joined #nmigen
d1b23 has joined #nmigen
pie_ has joined #nmigen
nak has joined #nmigen
Raito_Bezarius has joined #nmigen
nak has quit [Signing in (nak)]
nak has joined #nmigen
Raito_Bezarius has quit [Signing in (Raito_Bezarius)]
Raito_Bezarius has joined #nmigen
d1b23 is now known as d1b2
Lord_Nightmare has joined #nmigen
urja has quit [*.net *.split]
jamwaffles[m] has quit [*.net *.split]
nyanotech has quit [*.net *.split]
nyanotech has joined #nmigen
urja has joined #nmigen
jamwaffles[m] has joined #nmigen
Ekho has joined #nmigen
emeb_mac has quit [Quit: Leaving.]
bvernoux has joined #nmigen
cr19011 has joined #nmigen
cr1901 has quit [Killed (NickServ (GHOST command used by cr19011!~William@2601:8d:8600:911:7c10:167b:ad8e:ebd))]
cr19011 is now known as cr1901
sm2n has quit [Ping timeout: 255 seconds]
someone--else has joined #nmigen
sm2n has joined #nmigen
cr19011 has joined #nmigen
cr1901 has quit [Read error: Connection reset by peer]
bvernoux1 has joined #nmigen
bvernoux has quit [Ping timeout: 256 seconds]
bvernoux1 is now known as bvernoux
emeb has joined #nmigen
someone--else has quit [Quit: Connection closed]
lsneff has quit []
lsneff_ has joined #nmigen
bvernoux1 has joined #nmigen
lsneff_ has quit [Client Quit]
lsneff_ has joined #nmigen
bvernoux has quit [Ping timeout: 252 seconds]
bvernoux1 is now known as bvernoux
bvernoux has quit [Quit: Leaving]
bvernoux has joined #nmigen
<mwbrown> Is there any way to write a helper function inside an nmigen simulation process that also returns a value? I know you have to `yield from` anything that talks to the sim because it's expecting a list of commands, but it seems that you cannot also return a value from a function you are yielding from
<mwbrown> example, you have some function that returns an integer after doing some state transitions... I tried something like `x = (yield from helper_function())`, but x is always None
<mwbrown> I'm thinking the only solution here would be to wrap it in some sort of stateful class to avoid littering my sim with globals
<d1b2> <DX-MON> if remembering correctly, the last statement in a generator function may be a normal return - this might help with this case
<mwbrown> I did try using a return at the very end of the function, but that didn't seem to do what I wanted. But also, aren't coroutines slightly different from generators? Or am I misunderstanding them since nmigen is the only place I've ever dealt with coros
<DX-MON> generators are functions that use yield statements
<DX-MON> coroutines are await/async
<DX-MON> I can't think of any instance in nMigen that uses the latter, only Glasgow
<mwbrown> Hmmm. Maybe I misread something
<mwbrown> I think the issue might be because it's doing `yield from` which is connecting the results of the yield all the way up to the generator
<mwbrown> er, not generator. Simulator
<DX-MON> so, if you want to get specific results out from the inner generator, you will most probably want to run a for loop (`for item in helper_function()`)
<DX-MON> inside that for loop, you then yield things you want going to the simulator
<mwbrown> That's what I was starting to think, yeah. Kind of hacky but I suppose I could write a class and do a type-check to see if it's a value my process cares about vs. something destined for the simulator
<DX-MON> and anything you don't want going to the sim, can then be handled in the loop
<mwbrown> Yep. I think I'm on the same page here. The real challenge would be trying to make that look clean, heh
<mwbrown> but then again, the code is already littered with yield from, so it's not gonna look that ugly by comparison
<vup> mwbrown: you can return from a helper function just fine: https://paste.niemo.de/ebinewodin.py
<vup> or are
<vup> you talking about returning multiple values?
<mwbrown> No, not multiple values. I just need to be able to return a single value at the end of a function. When I was trying it, it was giving me None as a return value... maybe my syntax was off. I'll give your example a try
<vup> fwiw my example works atleast for me :)
<mwbrown> Yep, works on my side too. I'll need to give what I did a second look and figure out why it was returning None
<mwbrown> this project I'm doing is my first real attempt with nMigen so I'm sure there's something I'm doing that's slightly off
someone--else has joined #nmigen
cr19011 is now known as cr1901
smkz has quit [Quit: restart]
smkz has joined #nmigen
<mwbrown> vup: it was indeed a stupid mistake. During my refactoring I moved the code in question to a new function, so the _inner_ function returns the value, but the outer function discards it and ultimately returns None :|
<vup> mwbrown: whoops, glad you could work it out
GenTooMan has quit [Ping timeout: 252 seconds]
GenTooMan has joined #nmigen
emeb_mac has joined #nmigen
someone--else has quit [Quit: Ping timeout (120 seconds)]
bvernoux has quit [Quit: Leaving]
emeb has quit [Quit: Leaving.]
lf has quit [Ping timeout: 256 seconds]
lf_ has joined #nmigen