Re: [myhdl-list] reusable blocks with different interfaces
Brought to you by:
jandecaluwe
From: Henry G. <he...@ca...> - 2015-01-15 21:16:37
|
On 15/01/15 20:26, Christopher Felton wrote: <snip> > From my perspective it seems reasonable. The idea > and uses cases are straight-forward but implementation > might need some batting around. > > Example, should there be a factory function to copy, > kinda like the previous example. Or should the user > have to defined a "next" method so that it can be a > customizable copy ... Right. Something like, if the class contains the next attribute with a defined setter, it is used, otherwise nothing happens. It would be a simple case then to define library functions, the obvious one being to assign all the signals: from myhdl import interface_setter, interface_getter class MyInterface(object): def __init__(self): self.a = Signal(intbv(0)[5:]) self.b = Signal(intbv(0)[5:]) next = property(interface_getter, interface_setter) This could obviously be done in a parent class. Henry |