Created
April 19, 2016 17:28
-
-
Save hgomersall/f2f8fa86438128cc208c60a59701eb87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from myhdl import * | |
class Interface(object): | |
def __init__(self): | |
self.foo = Signal(intbv(0)[20:]) | |
self.bar = Signal(intbv(0)[20:]) | |
@block | |
def Foo(a, b, c, d, e, clock): | |
if e == True: | |
@always(clock.posedge) | |
def instance(): | |
a.next = b | |
c.next = d | |
instances = [instance] | |
else: | |
@always(clock.posedge) | |
def instance(): | |
c.next = d | |
a.foo.next = b.foo | |
a.bar.next = b.bar | |
instances = [instance] | |
return instances | |
clock = Signal(False) | |
a = Signal(intbv(0)[10:]) | |
b = Signal(intbv(0)[10:]) | |
#a = Interface() | |
#b = Interface() | |
c = Signal(intbv(0)[10:]) | |
d = Signal(intbv(0)[10:]) | |
foo = Foo(a, b, c, d, True, clock) | |
foo._inferInterface() | |
print foo.argnames | |
print foo.argdict | |
for each in foo.argnames: | |
print(each, len(foo.argdict[each])) | |
#foo.convert(hdl='Verilog') | |
foo.convert(hdl='VHDL') | |
foo.convert(hdl='VHDL') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment