Re: [myhdl-list] Interfaces in Interfaces
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2015-05-05 13:39:59
|
On 5/4/15 11:01 PM, Ben Reynwar wrote: > 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. Yes, it is possible. A basic test case exists in the test suite: https://github.com/jandecaluwe/myhdl/blob/master/myhdl/test/conversion/general/test_interfaces3.py#L28 Regards, Chris > > e.g. > > class Complex(object): > > def __init__(self, width): > maxval = pow(2, width-1)-1 Note, Python is exclusive on the upper bounds, MyHDL follows this concept. The max bound is one more than the max value. (python exclusive upper bound) http://stackoverflow.com/a/11364711/760977 Regards, Chris |