class Tristate(Special):
def __init__(self, target, o, oe, i=None):
Special.__init__(self)
- self.target = target
- self.o = o
- self.oe = oe
- self.i = i
+ self.target = wrap(target)
+ self.o = wrap(o)
+ self.oe = wrap(oe)
+ self.i = wrap(i)
def iter_expressions(self):
for attr, target_context in [
self.name = name
if expr is None:
expr = Signal()
- self.expr = expr
+ self.expr = wrap(expr)
class Input(_IO):
pass
class Output(_IO):
class Parameter:
def __init__(self, name, value):
self.name = name
+ if isinstance(value, (int, bool)):
+ value = Constant(value)
self.value = value
class PreformattedParam(str):
pass
r += ",\n"
firstp = False
r += "\t." + p.name + "("
- if isinstance(p.value, (int, bool)):
+ if isinstance(p.value, Constant):
r += verilog_printexpr(ns, p.value)[0]
elif isinstance(p.value, float):
r += str(p.value)
class MultiReg(Special):
def __init__(self, i, o, odomain="sys", n=2):
Special.__init__(self)
- self.i = i
- self.o = o
+ self.i = wrap(i)
+ self.o = wrap(o)
self.odomain = odomain
self.n = n
class DifferentialInput(Special):
def __init__(self, i_p, i_n, o):
Special.__init__(self)
- self.i_p = i_p
- self.i_n = i_n
- self.o = o
+ self.i_p = wrap(i_p)
+ self.i_n = wrap(i_n)
+ self.o = wrap(o)
def iter_expressions(self):
yield self, "i_p", SPECIAL_INPUT
class DifferentialOutput(Special):
def __init__(self, i, o_p, o_n):
Special.__init__(self)
- self.i = i
- self.o_p = o_p
- self.o_n = o_n
+ self.i = wrap(i)
+ self.o_p = wrap(o_p)
+ self.o_n = wrap(o_n)
def iter_expressions(self):
yield self, "i", SPECIAL_INPUT
class DDRInput(Special):
def __init__(self, i, o1, o2, clk=ClockSignal()):
Special.__init__(self)
- self.i = i
- self.o1 = o1
- self.o2 = o2
- self.clk = clk
+ self.i = wrap(i)
+ self.o1 = wrap(o1)
+ self.o2 = wrap(o2)
+ self.clk = wrap(clk)
def iter_expressions(self):
yield self, "i", SPECIAL_INPUT
def __init__(self, cd, async_reset):
Special.__init__(self)
self.cd = cd
- self.async_reset = async_reset
+ self.async_reset = wrap(async_reset)
def iter_expressions(self):
yield self.cd, "clk", SPECIAL_INPUT