1
0
mirror of https://github.com/myhdl/myhdl.git synced 2024-12-14 07:44:38 +08:00

corrected .vcd representation for array of enums (#426)

corrected  pck_myhdl_xx version number, removing the subminor index
This commit is contained in:
Josy Boelen 2024-02-03 13:47:47 +01:00 committed by GitHub
parent 7cef85c1c6
commit a0bebbf72d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 6 deletions

View File

@ -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.43"
__version__ = "0.11.44"
class StopSimulation(Exception):

View File

@ -111,7 +111,7 @@ class _TraceSignalsClass(object):
h = _getHierarchy(name, dut)
else:
warnings.warn(
"\n traceSignals(): Deprecated usage: See http://dev.myhdl.org/meps/mep-114.html",
"\n traceSignals(): Deprecated usage: See http://dev.myhdl.org/meps/mep-114.html",
category=DeprecationWarning,
stacklevel=2,
)
@ -125,7 +125,7 @@ class _TraceSignalsClass(object):
vcdpath = os.path.join(directory, filename + ".vcd")
if path.exists(vcdpath):
if self.tracebackup :
if self.tracebackup:
backup = vcdpath[:-4] + '.' + str(path.getmtime(vcdpath)) + '.vcd'
shutil.copyfile(vcdpath, backup)
os.remove(vcdpath)
@ -245,13 +245,15 @@ def _writeVcdSigs(f, hierarchy, tracelists):
siglist.append(s)
w = s._nrbits
# use real for enum strings
# 03-02-2024-04-2014 jb
# Impulse has a 'string'type (since 2014, see above
if w and not isinstance(sval, EnumItemType):
if w == 1:
print("$var reg 1 %s %s(%i) $end" % (s._code, n, memindex), file=f)
else:
print("$var reg %s %s %s(%i) $end" % (w, s._code, n, memindex), file=f)
else:
print("$var real 1 %s %s(%i) $end" % (s._code, n, memindex), file=f)
print("$var string 1 %s %s(%i) $end" % (s._code, n, memindex), file=f)
memindex += 1
print("$upscope $end", file=f)
for i in range(curlevel):

View File

@ -64,8 +64,9 @@ from myhdl.conversion._VHDLNameValidation import _nameValid, _usedNames
from myhdl import bin as tobin
_version = myhdl.__version__.replace('.', '')
_shortversion = _version.replace('dev', '')[:-2] # loose the subminor version number
_shortversion, __, __ = myhdl.__version__.replace('dev', '').rpartition('.') # loose the subminor version number
_shortversion = _shortversion.replace('.', '')
_converting = 0
_profileFunc = None
_enumPortTypeSet = set()
@ -223,6 +224,7 @@ class _ToVHDLConvertor(object):
raise ToVHDLError(_error.PortInList, portname)
# add enum types to port-related set
if isinstance(s._val, EnumItemType):
print('EnumItemType', s._val)
obj = s._val._type
if obj in _enumTypeSet:
_enumTypeSet.remove(obj)