Re: [myhdl-list] Block return values (myhdl.BlockError)
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2016-04-07 11:12:14
|
On 3/29/16 8:54 AM, Jos Huisken wrote: > Hi, > > Sometimes I'm using a block like this: > > def tb(): > m, clk, rst = clkrst() > return m, clk, rst > > In which 'm' is the list of instantiator objects, and 'clk'/'rst' are > Signals. > So this way you can specify a block in general: > > def unit(inputports): > ... > return m, outputports I have, in the past, attempted to use returns other than the myhdl.generators but I haven't been too successful. I can see the utility because often the ports are a function of the inputs. I do not know if it will be possible with the new implementation. It isn't the most DRY but you could attach a function to the ~~module~~ block: outputs = myblock.get_outputs(**inputs) inst = myblock(**inputs, **outputs) > > Note that this could be a preferred way of design. It just happened that I > created few such examples. > > With the new block decorator this is not allowed anymore, raising a > myhdl.BlockError. If this is not supported with MEP114, we might want to add alternative suggestions to the MEP/documentation for users that have used returns which include more than generators. Regards, Chris |