build.res: allow querying frequency of a previously constrained clock.
This commit is contained in:
parent
c9879c795b
commit
b45c5119f5
2 changed files with 27 additions and 6 deletions
|
|
@ -168,6 +168,12 @@ class ResourceManagerTestCase(FHDLTestCase):
|
|||
(scl_port, 100e3)
|
||||
])
|
||||
|
||||
def test_get_clock(self):
|
||||
clk100 = self.cm.request("clk100", 0)
|
||||
self.assertEqual(self.cm.get_clock_constraint(clk100), 100e6)
|
||||
with self.assertRaises(KeyError):
|
||||
self.cm.get_clock_constraint(Signal())
|
||||
|
||||
def test_wrong_resources(self):
|
||||
with self.assertRaises(TypeError, msg="Object 'wrong' is not a Resource"):
|
||||
self.cm.add_resources(['wrong'])
|
||||
|
|
@ -203,6 +209,12 @@ class ResourceManagerTestCase(FHDLTestCase):
|
|||
msg="Frequency must be a number, not None"):
|
||||
self.cm.add_clock_constraint(Signal(), None)
|
||||
|
||||
def test_wrong_clock_pin(self):
|
||||
with self.assertRaises(ValueError,
|
||||
msg="The Pin object (rec <unnamed> i), which is not a previously requested "
|
||||
"resource, cannot be used to desigate a clock"):
|
||||
self.cm.add_clock_constraint(Pin(1, dir="i"), 1e6)
|
||||
|
||||
def test_wrong_request_duplicate(self):
|
||||
with self.assertRaises(ResourceError,
|
||||
msg="Resource user_led#0 has already been requested"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue