lib.cdc: add diagnostic checks for synchronization stage count.
This commit is contained in:
parent
52e761dc33
commit
22da78ca28
2 changed files with 29 additions and 1 deletions
|
|
@ -5,6 +5,14 @@ from ..lib.cdc import *
|
|||
|
||||
|
||||
class FFSynchronizerTestCase(FHDLTestCase):
|
||||
def test_stages_wrong(self):
|
||||
with self.assertRaises(TypeError,
|
||||
msg="Synchronization stage count must be a positive integer, not '0'"):
|
||||
FFSynchronizer(Signal(), Signal(), stages=0)
|
||||
with self.assertRaises(ValueError,
|
||||
msg="Synchronization stage count may not safely be less than 2"):
|
||||
FFSynchronizer(Signal(), Signal(), stages=1)
|
||||
|
||||
def test_basic(self):
|
||||
i = Signal()
|
||||
o = Signal()
|
||||
|
|
@ -43,6 +51,14 @@ class FFSynchronizerTestCase(FHDLTestCase):
|
|||
|
||||
|
||||
class ResetSynchronizerTestCase(FHDLTestCase):
|
||||
def test_stages_wrong(self):
|
||||
with self.assertRaises(TypeError,
|
||||
msg="Synchronization stage count must be a positive integer, not '0'"):
|
||||
ResetSynchronizer(Signal(), stages=0)
|
||||
with self.assertRaises(ValueError,
|
||||
msg="Synchronization stage count may not safely be less than 2"):
|
||||
ResetSynchronizer(Signal(), stages=1)
|
||||
|
||||
def test_basic(self):
|
||||
arst = Signal()
|
||||
m = Module()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue