Skip to content

Commit

Permalink
[TestNet] Improve testSetPinsMultiSrcStatic to track many sources (#1082
Browse files Browse the repository at this point in the history
)

* [TestNet] Improve testSetPinsMultiSrcStatic to track many sources

Signed-off-by: Eddie Hung <[email protected]>

* Add/improve test

Signed-off-by: Eddie Hung <[email protected]>

* Improve test

Signed-off-by: Eddie Hung <[email protected]>

---------

Signed-off-by: Eddie Hung <[email protected]>
  • Loading branch information
eddieh-xlnx authored Nov 22, 2024
1 parent 34ab95a commit 2c44feb
Showing 1 changed file with 48 additions and 5 deletions.
53 changes: 48 additions & 5 deletions test/src/com/xilinx/rapidwright/design/TestNet.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

public class TestNet {
@Test
void testSetPinsMultiSrc() {
Design d = new Design("testSetPinsMultiSrc", Device.KCU105);
void testSetPinsDualSrc() {
Design d = new Design("testSetPinsDualSrc", Device.KCU105);
SiteInst si = d.createSiteInst("SLICE_X32Y73");

Net net = new Net("foo");
Expand All @@ -52,6 +52,25 @@ void testSetPinsMultiSrc() {
Assertions.assertEquals(pins.get(1), net.getAlternateSource());
}

@Test
void testSetPinsMultiSrc() {
Design d = new Design("testSetPinsMultiSrc", "xcvc1902");
SiteInst si = d.createSiteInst("SLICE_X249Y83");

Net net = new Net("foo");
List<SitePinInst> pins = Arrays.asList(
new SitePinInst("H_O", si),
new SitePinInst("HQ", si),
new SitePinInst("HQ2", si)
);

Assertions.assertTrue(net.setPins(pins));
Assertions.assertEquals(pins.get(0), net.getSource());
Assertions.assertEquals(pins.get(1), net.getAlternateSource());
Assertions.assertSame(pins.get(2), net.getAlternateSources().get(1));
Assertions.assertEquals(pins.subList(1, 3).toString(), net.getAlternateSources().toString());
}

@Test
void testSetPinsMultiSrcStatic() {
Design d = new Design("testSetPinsMultiSrcStatic", Device.KCU105);
Expand All @@ -60,13 +79,37 @@ void testSetPinsMultiSrcStatic() {
Net net = d.getVccNet();
List<SitePinInst> pins = Arrays.asList(
new SitePinInst("A_O", si),
new SitePinInst("B_O", si),
new SitePinInst("BMUX", si),
new SitePinInst("C_O", si)
);

Assertions.assertTrue(net.setPins(pins));
Assertions.assertNull(net.getSource());
Assertions.assertNull(net.getAlternateSource());
Assertions.assertSame(pins.get(0), net.getSource());
Assertions.assertSame(pins.get(1), net.getAlternateSource());
Assertions.assertSame(pins.get(2), net.getAlternateSources().get(1));
Assertions.assertEquals(pins.subList(1, 3).toString(), net.getAlternateSources().toString());
}

@Test
void testAddPinsMultiSrcStatic() {
Design d = new Design("testSetPinsMultiSrcStatic", "xcvc1902");
SiteInst si = d.createSiteInst("SLICE_X249Y83");

Net net = d.getVccNet();
List<SitePinInst> pins = Arrays.asList(
new SitePinInst("F_O", si),
new SitePinInst("GQ", si),
new SitePinInst("H_O", si)
);
for (SitePinInst spi : pins) {
Assertions.assertTrue(net.addPin(spi));
}

Assertions.assertTrue(net.setPins(pins));
Assertions.assertSame(pins.get(0), net.getSource());
Assertions.assertSame(pins.get(1), net.getAlternateSource());
Assertions.assertSame(pins.get(2), net.getAlternateSources().get(1));
Assertions.assertEquals(pins.subList(1, 3).toString(), net.getAlternateSources().toString());
}

@Test
Expand Down

0 comments on commit 2c44feb

Please sign in to comment.