Re: [myhdl-list] Block return values (myhdl.BlockError)
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2016-05-01 10:40:40
|
I have been thinking about this for about a month now, without a good resolution, and it is holding development back. We need to resolve this urgently though, because if we go forward with @block a release has to made before GSoC. (May 23). It is a style I didn't think about before, but of course it is something you can do with dynamic Python... My thoughts: In this style, the return values become part of the block interface. If we want to support this with @block, we need to permit different (perhaps all) types of return values, and reorder them using the decorator. This seems to become complicated, and also defies the purpose of @block somewhat (stricter type checking). So: if we don't support this, are we really going to miss something in the future? The workaround is of course to use only the argument list for the block interface, and to do type-dependent processing of ports outside the @block. Also, an intermediate workaround may be to pass an "interface object" as an argument, and populate it with Signal objects locally within the @block. Feedback is more than welcome. Jan On 29/03/16 15:54, 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 > > 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. > > I can imagine that also other return values may be wanted by users. > Is this something which can be taken into account? > Or: should 'block's really be constrained in returning just block or > instantiator objects? > > Thanks, > Jos > > > ------------------------------------------------------------------------------ > Transform Data into Opportunity. > Accelerate data analysis in your applications with > Intel Data Analytics Acceleration Library. > Click to learn more. > http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140 > -- Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com Python as a HDL: http://www.myhdl.org VHDL development, the modern way: http://www.sigasi.com Urubu, a static website CMS: http://urubu.jandecaluwe.com |