build.res: detect physical conflicts earlier.
This is useful for two reasons:
1. nMigen can provide better error messages than the platform and
do it earlier in the build pipeline.
2. Many platforms handle diffpairs by only constraining the P pin;
the N pin is completely ignored. If this is undetected,
downstream users (human or software) can rely on this
information assuming it is correct and introduce more errors.
(Of course, this will not catch every mistake, but the most
common is a copy-paste issue, and that will handle it.)
Fixes #124.
This commit is contained in:
parent
7059cb4931
commit
b471e33d7f
2 changed files with 22 additions and 0 deletions
|
|
@ -238,6 +238,16 @@ class ResourceManagerTestCase(FHDLTestCase):
|
|||
self.cm.request("user_led", 0)
|
||||
self.cm.request("user_led", 0)
|
||||
|
||||
def test_wrong_request_duplicate_physical(self):
|
||||
self.cm.add_resources([
|
||||
Resource("clk20", 0, Pins("H1", dir="i")),
|
||||
])
|
||||
self.cm.request("clk100", 0)
|
||||
with self.assertRaises(ResourceError,
|
||||
msg="Resource component clk20_0 uses physical pin H1, but it is already "
|
||||
"used by resource component clk100_0 that was requested earlier"):
|
||||
self.cm.request("clk20", 0)
|
||||
|
||||
def test_wrong_request_with_dir(self):
|
||||
with self.assertRaises(TypeError,
|
||||
msg="Direction must be one of \"i\", \"o\", \"oe\", \"io\", or \"-\", "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue