Re: Block return values (myhdl.BlockError)

Christopher Felton <[email protected]> Thu, 7 Apr 2016 06:12:00 -0500
Newsgroups gmane.comp.python.myhdl
Message-ID <[email protected]>
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


------------------------------------------------------------------------------