Re: [myhdl-list] Restrictions for conversion
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2011-12-23 13:56:04
|
You are correct, this currently is a limitation. Adding support for this is part on the MEP we recently created. Regard, Chris ** sent from mobile device ** On Dec 23, 2011 6:37 AM, "Oscar Diaz" <osc...@gm...> wrote: > Hi > > I was doing some experiments with the conversion function, and I found > a problem I'd like to discuss regarding access to members of data > structures inside generators. Suppose you have a dict with some > constants you need for the calculations: > > constants_list = {"myconst": 10} > def trans_block(clk, din, dout, const_list): > @always(clk.posedge) > def proc(): > dout.next = din + const_list["addconst"] > return instances() > > conversion fails with: > myhdl.ConversionError: in file simpletest.py, line 22: > Object type is not supported in this context: const_list, <type 'dict'> > > Same occur if you have a list: > myhdl.ConversionError: in file simpletest.py, line 22: > Object type is not supported in this context: const_list, <type 'list'> > > Or, even if you use an object with members accessed as attributes, like > this: > dout.next = din + const_list.addconst > conversion fails with: > myhdl.ConversionError: in file simpletest.py, line 29: > Unsupported attribute: addconst > > A workaround is to access data outside the generator, with another > variable name: > > constants_list = {"myconst": 10} > def trans_block(clk, din, dout, const_list): > addconst = const_list["addconst"] > @always(clk.posedge) > def proc(): > dout.next = din + addconst > return instances() > > However, it's kind of annoying to do that when you have a lot of > variables to access. Something similar occurs when you access signals. > > What are your thoughts? Is it good to allow access data members > whatever way you want or is better to have a fixed coding style? By > the way, I think these kind of details should be explained in the > conversion documentation. > > Best regards > > -- > Oscar Díaz > Key Fingerprint = 904B 306C C3C2 7487 650B BFAC EDA2 B702 90E9 9964 > gpg --keyserver subkeys.pgp.net --recv-keys 90E99964 > > I recommend using OpenDocument Format > for daily use and exchange of documents. > > http://www.fsf.org/campaigns/opendocument > > > ------------------------------------------------------------------------------ > Write once. Port to many. > Get the SDK and tools to simplify cross-platform app development. Create > new or port existing apps to sell to consumers worldwide. Explore the > Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join > http://p.sf.net/sfu/intel-appdev > _______________________________________________ > myhdl-list mailing list > myh...@li... > https://lists.sourceforge.net/lists/listinfo/myhdl-list > |