From e215885b2fb8d5324204134124150d58a6f3c017 Mon Sep 17 00:00:00 2001 From: Matt Guthaus Date: Thu, 17 Nov 2016 16:46:41 -0800 Subject: [PATCH] Update unit tests. --- compiler/router/router.py | 11 ++++++++++- compiler/router/tests/01_no_blockages_test.py | 2 +- compiler/router/tests/02_blockages_test.py | 2 +- compiler/router/tests/03_same_layer_pins_test.py | 2 +- compiler/router/tests/04_diff_layer_pins_test.py | 1 - compiler/router/tests/05_two_nets_test.py | 8 ++++++-- .../router/tests/ABCD_m1m2_diff_layer_pins.gds | Bin 4096 -> 0 bytes compiler/router/tests/ABCD_two_nets.gds | Bin 0 -> 4096 bytes compiler/router/tests/ABCD_two_nets.sp | 3 +++ 9 files changed, 22 insertions(+), 7 deletions(-) delete mode 100644 compiler/router/tests/ABCD_m1m2_diff_layer_pins.gds create mode 100644 compiler/router/tests/ABCD_two_nets.gds create mode 100644 compiler/router/tests/ABCD_two_nets.sp diff --git a/compiler/router/router.py b/compiler/router/router.py index c5fa65d4..aa66833e 100644 --- a/compiler/router/router.py +++ b/compiler/router/router.py @@ -104,12 +104,21 @@ class router: for layer in self.layers: self.write_obstacle(self.top_name) + def clear_pins(self): + self.source = [] + self.dest = [] - def route(self,layers,src, dest): + def route(self, layers, src, dest): + """ + Route a single source-destination net and return + the simplified rectilinear path. + """ + self.clear_pins() self.set_layers(layers) self.create_routing_grid() self.set_source(src) self.set_target(dest) + self.find_blockages() # returns the path in tracks path = self.rg.route() diff --git a/compiler/router/tests/01_no_blockages_test.py b/compiler/router/tests/01_no_blockages_test.py index 47e534e3..984a9037 100644 --- a/compiler/router/tests/01_no_blockages_test.py +++ b/compiler/router/tests/01_no_blockages_test.py @@ -49,7 +49,7 @@ class no_blockages_test(unittest.TestCase): r=router.router(gdsname+".gds") layer_stack =("metal1","via1","metal2") path=r.route(layer_stack,src="A",dest="B") - r.rg.view() + #r.rg.view() self.add_wire(layer_stack,path) diff --git a/compiler/router/tests/02_blockages_test.py b/compiler/router/tests/02_blockages_test.py index 485b39f6..900462b0 100644 --- a/compiler/router/tests/02_blockages_test.py +++ b/compiler/router/tests/02_blockages_test.py @@ -49,7 +49,7 @@ class no_blockages_test(unittest.TestCase): r=router.router(gdsname+".gds") layer_stack =("metal1","via1","metal2") path=r.route(layer_stack,src="A",dest="B") - r.rg.view() + #r.rg.view() self.add_wire(layer_stack,path) diff --git a/compiler/router/tests/03_same_layer_pins_test.py b/compiler/router/tests/03_same_layer_pins_test.py index c8b10142..6a20ef3a 100644 --- a/compiler/router/tests/03_same_layer_pins_test.py +++ b/compiler/router/tests/03_same_layer_pins_test.py @@ -49,7 +49,7 @@ class no_blockages_test(unittest.TestCase): r=router.router(gdsname+".gds") layer_stack =("metal1","via1","metal2") path=r.route(layer_stack,src="A",dest="B") - r.rg.view() + #r.rg.view() self.add_wire(layer_stack,path) diff --git a/compiler/router/tests/04_diff_layer_pins_test.py b/compiler/router/tests/04_diff_layer_pins_test.py index 0577c966..0a7f5bbe 100644 --- a/compiler/router/tests/04_diff_layer_pins_test.py +++ b/compiler/router/tests/04_diff_layer_pins_test.py @@ -49,7 +49,6 @@ class no_blockages_test(unittest.TestCase): r=router.router(gdsname+".gds") layer_stack =("metal1","via1","metal2") path=r.route(layer_stack,src="A",dest="B") - r.rg.view() self.add_wire(layer_stack,path) diff --git a/compiler/router/tests/05_two_nets_test.py b/compiler/router/tests/05_two_nets_test.py index 0577c966..0533a743 100644 --- a/compiler/router/tests/05_two_nets_test.py +++ b/compiler/router/tests/05_two_nets_test.py @@ -49,13 +49,17 @@ class no_blockages_test(unittest.TestCase): r=router.router(gdsname+".gds") layer_stack =("metal1","via1","metal2") path=r.route(layer_stack,src="A",dest="B") + self.add_wire(layer_stack,path) + + path=r.route(layer_stack,src="C",dest="D") + self.add_wire(layer_stack,path) + r.rg.view() - self.add_wire(layer_stack,path) - r = routing("test1", "AB_diff_layer_pins") + r = routing("test1", "ABCD_two_nets") self.local_check(r) # fails if there are any DRC errors on any cells diff --git a/compiler/router/tests/ABCD_m1m2_diff_layer_pins.gds b/compiler/router/tests/ABCD_m1m2_diff_layer_pins.gds deleted file mode 100644 index ea4852c9b3be29a42217d7ff3df85e3ac39ffb50..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeHJJ!=$E6umP$``k<>lXW9zH*O&*gAi6CXd@a!8nMz!gf(D<;0GZXl@wN@jjcr# zB!xDDMH&l>*rc%ZCkXlzB--eB?tSm=zTNDMJ6q4do3q@V^X`4;e$0>}pAg|=yyAOztmCEN&?!SKb{p!KF*&EYeuY8E8Sx)EHlzO2Z$bMo0{XMK_U9@(fL>hIJ zI?hU|X^-zSe2=Q7B>4+#s3>S)Im$T7Cdr?DqOmQF;SxCS!7*sWiAM(b@%5;)ga(9C^y%OTCY>Xzf$!{^3>lg5b%17Qq*L zDj(;51D||O#$D()=b*J`oIieo=NE8p#*ajkp@Y_rS{a-_=4qXn&$=;RqqS%2SDC~A zoHNAD70xkew06N%|IB0k1zC6SMSn(X&(JUVgy-t;!T3u1?x3~T_4%{v{Y3dfV|#lC z8#uKelWHi4k{W%u$JLLD2Zl>T<8QlY?Y8=jcg&T;-PY?J`ydeSfW0sFdUvLht{Eaz zJLm(c9fQ`6^SIGFd|fkqV5uGSkJOGqYtQ0K&hdcc?wZM+LFSwPQ~c|kah#Gn@VIW2 zL2HLKl|Mr796Eo_-s$5bcFdj}z0<=Vp?CWDPLB-NI}YFIZhPcEy<^_04j)x|6IJ?D zqkkHWGmH6W(At5LKa7=Ht^ZwZ-Zjng;&tSiFa6%RBej#0hx)w?o|%=y`(vJHk=tM8 zm*js09`Y9F)dlL{s{u1n{F!M2!w}O%VM=}DX@U`zo9+EZR@a$*$*}Q-5(JX2;#Me7 OC{QR+C{QRcSb={exoC?3 diff --git a/compiler/router/tests/ABCD_two_nets.gds b/compiler/router/tests/ABCD_two_nets.gds new file mode 100644 index 0000000000000000000000000000000000000000..07596ec610406d8705b9ed968ac99b271d42471a GIT binary patch literal 4096 zcmeHJF>ljQ5WYChYwEa8ND)mS1L_7ssscrV1wo0rR4l-RkU}MjR0^mX6* zCm-ioYT$R1h)&QM@*Q=1>CWQ%y)~l4<;sQQyRYAUzqWUN`sUQPD<6F7RFb((r5-IW zcKh8Y-Ts61`{#(1t^ ze#_!3L=I(?px9fnD#fC&p2Ye|B8@MBAMsyM?2~DH_}(>q_RV~QV%He0a?F3QiThuO zf=%#{Xx$SOyT%kge9js^`)2+C#g4j1x-{ZH4F9~r`WcHmP#t z&FL8ZG>Sb%KUpWd>Z;YB5qx_;A%4WVYII^A>ldIF2F0GHAM*ZT^Jm;K`~h#0ofzjwAd{iR;v_|--5V|wxw2tr*11iSP$vCYs z{sE?Sgb&{`mD#2>!bg|opVklk@r^=@U6`SyN-f0IAQsdd2Q>)pzt*zuTX_ap!Rzv*h*=<7Z1{yEF`h?>pO?*#jv z>{RA%aI`q|dy?PG=t}K153l+gyx<_b;hvVqUwuJWK6jk;1yswv1G4)=byjpoXn*)Z Wab2TXaV-=m6etuZ6etwfSAl=>o@Y1! literal 0 HcmV?d00001 diff --git a/compiler/router/tests/ABCD_two_nets.sp b/compiler/router/tests/ABCD_two_nets.sp new file mode 100644 index 00000000..d0b092ca --- /dev/null +++ b/compiler/router/tests/ABCD_two_nets.sp @@ -0,0 +1,3 @@ + +.SUBCKT cell +.ENDS cell