lib.fifo: change FIFOInterface() diagnostics to follow Memory().
This commit is contained in:
parent
ca6b1f2f1c
commit
2da0133d52
|
@ -61,9 +61,12 @@ class FIFOInterface:
|
|||
r_attributes="")
|
||||
|
||||
def __init__(self, width, depth, *, fwft):
|
||||
if depth <= 0:
|
||||
raise ValueError("FIFO depth must be positive, not {}".format(depth))
|
||||
|
||||
if not isinstance(width, int) or width < 0:
|
||||
raise TypeError("FIFO width must be a non-negative integer, not '{!r}'"
|
||||
.format(width))
|
||||
if not isinstance(depth, int) or depth <= 0:
|
||||
raise TypeError("FIFO depth must be a positive integer, not '{!r}'"
|
||||
.format(depth))
|
||||
self.width = width
|
||||
self.depth = depth
|
||||
self.fwft = fwft
|
||||
|
|
|
@ -7,11 +7,11 @@ from ..lib.fifo import *
|
|||
|
||||
class FIFOTestCase(FHDLTestCase):
|
||||
def test_depth_wrong(self):
|
||||
with self.assertRaises(ValueError,
|
||||
msg="FIFO depth must be positive, not -1"):
|
||||
FIFOInterface(width=8, depth=-1, fwft=True)
|
||||
with self.assertRaises(ValueError,
|
||||
msg="FIFO depth must be positive, not 0"):
|
||||
with self.assertRaises(TypeError,
|
||||
msg="FIFO width must be a non-negative integer, not '-1'"):
|
||||
FIFOInterface(width=-1, depth=8, fwft=True)
|
||||
with self.assertRaises(TypeError,
|
||||
msg="FIFO depth must be a positive integer, not '0'"):
|
||||
FIFOInterface(width=8, depth=0, fwft=True)
|
||||
|
||||
def test_async_depth(self):
|
||||
|
|
Loading…
Reference in a new issue