lib.fifo: change FIFOInterface() diagnostics to follow Memory().

This commit is contained in:
whitequark 2019-09-23 11:03:50 +00:00
parent ca6b1f2f1c
commit 2da0133d52
2 changed files with 11 additions and 8 deletions

View file

@ -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