[myhdl-list] Interfaces in Interfaces
Brought to you by:
jandecaluwe
From: Ben R. <be...@re...> - 2015-05-05 04:29:06
|
Hi all, Is it possible to use interface definitions in interfaces? For example I might have an interface for a complex number, and then an interface for a back-pressured stream of complex numbers that uses the complex number interface as a component. e.g. class Complex(object): def __init__(self, width): maxval = pow(2, width-1)-1 minval = -pow(2, width-1) self.real = Signal(intbv(min=minval, max=maxval)) self.imag = Signal(intbv(min=minval, max=maxval)) self.width = width class ComplexStream(object): def __init__(self, width): self.data = Signal(Complex(width=width)) self.valid = Signal(bool(0)) self.last = Signal(bool(0)) self.ready = Signal(bool(0)) self.width = width Cheers, Ben |