Re: [myhdl-list] Conversion of class methods
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2012-03-20 18:39:05
|
<snip> >>> >>> As for your other questions, I find it a bit weird that the "signal >>> containers" MEP refers to "classes" as well. I don't think that >>> classes are normally considered containers even if strictly speaking >>> they are. Perhaps it is because they are so much more than that... >>> So my 0.02$ is that that part should be rolled into the MEP 108. >> >> What united the classes and other containers, in my mind, is how a >> Signal and numeric values embedded in a "container" is transformed. >> You are correct, a class can be a super set but it is also >> container. The MEP only covers the container part of the class, that >> is Signals, constants, and variables (?) as class attributes. > > Well, I think we should support classes, in the end, list and signals > are also classes, and I think we shouldn't restrict cases like defining > a custom container class. I think the problem here is how to access > its members (index or attributes), I mean in the implementation. I created a stackoverflow question, http://bit.ly/wxCQqA, for this. AFAIK it is possible in both cases. > > However, following the idea of "baby steps", I agree on starting only > with lists and dicts. Also, note that in this objects, the access to its > members is done by indexing. > Classes can be accessed via the __dict__ or through attributes (which the attributes translates to the __dict__). Classes could be handled the same as a dict, resolving the path (ast tree) between the attribute node and the name node. In MEP-108 is a proposed translation rule from "container" to flat netlist. The current proposed plan is: MEP-108 conversion of class methods. This only addresses the "self" port and the _extractHierarchy. The class method with generators would have the same ability as the current functions with generators. MEP-107 signal containers. This addresses when a signal is embedded in a dict, class, or heterogeneous list (homogeneous lists currently supported). These are grouped together (in my mind they are related), and the same "rule" would be applied for converting the hierarchical structures to a flat netlist. Once both MEPS are implemented common support of classes would be enabled. MEP-108 is the more straight-forward and was the intended first to be implemented, MEP-107 more involved, more conversation required. Thanks for the comments! Chris |