Re: [myhdl-list] How to make MyHDL Object-Oriented
Brought to you by:
jandecaluwe
From: Christopher L. <loz...@fr...> - 2012-05-05 16:29:05
|
Jan Decaluwe wrote: Coupling a sensitivity list to a module makes no sense. Understood. Here is the source of my confusion. The manual says: Hardware descriptions need to support the concepts of module instantiation and hierarchy. In MyHDL, an instance (of a hardware module) is recursively defined as being either a sequence of instances, or a generator. There are really two concepts here. One is a high level module which is recursively represented by a sequence of submodules. And the other is a leaf module which is represented by a generator. Ports can be associated with both high and low level modules The logic, generator and sensitivity lists are only associated with the leaf module. Or we could call them atomic and compound hardware modules. Did I get that correct? If so, thanks Jan for clearing that up for me. Accordingly I have updated split the Hardware Module class definition in two here: wiki.myhdlclass.com:8080/OOHDL But that still does not solve all my problems for these classes. Back to the Manual. The clock driver function ClkDriver() has a clock signal as its parameter. This is how a /port/ is modeled in MyHDL. In the page on Atomic and Compound Hardware modules, I model ports as public instance variables. And internal signals as private instance variables. It is how experienced python developers expect to see things. It is natural for us to think of ports as instance variables. Then you can get inheritance of ports for free as Hardware Modules are subclassed. The port methods automatically remove Children and Parents from the instance variable list. With this design, one would not have to list all the ports repeatedly in the generator function for each subclass. They just get inherited. Brings us a step closer towards rich libraries of hardware modules that can be subclassed. Cool! But there is a problem, as that is not how MyHDL models ports. It is not just an implementation problem. It is a conflict between how experienced Python developers see the world, and the functional approach favored by experienced hardware engineers. -- Regards Christopher Lozinski Check out my iPhone apps TextFaster and EmailFaster http://textfaster.com Expect a paradigm shift. http://MyHDL.org |