From b5b1f1753e115e0d60ca2216b8447ba2254a6807 Mon Sep 17 00:00:00 2001 From: Matt Guthaus Date: Thu, 17 Nov 2016 16:33:38 -0800 Subject: [PATCH] Rename tests. Make 4 pin test. --- compiler/router/grid.py | 2 +- compiler/router/router.py | 13 ++- compiler/router/tests/01_no_blockages_test.py | 14 +-- compiler/router/tests/02_blockages_test.py | 79 +++++++++++++++++ .../router/tests/03_same_layer_pins_test.py | 80 ++++++++++++++++++ .../router/tests/04_diff_layer_pins_test.py | 80 ++++++++++++++++++ compiler/router/tests/05_two_nets_test.py | 80 ++++++++++++++++++ .../tests/ABCD_m1m2_diff_layer_pins.gds | Bin 0 -> 4096 bytes ..._B_m1m2_blockages.gds => AB_blockages.gds} | Bin ...to_B_m1m2_blockages.sp => AB_blockages.sp} | 0 ..._layer_pins.gds => AB_diff_layer_pins.gds} | Bin ...ff_layer_pins.sp => AB_diff_layer_pins.sp} | 0 ...B_no_blockages.gds => AB_no_blockages.gds} | Bin ..._same_layer_pins.sp => AB_no_blockages.sp} | 0 ..._layer_pins.gds => AB_same_layer_pins.gds} | Bin ..._no_blockages.sp => AB_same_layer_pins.sp} | 0 compiler/router/tests/A_to_B_m1_only.gds | Bin 2048 -> 0 bytes compiler/router/tests/temp.gds | Bin 0 -> 3127 bytes 18 files changed, 327 insertions(+), 21 deletions(-) create mode 100644 compiler/router/tests/02_blockages_test.py create mode 100644 compiler/router/tests/03_same_layer_pins_test.py create mode 100644 compiler/router/tests/04_diff_layer_pins_test.py create mode 100644 compiler/router/tests/05_two_nets_test.py create mode 100644 compiler/router/tests/ABCD_m1m2_diff_layer_pins.gds rename compiler/router/tests/{A_to_B_m1m2_blockages.gds => AB_blockages.gds} (100%) rename compiler/router/tests/{A_to_B_m1m2_blockages.sp => AB_blockages.sp} (100%) rename compiler/router/tests/{A_to_B_m1m2_diff_layer_pins.gds => AB_diff_layer_pins.gds} (100%) rename compiler/router/tests/{A_to_B_m1m2_diff_layer_pins.sp => AB_diff_layer_pins.sp} (100%) rename compiler/router/tests/{A_to_B_no_blockages.gds => AB_no_blockages.gds} (100%) rename compiler/router/tests/{A_to_B_m1m2_same_layer_pins.sp => AB_no_blockages.sp} (100%) rename compiler/router/tests/{A_to_B_m1m2_same_layer_pins.gds => AB_same_layer_pins.gds} (100%) rename compiler/router/tests/{A_to_B_no_blockages.sp => AB_same_layer_pins.sp} (100%) delete mode 100644 compiler/router/tests/A_to_B_m1_only.gds create mode 100644 compiler/router/tests/temp.gds diff --git a/compiler/router/grid.py b/compiler/router/grid.py index 6a22b8ab..97db164f 100644 --- a/compiler/router/grid.py +++ b/compiler/router/grid.py @@ -192,7 +192,7 @@ class grid: We will use an A* search, so this cost must be pessimistic. Cost so far will be the length of the path. """ - debug.info(0,"Initializing queue.") + debug.info(1,"Initializing queue.") for s in self.source: cost = self.cost_to_target(s) debug.info(2,"Init: cost=" + str(cost) + " " + str([s])) diff --git a/compiler/router/router.py b/compiler/router/router.py index 01b252a8..c5fa65d4 100644 --- a/compiler/router/router.py +++ b/compiler/router/router.py @@ -30,7 +30,6 @@ class router: self.pin_layers = {} self.boundary = self.layout.measureBoundary(self.top_name) - #print "Boundary: ",self.boundary self.ll = vector(self.boundary[0]) self.ur = vector(self.boundary[1]) self.size = self.ur - self.ll @@ -60,7 +59,7 @@ class router: # This is so we can use a single resolution grid for both layers self.track_width = max(self.horiz_track_width,self.vert_track_width) - print "Track width:",self.track_width + debug.info(1,"Track width:"+str(self.track_width)) @@ -72,16 +71,16 @@ class router: # We will offset so ll is at (-track_halo*track_width,-track_halo*track_width) track_width_offset = vector([track_halo*self.track_width]*2) self.offset = self.ll - track_width_offset - print "Offset: ",self.offset + debug.info(1,"Offset: "+str(self.offset)) width = self.size.x height = self.size.y - print "Size: ", width,height + debug.info(1,"Size: {0} x {1}".format(width,height)) # pad the tracks on each side by the halo as well self.width_in_tracks = int(math.ceil(width/self.track_width)) + 2*track_halo self.height_in_tracks = int(math.ceil(height/self.track_width)) + 2*track_halo - print "Size (in tracks): ", self.width_in_tracks, self.height_in_tracks + debug.info(1,"Size (in tracks): {0} x {1}".format(self.width_in_tracks, self.height_in_tracks)) self.rg = grid.grid(self.width_in_tracks,self.height_in_tracks) @@ -92,9 +91,7 @@ class router: debug.info(3,"Find pin {0} layer {1} shape {2}".format(pin_name,str(pin_layer),str(pin_shape))) # repack the shape as a pair of vectors rather than four values shape=[vector(pin_shape[0],pin_shape[1]),vector(pin_shape[2],pin_shape[3])] - print shape new_shape = self.convert_shape_to_tracks(shape,round_bigger=False) - print new_shape self.pin_names.append(pin_name) self.pin_shapes[str(pin)] = new_shape self.pin_layers[str(pin)] = pin_layer @@ -116,7 +113,7 @@ class router: self.find_blockages() # returns the path in tracks path = self.rg.route() - debug.info(0,"Found path. ") + debug.info(1,"Found path. ") debug.info(2,str(path)) self.set_path(path) # First, simplify the path. diff --git a/compiler/router/tests/01_no_blockages_test.py b/compiler/router/tests/01_no_blockages_test.py index 2254ba5e..47e534e3 100644 --- a/compiler/router/tests/01_no_blockages_test.py +++ b/compiler/router/tests/01_no_blockages_test.py @@ -54,20 +54,10 @@ class no_blockages_test(unittest.TestCase): self.add_wire(layer_stack,path) - r = routing("test1", "A_to_B_no_blockages") - self.local_check(r) - - r = routing("A_to_B_m1m2_blockages") - self.local_check(r) - - r = routing("A_to_B_m1m2_same_layer_pins") - self.local_check(r) - - r = routing("A_to_B_m1m2_diff_layer_pins") + r = routing("test1", "AB_no_blockages") self.local_check(r) # fails if there are any DRC errors on any cells - self.assertEqual(drc_errors, 0) globals.end_openram() @@ -76,7 +66,7 @@ class no_blockages_test(unittest.TestCase): r.gds_write(tempgds) self.assertFalse(calibre.run_drc(r.name, tempgds)) os.remove(tempgds) - assert(0) + diff --git a/compiler/router/tests/02_blockages_test.py b/compiler/router/tests/02_blockages_test.py new file mode 100644 index 00000000..485b39f6 --- /dev/null +++ b/compiler/router/tests/02_blockages_test.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python2.7 +"Run a regresion test the library cells for DRC" + +import unittest +from testutils import header +import sys,os +sys.path.append(os.path.join(sys.path[0],"../..")) +sys.path.append(os.path.join(sys.path[0],"..")) +import globals +import debug +import calibre + + +class no_blockages_test(unittest.TestCase): + + def runTest(self): + globals.init_openram("config_{0}".format(OPTS.tech_name)) + + import design + import router + + class gdscell(design.design): + """ + A generic GDS design that we can route on. + """ + def __init__(self, name): + #design.design.__init__(self, name) + debug.info(2, "Create {0} object".format(name)) + self.name = name + self.gds_file = name + ".gds" + self.sp_file = name + ".sp" + design.hierarchy_layout.layout.__init__(self, name) + design.hierarchy_spice.spice.__init__(self, name) + + class routing(design.design): + """ + A generic GDS design that we can route on. + """ + def __init__(self, name, gdsname): + design.design.__init__(self, name) + debug.info(2, "Create {0} object".format(name)) + + cell = gdscell(gdsname) + self.add_inst(name=gdsname, + mod=cell, + offset=[0,0]) + self.connect_inst([]) + + 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) + + + r = routing("test1", "AB_blockages") + self.local_check(r) + + # fails if there are any DRC errors on any cells + globals.end_openram() + + + def local_check(self, r): + tempgds = OPTS.openram_temp + "temp.gds" + r.gds_write(tempgds) + self.assertFalse(calibre.run_drc(r.name, tempgds)) + os.remove(tempgds) + + + + + +# instantiate a copy of the class to actually run the test +if __name__ == "__main__": + (OPTS, args) = globals.parse_args() + del sys.argv[1:] + header(__file__, OPTS.tech_name) + unittest.main() diff --git a/compiler/router/tests/03_same_layer_pins_test.py b/compiler/router/tests/03_same_layer_pins_test.py new file mode 100644 index 00000000..c8b10142 --- /dev/null +++ b/compiler/router/tests/03_same_layer_pins_test.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python2.7 +"Run a regresion test the library cells for DRC" + +import unittest +from testutils import header +import sys,os +sys.path.append(os.path.join(sys.path[0],"../..")) +sys.path.append(os.path.join(sys.path[0],"..")) +import globals +import debug +import calibre + + +class no_blockages_test(unittest.TestCase): + + def runTest(self): + globals.init_openram("config_{0}".format(OPTS.tech_name)) + + import design + import router + + class gdscell(design.design): + """ + A generic GDS design that we can route on. + """ + def __init__(self, name): + #design.design.__init__(self, name) + debug.info(2, "Create {0} object".format(name)) + self.name = name + self.gds_file = name + ".gds" + self.sp_file = name + ".sp" + design.hierarchy_layout.layout.__init__(self, name) + design.hierarchy_spice.spice.__init__(self, name) + + class routing(design.design): + """ + A generic GDS design that we can route on. + """ + def __init__(self, name, gdsname): + design.design.__init__(self, name) + debug.info(2, "Create {0} object".format(name)) + + cell = gdscell(gdsname) + self.add_inst(name=gdsname, + mod=cell, + offset=[0,0]) + self.connect_inst([]) + + 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) + + + r = routing("test1", "AB_same_layer_pins") + self.local_check(r) + + + # fails if there are any DRC errors on any cells + globals.end_openram() + + + def local_check(self, r): + tempgds = OPTS.openram_temp + "temp.gds" + r.gds_write(tempgds) + self.assertFalse(calibre.run_drc(r.name, tempgds)) + os.remove(tempgds) + + + + + +# instantiate a copy of the class to actually run the test +if __name__ == "__main__": + (OPTS, args) = globals.parse_args() + del sys.argv[1:] + header(__file__, OPTS.tech_name) + unittest.main() diff --git a/compiler/router/tests/04_diff_layer_pins_test.py b/compiler/router/tests/04_diff_layer_pins_test.py new file mode 100644 index 00000000..0577c966 --- /dev/null +++ b/compiler/router/tests/04_diff_layer_pins_test.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python2.7 +"Run a regresion test the library cells for DRC" + +import unittest +from testutils import header +import sys,os +sys.path.append(os.path.join(sys.path[0],"../..")) +sys.path.append(os.path.join(sys.path[0],"..")) +import globals +import debug +import calibre + + +class no_blockages_test(unittest.TestCase): + + def runTest(self): + globals.init_openram("config_{0}".format(OPTS.tech_name)) + + import design + import router + + class gdscell(design.design): + """ + A generic GDS design that we can route on. + """ + def __init__(self, name): + #design.design.__init__(self, name) + debug.info(2, "Create {0} object".format(name)) + self.name = name + self.gds_file = name + ".gds" + self.sp_file = name + ".sp" + design.hierarchy_layout.layout.__init__(self, name) + design.hierarchy_spice.spice.__init__(self, name) + + class routing(design.design): + """ + A generic GDS design that we can route on. + """ + def __init__(self, name, gdsname): + design.design.__init__(self, name) + debug.info(2, "Create {0} object".format(name)) + + cell = gdscell(gdsname) + self.add_inst(name=gdsname, + mod=cell, + offset=[0,0]) + self.connect_inst([]) + + 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) + + + + r = routing("test1", "AB_diff_layer_pins") + self.local_check(r) + + # fails if there are any DRC errors on any cells + globals.end_openram() + + + def local_check(self, r): + tempgds = OPTS.openram_temp + "temp.gds" + r.gds_write(tempgds) + self.assertFalse(calibre.run_drc(r.name, tempgds)) + os.remove(tempgds) + + + + + +# instantiate a copy of the class to actually run the test +if __name__ == "__main__": + (OPTS, args) = globals.parse_args() + del sys.argv[1:] + header(__file__, OPTS.tech_name) + unittest.main() diff --git a/compiler/router/tests/05_two_nets_test.py b/compiler/router/tests/05_two_nets_test.py new file mode 100644 index 00000000..0577c966 --- /dev/null +++ b/compiler/router/tests/05_two_nets_test.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python2.7 +"Run a regresion test the library cells for DRC" + +import unittest +from testutils import header +import sys,os +sys.path.append(os.path.join(sys.path[0],"../..")) +sys.path.append(os.path.join(sys.path[0],"..")) +import globals +import debug +import calibre + + +class no_blockages_test(unittest.TestCase): + + def runTest(self): + globals.init_openram("config_{0}".format(OPTS.tech_name)) + + import design + import router + + class gdscell(design.design): + """ + A generic GDS design that we can route on. + """ + def __init__(self, name): + #design.design.__init__(self, name) + debug.info(2, "Create {0} object".format(name)) + self.name = name + self.gds_file = name + ".gds" + self.sp_file = name + ".sp" + design.hierarchy_layout.layout.__init__(self, name) + design.hierarchy_spice.spice.__init__(self, name) + + class routing(design.design): + """ + A generic GDS design that we can route on. + """ + def __init__(self, name, gdsname): + design.design.__init__(self, name) + debug.info(2, "Create {0} object".format(name)) + + cell = gdscell(gdsname) + self.add_inst(name=gdsname, + mod=cell, + offset=[0,0]) + self.connect_inst([]) + + 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) + + + + r = routing("test1", "AB_diff_layer_pins") + self.local_check(r) + + # fails if there are any DRC errors on any cells + globals.end_openram() + + + def local_check(self, r): + tempgds = OPTS.openram_temp + "temp.gds" + r.gds_write(tempgds) + self.assertFalse(calibre.run_drc(r.name, tempgds)) + os.remove(tempgds) + + + + + +# instantiate a copy of the class to actually run the test +if __name__ == "__main__": + (OPTS, args) = globals.parse_args() + del sys.argv[1:] + header(__file__, OPTS.tech_name) + unittest.main() diff --git a/compiler/router/tests/ABCD_m1m2_diff_layer_pins.gds b/compiler/router/tests/ABCD_m1m2_diff_layer_pins.gds new file mode 100644 index 0000000000000000000000000000000000000000..ea4852c9b3be29a42217d7ff3df85e3ac39ffb50 GIT binary patch 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 literal 0 HcmV?d00001 diff --git a/compiler/router/tests/A_to_B_m1m2_blockages.gds b/compiler/router/tests/AB_blockages.gds similarity index 100% rename from compiler/router/tests/A_to_B_m1m2_blockages.gds rename to compiler/router/tests/AB_blockages.gds diff --git a/compiler/router/tests/A_to_B_m1m2_blockages.sp b/compiler/router/tests/AB_blockages.sp similarity index 100% rename from compiler/router/tests/A_to_B_m1m2_blockages.sp rename to compiler/router/tests/AB_blockages.sp diff --git a/compiler/router/tests/A_to_B_m1m2_diff_layer_pins.gds b/compiler/router/tests/AB_diff_layer_pins.gds similarity index 100% rename from compiler/router/tests/A_to_B_m1m2_diff_layer_pins.gds rename to compiler/router/tests/AB_diff_layer_pins.gds diff --git a/compiler/router/tests/A_to_B_m1m2_diff_layer_pins.sp b/compiler/router/tests/AB_diff_layer_pins.sp similarity index 100% rename from compiler/router/tests/A_to_B_m1m2_diff_layer_pins.sp rename to compiler/router/tests/AB_diff_layer_pins.sp diff --git a/compiler/router/tests/A_to_B_no_blockages.gds b/compiler/router/tests/AB_no_blockages.gds similarity index 100% rename from compiler/router/tests/A_to_B_no_blockages.gds rename to compiler/router/tests/AB_no_blockages.gds diff --git a/compiler/router/tests/A_to_B_m1m2_same_layer_pins.sp b/compiler/router/tests/AB_no_blockages.sp similarity index 100% rename from compiler/router/tests/A_to_B_m1m2_same_layer_pins.sp rename to compiler/router/tests/AB_no_blockages.sp diff --git a/compiler/router/tests/A_to_B_m1m2_same_layer_pins.gds b/compiler/router/tests/AB_same_layer_pins.gds similarity index 100% rename from compiler/router/tests/A_to_B_m1m2_same_layer_pins.gds rename to compiler/router/tests/AB_same_layer_pins.gds diff --git a/compiler/router/tests/A_to_B_no_blockages.sp b/compiler/router/tests/AB_same_layer_pins.sp similarity index 100% rename from compiler/router/tests/A_to_B_no_blockages.sp rename to compiler/router/tests/AB_same_layer_pins.sp diff --git a/compiler/router/tests/A_to_B_m1_only.gds b/compiler/router/tests/A_to_B_m1_only.gds deleted file mode 100644 index 71d3fa7639d092d9216ee8ec03549373936c3a86..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2048 zcmeH@F-yZh7>1u*nrp$>RxGV)0_vcPf(oLzNGeXcI*CiG)xnC3{sR}mStu^u+?+c) zIXH+oioZY{{0V+%d(D)=RT8*+KHl7O2QM0hCUO*I#wbxCU|}?eEaNME)IM%rb}pde zdYg^w_1&lYuZ`{gQtxg*Ch`)uF1Oixj9b+DY^BvXKRj)ow8{CP$CbRJs|uNGj@j#G z_d_oZy4{|P_+=Nu9ms#61HA>g30Z}aT{QNhITgH0crak$1)@G!+FY3GJD=j;g5l&m z)YcN(T$t)l#{=Kc_^USwjX(UK>X)8j>J1F%TC%DMZ7xjp)q}jT2Zpon;9VuOx$xKj gOZ)C4%zT^n8^iYV!kpBeeOUup16c!E1OK6cA0F^LZ~y=R diff --git a/compiler/router/tests/temp.gds b/compiler/router/tests/temp.gds new file mode 100644 index 0000000000000000000000000000000000000000..4da06d4c0ac6ef8ee3ae7c5103e727d131ea6c5d GIT binary patch literal 3127 zcmbu>Pe{{Y9LMp;x%~`Nn|uUn{L!<)u~BoqJu#gA`Q_{Hr)LjtPxe(Gf4gh?6K>rZ1n+0x z%!FAJzhX?#9g|lGdSb?yd&%}FioQqD#I8IWX?Ai5b5_pdz2@9^U(#QA{j&^SAC<>O zU!RR4nYX_F1z#`9@5=jU&oX%btjxXsv;@!Ai}0+>y}nj~XHQG;tjxXsqz=#4D)6k# zz5X~2&z{ubS($tNQ30MkPQ$Y@_xi&%c=o6O&&u5E5BA{M!!>wT=3c*FgJ%!+;8~e_ z{caMT-LJv3GWYtO96Y<5glA>$_1jDE>`o4zmATh%mEqa#C3sfmUcXU=XSd4mtjxWB zUAX@Lu^Ux*R_0#6nt^B64LmDzuU{_0v#S|+R_0zmSAu7ki}0+>y?(j^&(4+LS($tN zL>-=;uE4W0Z}lzrUvYA+^#0u;*PNXk!kl&Aznkt_8D6VS_pv@t*S7?(RmVN{-1+|L zZsp*$>bb|BJ3ZY%5?-sGd+fQ>(+$?(wd%RYo;y9=&>p;2J@?pir>7fUgV(C(9((Te zbom0jRz3IFbEl_!l7`o+=N^0R^mOBOc&&QwvFA=t_o4!?RnI;4-0A6NO7L3s++)w3 zo^HMfuT{@I_T1^|Rxn{9Hl>FQ66KG&O$e03$;<>%+dx(4eo-Vdm$;GdP} zA2hp~A2elSLca65xuw7CoX!7rqip%0Xn#-A@V0F|n6vWCd7+dvzBZd}IC;v-!~gk< vZv??e_;xWI4Hp)}m#-J6=cZoGEQ^&3+?nFXb$ey?Y7Qig`B6CE9gmwoQpy0$ literal 0 HcmV?d00001