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

Added missing visit_NameConnstant() for Python versions 3.7 adn 3.8 (#380)

Modified test
This commit is contained in:
Josy Boelen 2022-10-10 20:12:02 +02:00 committed by GitHub
parent 79cf2218f4
commit 279941b8b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 26 deletions

View File

@ -1651,6 +1651,9 @@ class _AnnotateTypesVisitor(ast.NodeVisitor, _ConversionMixin):
def visit_Str(self, node):
node.signed = False
def visit_NameConstant(self, node):
node.signed = False
def visit_Name(self, node):
if isinstance(node.ctx, ast.Store):
self.setName(node)

View File

@ -9,6 +9,7 @@ from myhdl import *
ACTIVE_LOW, INACTIVE_HIGH = 0, 1
@block
def decRef(count, enable, clock, reset, n):
""" Decrementer with enable.
@ -19,6 +20,7 @@ def decRef(count, enable, clock, reset, n):
reset -- asynchronous reset input
n -- counter max value
"""
@instance
def logic():
while 1:
@ -31,6 +33,7 @@ def decRef(count, enable, clock, reset, n):
count.next = n - 1
else:
count.next = count - 1
return logic
@ -44,6 +47,7 @@ def dec(count, enable, clock, reset, n):
reset -- asynchronous reset input
n -- counter max value
"""
@instance
def decProcess():
while 1:
@ -51,11 +55,12 @@ def dec(count, enable, clock, reset, n):
if reset == ACTIVE_LOW:
count.next = 0
else:
if enable:
if enable == True:
if count == -n:
count.next = n - 1
else:
count.next = count - 1
return decProcess
@ -150,6 +155,7 @@ def DecBench(dec):
clock.next = not clock
enables = tuple([min(1, randrange(5)) for i in range(1000)])
@instance
def stimulus():
reset.next = INACTIVE_HIGH
@ -183,16 +189,18 @@ def DecBench(dec):
def testDecRef():
assert DecBench(decRef).verify_convert() == 0
def testDec():
assert DecBench(dec).verify_convert() == 0
def testDecFunc():
assert DecBench(decFunc).verify_convert() == 0
def testDecTask():
assert DecBench(decTask).verify_convert() == 0
# # def testDecTaskFreeVar():
# # assert verify(DecBench, decTaskFreeVar) == 0