mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +08:00
not giving up
This commit is contained in:
parent
d6e79678af
commit
97c9ed3d3b
@ -1199,7 +1199,14 @@ class _ConvertVisitor(ast.NodeVisitor, _ConversionMixin):
|
|||||||
# NameConstant
|
# NameConstant
|
||||||
node.id = str(node.value)
|
node.id = str(node.value)
|
||||||
self.getName(node)
|
self.getName(node)
|
||||||
|
elif isinstance(node.value, str):
|
||||||
|
# Str
|
||||||
|
typemark = 'string'
|
||||||
|
if isinstance(node.vhd, vhd_unsigned):
|
||||||
|
typemark = 'unsigned'
|
||||||
|
self.write("%s'(\"%s\")" % (typemark, node.value))
|
||||||
elif isinstance(node.value, int):
|
elif isinstance(node.value, int):
|
||||||
|
# Num
|
||||||
n = node.value
|
n = node.value
|
||||||
if isinstance(node.vhd, vhd_std_logic):
|
if isinstance(node.vhd, vhd_std_logic):
|
||||||
self.write("'%s'" % n)
|
self.write("'%s'" % n)
|
||||||
@ -1223,11 +1230,6 @@ class _ConvertVisitor(ast.NodeVisitor, _ConversionMixin):
|
|||||||
self.write(n)
|
self.write(n)
|
||||||
if n < 0:
|
if n < 0:
|
||||||
self.write(")")
|
self.write(")")
|
||||||
elif isinstance(node.value, str):
|
|
||||||
typemark = 'string'
|
|
||||||
if isinstance(node.vhd, vhd_unsigned):
|
|
||||||
typemark = 'unsigned'
|
|
||||||
self.write("%s'(\"%s\")" % (typemark, node.value))
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
@ -2292,14 +2294,16 @@ class _AnnotateTypesVisitor(ast.NodeVisitor, _ConversionMixin):
|
|||||||
if sys.version_info >= (3, 8, 0):
|
if sys.version_info >= (3, 8, 0):
|
||||||
|
|
||||||
def visit_Constant(self, node):
|
def visit_Constant(self, node):
|
||||||
if node.value is None:
|
if node.value in (True, False, None):
|
||||||
# NameConstant
|
# NameConstant
|
||||||
node.vhd = vhd_string()
|
|
||||||
node.vhdOri = copy(node.vhd)
|
|
||||||
elif node.value in (True, False):
|
|
||||||
node.vhd = inferVhdlObj(node.value)
|
node.vhd = inferVhdlObj(node.value)
|
||||||
node.vhdOri = copy(node.vhd)
|
node.vhdOri = copy(node.vhd)
|
||||||
|
elif isinstance(node.value, str):
|
||||||
|
# Str
|
||||||
|
node.vhd = vhd_string()
|
||||||
|
node.vhdOri = copy(node.vhd)
|
||||||
elif isinstance(node.value, int):
|
elif isinstance(node.value, int):
|
||||||
|
# Num
|
||||||
if node.value < 0:
|
if node.value < 0:
|
||||||
node.vhd = vhd_int()
|
node.vhd = vhd_int()
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user