mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +08:00
Added missing visit_NameConnstant() for Python versions 3.7 adn 3.8 (#380)
Modified test
This commit is contained in:
parent
79cf2218f4
commit
279941b8b8
@ -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)
|
||||
|
@ -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:
|
||||
@ -28,9 +30,10 @@ def decRef(count, enable, clock, reset, n):
|
||||
else:
|
||||
if enable:
|
||||
if count == -n:
|
||||
count.next = n-1
|
||||
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
|
||||
count.next = n - 1
|
||||
else:
|
||||
count.next = count - 1
|
||||
|
||||
return decProcess
|
||||
|
||||
|
||||
@ -65,7 +70,7 @@ def decFunc(count, enable, clock, reset, n):
|
||||
def decFuncFunc(cnt):
|
||||
count_next = intbv(0, min=-n, max=n)
|
||||
if cnt == -n:
|
||||
count_next[:] = n-1
|
||||
count_next[:] = n - 1
|
||||
else:
|
||||
count_next[:] = cnt - 1
|
||||
return count_next
|
||||
@ -87,7 +92,7 @@ def decTask(count, enable, clock, reset, n):
|
||||
def decTaskFunc(cnt, enable, reset, n):
|
||||
if enable:
|
||||
if cnt == -n:
|
||||
cnt[:] = n-1
|
||||
cnt[:] = n - 1
|
||||
else:
|
||||
cnt[:] = cnt - 1
|
||||
|
||||
@ -113,7 +118,7 @@ def decTaskFreeVar(count, enable, clock, reset, n):
|
||||
def decTaskFunc():
|
||||
if enable:
|
||||
if count == -n:
|
||||
count.next = n-1
|
||||
count.next = n - 1
|
||||
else:
|
||||
count.next = count - 1
|
||||
|
||||
@ -134,7 +139,7 @@ def decTaskFreeVar(count, enable, clock, reset, n):
|
||||
def DecBench(dec):
|
||||
|
||||
m = 8
|
||||
n = 2 ** (m-1)
|
||||
n = 2 ** (m - 1)
|
||||
|
||||
count = Signal(intbv(0, min=-n, max=n))
|
||||
count_v = Signal(intbv(0, min=-n, max=n))
|
||||
@ -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,36 +189,38 @@ 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
|
||||
|
||||
## def testDecTaskFreeVar():
|
||||
## assert verify(DecBench, decTaskFreeVar) == 0
|
||||
# # def testDecRef(self):
|
||||
# # sim = self.bench(decRef)
|
||||
# # sim.run(quiet=1)
|
||||
|
||||
## def testDecRef(self):
|
||||
## sim = self.bench(decRef)
|
||||
## sim.run(quiet=1)
|
||||
# # def testDec(self):
|
||||
# # sim = self.bench(dec)
|
||||
# # sim.run(quiet=1)
|
||||
|
||||
## def testDec(self):
|
||||
## sim = self.bench(dec)
|
||||
## sim.run(quiet=1)
|
||||
# # def testDecFunc(self):
|
||||
# # sim = self.bench(decFunc)
|
||||
# # sim.run(quiet=1)
|
||||
|
||||
## def testDecFunc(self):
|
||||
## sim = self.bench(decFunc)
|
||||
## sim.run(quiet=1)
|
||||
# # signed inout in task doesn't work yet in Icarus
|
||||
# # def testDecTask(self):
|
||||
# # sim = self.bench(decTask)
|
||||
# # sim.run(quiet=1)
|
||||
|
||||
## signed inout in task doesn't work yet in Icarus
|
||||
## def testDecTask(self):
|
||||
## sim = self.bench(decTask)
|
||||
## sim.run(quiet=1)
|
||||
|
||||
## def testDecTaskFreeVar(self):
|
||||
## sim = self.bench(decTaskFreeVar)
|
||||
## sim.run(quiet=1)
|
||||
# # def testDecTaskFreeVar(self):
|
||||
# # sim = self.bench(decTaskFreeVar)
|
||||
# # sim.run(quiet=1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user