Re: [myhdl-list] MEP : Signal Containers
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2012-05-18 19:57:33
|
On 5/18/12 10:28 AM, Tom Dillon wrote: > > > On 05/18/2012 10:08 AM, Christopher Felton wrote: >> On 5/17/12 8:35 AM, Tom Dillon wrote: >>> >>> 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? >> I have already implemented this feature and created a MEP write-up, >> MEP-108, http://www.myhdl.org/doku.php/meps:mep-108. There hasn't been >> much discussion so I haven't posted the patch yet. I will post the >> patch soon. > > Read that over quickly. What is the advantage to that over a function? > > Also, how do class attributes fit into this? I think I may not undertand > what they are and how they would be used in MyHDL. > Where I inlined my responses might have made it confusing. First, the reference to MEP-108 was simply to respond to your overall comment (or at least my interpretation) that /class methods/ be convertible. If you meant /class method/ conversion would be of interest then MEP-108 is relevant, if not I misunderstood. The advantage of a class method over a function ... no advantage per se. They both achieve the same thing in the similar manner. But it gives the ability to use a method versus a function if someone wanted. We have had this conversation a couple times in the past. The current solution is to have a method that returns the generators from the function, essentially wrapping a function in a /class method/. By allowing the /class method/ to be directly convertible would remove the need to wrap a function. MEP-108 is simple, its only intention is to enable a /class method/ the same as a function. My best example of why you might want to do this is the following example, http://bit.ly/w95kOd. The /class method/ conversion and the /class attribute/ can be viewed as separate. They can be used together but nothing says they have to be and the reason for the separate MEPs. The idea of the /class attribute/, when it is a Signal (a.k.a Signal container), basically helps manage namespace and organize collection of Signals. The MEP-107 for the attributes simply proposes to create a unique name for /class attribute/ when it is a Signal. If the example in the previous post (the wishbone) didn't illustrate how /class attributes/ could be used, either I am poorly explaining or we might have a misunderstanding what a /class attribute/ is. I guess, I would refer you back to the internal bus examples I and Oscar provided. Or maybe there is confusion because it is a basic enhancement proposal and you are thinking it might be something more. The use of classes to "contain" Signals doesn't mean a new type is created (this deeply depends on ones definition of *type*). As mentioned, the class is used as a VHDL record or SystemVerilog struct and nothing more. You can't build new types, then inherit to create yet another new type and define operations and behaviors on the new types. But as a Signal container it still has a lot of benefit and usage in my opinion. Hope that makes sense? Regards, Chris |