mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +08:00
blocked intialstaion of TristateSignals (#439)
This commit is contained in:
parent
e3b4d5263a
commit
75bb3a7598
@ -406,6 +406,9 @@ class _TristateSignal(_ShadowSignal):
|
||||
lines.append("%s <= %s;" % (self._name, d._name))
|
||||
return "\n".join(lines)
|
||||
|
||||
def __repr__(self):
|
||||
return "_TristateSignal(" + repr(self._val) + ")"
|
||||
|
||||
|
||||
class _TristateDriver(_Signal):
|
||||
|
||||
@ -428,3 +431,6 @@ class _TristateDriver(_Signal):
|
||||
self._next = self._sig._orival
|
||||
self._setNextVal(val)
|
||||
_siglist.append(self)
|
||||
|
||||
def __repr__(self):
|
||||
return "_TristateDriver(" + repr(self._val) + ")"
|
||||
|
@ -49,7 +49,7 @@ traceSignals -- function that enables signal tracing in a VCD file
|
||||
toVerilog -- function that converts a design to Verilog
|
||||
|
||||
"""
|
||||
__version__ = "0.11.49"
|
||||
__version__ = "0.11.50"
|
||||
|
||||
|
||||
class StopSimulation(Exception):
|
||||
|
@ -475,25 +475,21 @@ def _writeSigDecls(f, intf, siglist, memlist):
|
||||
|
||||
sig_vhdl_obj = inferVhdlObj(s)
|
||||
|
||||
if not toVHDL.initial_values:
|
||||
val_str = ""
|
||||
else:
|
||||
|
||||
if isinstance(sig_vhdl_obj, vhd_std_logic):
|
||||
val_str = ''
|
||||
if toVHDL.initial_values:
|
||||
if isinstance(s, _TristateSignal):
|
||||
# a TriState signal has no initial value
|
||||
# one might argue that 'Z' could be appropriate?
|
||||
pass
|
||||
elif isinstance(sig_vhdl_obj, vhd_std_logic):
|
||||
# Single bit
|
||||
val_str = " := '%s'" % int(s._init)
|
||||
elif isinstance(sig_vhdl_obj, vhd_int):
|
||||
val_str = " := %s" % s._init
|
||||
elif isinstance(sig_vhdl_obj, (vhd_signed, vhd_unsigned)):
|
||||
val_str = ' := %dX"%s"' % (
|
||||
sig_vhdl_obj.size, str(s._init))
|
||||
|
||||
val_str = ' := %dX"%s"' % (sig_vhdl_obj.size, str(s._init))
|
||||
elif isinstance(sig_vhdl_obj, vhd_enum):
|
||||
val_str = ' := %s' % (s._init,)
|
||||
|
||||
else:
|
||||
# default to no initial value
|
||||
val_str = ''
|
||||
val_str = ' := %s' % s._init
|
||||
|
||||
print("signal %s: %s%s%s;" % (s._name, p, r, val_str), file=f)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user