Re: [myhdl-list] MEP : Signal Containers
Brought to you by:
jandecaluwe
From: Tom D. <td...@di...> - 2012-05-17 13:36:09
|
On 05/17/2012 04:03 AM, Oscar Diaz wrote: > 2012/5/14 Christopher Felton<chr...@gm...>: > >> <snip> >> >> I have made some minor changes to the proposed MEP, the modifications >> can be found here, http://www.myhdl.org/doku.php/meps:mep-107 >> >> I have been *waffling* if the class attributes should be part of this >> MEP or a separate MEP. I am leaning more towards inclusion, if a class >> attribute is a convertible type then it can be viewed as a "Signal >> Container". But it might warrant it separate MEP/thread simply because >> the conversation around class support might be lengthy, e.g. subset of >> class support (the current MEP107 and MEP108) or something different. > I agree: class attributes should be covered in this MEP (as we > discussed in this thread). However, I think this MEP should address > first the easy containers: lists and dictionaries, and after that > experience we can move to support -the more general- class attributes. > I am more interested in using classes. I am not sure what class attributes would do. Can someone provide an example? My use for this is really to group related signals, so that you can pass them as a group. Secondary use would be to provide some useful class functions to do redundant tasks that I would prefer to hide in the class. My simple example would be for complex numbers. The object would simply store two values, real and imaginary. It would have some member functions like next(cplxNum), which would do the complex assignment to the two signals stored in the object. It would have other member functions as well, but you get the idea. Now, this all works now, other than you can't use the class object as a top level port of your MyHDL module. For now, I have to make a top level wrapper that breaks out the complex object into its real and imaginary signals and creates twice as many ports. Not horrible, but it is tedious and prone to errors. What I think would be useful, is for the class to have some hooks for conversion. For instance you may want to tell it to break out the object into two separate signals. Or you may want to concatenate them together into one long vector. I am very unfamiliar with conversion so have no idea the best way to achieve something like this. I guess I need to understand other issues to know what everybody else wants out of this. Tom |