diff --git a/compiler/gdsMill/gdsMill/gds2reader.py b/compiler/gdsMill/gdsMill/gds2reader.py index ab0e94de..abd87988 100644 --- a/compiler/gdsMill/gdsMill/gds2reader.py +++ b/compiler/gdsMill/gdsMill/gds2reader.py @@ -20,7 +20,7 @@ class Gds2reader: print (number>>(63-index))&0x1, print "\n" - def strip_non_ascii(self,string): + def stripNonASCII(self,string): #''' Returns the string without non ASCII characters''' stripped = (c for c in string if 0 < ord(c) < 127) return "".join(stripped) @@ -290,7 +290,7 @@ class Gds2reader: if(self.debugToTerminal==1): print "\t\tPLEX: "+str(plex) elif(idBits==('\x12','\x06')): #Reference Name - sName = self.strip_non_ascii(record[2::]) + sName = self.stripNonASCII(record[2::]) thisSref.sName=sName.rstrip() if(self.debugToTerminal==1): print "\t\tReference Name:"+sName @@ -595,11 +595,11 @@ class Gds2reader: idBits = (record[0],record[1]) if idBits==('\x07','\x00'): break; #we've reached the end of the structure elif(idBits==('\x06','\x06')): - structName = self.strip_non_ascii(record[2::]) #(record[2:1] + record[1::]).rstrip() + structName = self.stripNonASCII(record[2::]) #(record[2:1] + record[1::]).rstrip() # print ''.[x for x in structName if ord(x) < 128] # stripped = (c for c in structName if 0 < ord(c) < 127) # structName = "".join(stripped) -# print self.strip_non_ascii(structName) ##FIXME: trimming by Tom g. ##could be an issue here with string trimming! +# print self.stripNonASCII(structName) ##FIXME: trimming by Tom g. ##could be an issue here with string trimming! thisStructure.name = structName if(self.debugToTerminal==1): print "\tStructure Name: "+structName @@ -694,11 +694,11 @@ class Gds2reader: idBits = (record[0],record[1]) if idBits==('\x07','\x00'): break; #we've reached the end of the structure elif(idBits==('\x06','\x06')): - structName = self.strip_non_ascii(record[2::]) #(record[2:1] + record[1::]).rstrip() + structName = self.stripNonASCII(record[2::]) #(record[2:1] + record[1::]).rstrip() # print ''.[x for x in structName if ord(x) < 128] # stripped = (c for c in structName if 0 < ord(c) < 127) # structName = "".join(stripped) -# print self.strip_non_ascii(structName) ##FIXME: trimming by Tom g. ##could be an issue here with string trimming! +# print self.stripNonASCII(structName) ##FIXME: trimming by Tom g. ##could be an issue here with string trimming! thisStructure.name = structName if(findStructName==thisStructure.name): wantedStruct=1 @@ -775,11 +775,11 @@ class Gds2reader: idBits = (record[0],record[1]) if idBits==('\x07','\x00'): break; #we've reached the end of the structure elif(idBits==('\x06','\x06')): - structName = self.strip_non_ascii(record[2::]) #(record[2:1] + record[1::]).rstrip() + structName = self.stripNonASCII(record[2::]) #(record[2:1] + record[1::]).rstrip() # print ''.[x for x in structName if ord(x) < 128] # stripped = (c for c in structName if 0 < ord(c) < 127) # structName = "".join(stripped) -# print self.strip_non_ascii(structName) ##FIXME: trimming by Tom g. ##could be an issue here with string trimming! +# print self.stripNonASCIIx(structName) ##FIXME: trimming by Tom g. ##could be an issue here with string trimming! thisStructure.name = structName if(self.debugToTerminal==1): print "\tStructure Name: "+structName diff --git a/compiler/gdsMill/gdsMill/vlsiLayout.py b/compiler/gdsMill/gdsMill/vlsiLayout.py index 4f498b04..6f3e3054 100644 --- a/compiler/gdsMill/gdsMill/vlsiLayout.py +++ b/compiler/gdsMill/gdsMill/vlsiLayout.py @@ -58,12 +58,6 @@ class VlsiLayout: self.tempCoordinates=None self.tempPassFail = True - def strip_non_ascii(string): - ''' Returns the string without non ASCII characters''' - stripped = (c for c in string if 0 < ord(c) < 127) - return ''.join(stripped) - - def rotatedCoordinates(self,coordinatesToRotate,rotateAngle): #helper method to rotate a list of coordinates angle=math.radians(float(0)) @@ -584,7 +578,7 @@ class VlsiLayout: passFailIndex+=1 print "Done\n\n" - def readLayoutBorder(self,borderlayer): + def getLayoutBorder(self,borderlayer): for boundary in self.structures[self.rootStructureName].boundaries: if boundary.drawingLayer==borderlayer: if self.debug: print "Find border "+str(boundary.coordinates) @@ -629,92 +623,131 @@ class VlsiLayout: left_bottom=boundary.coordinates[0] right_top=boundary.coordinates[2] thisBoundary=[left_bottom[0],left_bottom[1],right_top[0],right_top[1]] - thisBoundary=self.tranformRectangle(thisBoundary,StructureuVector,StructurevVector) + thisBoundary=self.transformRectangle(thisBoundary,StructureuVector,StructurevVector) thisBoundary=[thisBoundary[0]+StructureOrigin[0],thisBoundary[1]+StructureOrigin[1], thisBoundary[2]+StructureOrigin[0],thisBoundary[3]+StructureOrigin[1]] - cellBoundary=self.update_boundary(thisBoundary,cellBoundary) + cellBoundary=self.updateBoundary(thisBoundary,cellBoundary) return cellBoundary - def update_boundary(self,thisBoundary,cellBoundary): - [left_butt_X,left_butt_Y,right_top_X,right_top_Y]=thisBoundary + def updateBoundary(self,thisBoundary,cellBoundary): + [left_bott_X,left_bott_Y,right_top_X,right_top_Y]=thisBoundary if cellBoundary==[None,None,None,None]: cellBoundary=thisBoundary else: - if cellBoundary[0]>left_butt_X: - cellBoundary[0]=left_butt_X - if cellBoundary[1]>left_butt_Y: - cellBoundary[1]=left_butt_Y + if cellBoundary[0]>left_bott_X: + cellBoundary[0]=left_bott_X + if cellBoundary[1]>left_bott_Y: + cellBoundary[1]=left_bott_Y if cellBoundary[2]=int(Rectangle[0]))&(label_coordinate[0]<=int(Rectangle[2])) - coordinate_In_Rectangle_y_range=(label_coordinate[1]>=int(Rectangle[1]))&(label_coordinate[1]<=int(Rectangle[3])) + coordinate_In_Rectangle_x_range=(coordinate[0]>=int(rectangle[0]))&(coordinate[0]<=int(rectangle[2])) + coordinate_In_Rectangle_y_range=(coordinate[1]>=int(rectangle[1]))&(coordinate[1]<=int(rectangle[3])) if coordinate_In_Rectangle_x_range & coordinate_In_Rectangle_y_range: return True else: @@ -779,7 +813,7 @@ class VlsiLayout: def cmpBoundaryAreas(A,B): """ - Compares two rectangles and returns the bigger in terms of area. + Compares two rectangles and return true if Area(A)>Area(B). """ area_A=(A[2]-A[0])*(A[3]-A[1]) area_B=(B[2]-B[0])*(B[3]-B[1]) diff --git a/compiler/router/router.py b/compiler/router/router.py index 90b08638..6a7c5fad 100644 --- a/compiler/router/router.py +++ b/compiler/router/router.py @@ -90,7 +90,7 @@ class router: """ # Returns all the shapes that enclose a pin on a given layer - (pin_name,pin_layer,pin_shapes) = self.layout.readAllPinShapes(str(pin)) + (pin_name,pin_layer,pin_shapes) = self.layout.getAllPinShapes(str(pin)) self.pin_shapes[str(pin)]=[] self.pin_names.append(pin_name) diff --git a/compiler/utils.py b/compiler/utils.py index 7149ed85..257313b9 100644 --- a/compiler/utils.py +++ b/compiler/utils.py @@ -39,13 +39,13 @@ def auto_measure_libcell(pin_list, name, units, layer): reader.loadFromFile(cell_gds) cell = {} - measure_result = cell_vlsi.readLayoutBorder(layer) + measure_result = cell_vlsi.getLayoutBorder(layer) if measure_result == None: measure_result = cell_vlsi.measureSize(name) [cell["width"], cell["height"]] = measure_result for pin in pin_list: - cell[str(pin)] = gds_pin_center(cell_vlsi.readPinShape(str(pin))) + cell[str(pin)] = gds_pin_center(cell_vlsi.getPinShapeByLabel(str(pin))) return cell