1
0
mirror of https://github.com/myhdl/myhdl.git synced 2025-01-24 21:52:56 +08:00

not giving up

This commit is contained in:
Josy Boelen 2021-03-06 19:49:49 +01:00
parent d6e79678af
commit 493a7e90d8

View File

@ -1195,11 +1195,8 @@ class _ConvertVisitor(ast.NodeVisitor, _ConversionMixin):
if sys.version_info >= (3, 8, 0):
def visit_Constant(self, node):
if node.value in (True, False, None):
# NameConstant
node.id = str(node.value)
self.getName(node)
elif isinstance(node.value, int):
if isinstance(node.value, int):
# Num
n = node.value
if isinstance(node.vhd, vhd_std_logic):
self.write("'%s'" % n)
@ -1223,7 +1220,12 @@ class _ConvertVisitor(ast.NodeVisitor, _ConversionMixin):
self.write(n)
if n < 0:
self.write(")")
elif node.value in (True, False, None):
# NameConstant
node.id = str(node.value)
self.getName(node)
elif isinstance(node.value, str):
# Str
typemark = 'string'
if isinstance(node.vhd, vhd_unsigned):
typemark = 'unsigned'
@ -2292,19 +2294,19 @@ class _AnnotateTypesVisitor(ast.NodeVisitor, _ConversionMixin):
if sys.version_info >= (3, 8, 0):
def visit_Constant(self, node):
if node.value is None:
if node.value in (True, False, None):
# NameConstant
node.vhd = vhd_string()
node.vhdOri = copy(node.vhd)
elif node.value in (True, False):
node.vhd = inferVhdlObj(node.value)
node.vhdOri = copy(node.vhd)
elif isinstance(node.value, str):
# Str
node.vhd = vhd_string()
elif isinstance(node.value, int):
# Num
if node.value < 0:
node.vhd = vhd_int()
else:
node.vhd = vhd_nat()
node.vhdOri = copy(node.vhd)
node.vhdOri = copy(node.vhd)
else: