mirror of https://github.com/VLSIDA/OpenRAM.git
parent
148a5807e2
commit
449781d239
|
|
@ -142,8 +142,8 @@ class polygon_pt:
|
||||||
def alignvector_pt(self, a, dx, dy, alignlinevector, alignpointvector):
|
def alignvector_pt(self, a, dx, dy, alignlinevector, alignpointvector):
|
||||||
n = math.hypot(dx, dy)
|
n = math.hypot(dx, dy)
|
||||||
dx, dy = dx / n, dy / n
|
dx, dy = dx / n, dy / n
|
||||||
linevectors = map(lambda (p1, p2), self=self, a=a, dx=dx, dy=dy, alignlinevector=alignlinevector:
|
linevectors = map(lambda p, self=self, a=a, dx=dx, dy=dy, alignlinevector=alignlinevector:
|
||||||
alignlinevector(a, dx, dy, *(p1 + p2)), self.successivepoints())
|
alignlinevector(a, dx, dy, *(p[0] + p[1])), self.successivepoints())
|
||||||
for linevector in linevectors:
|
for linevector in linevectors:
|
||||||
if type(linevector) is types.TupleType:
|
if type(linevector) is types.TupleType:
|
||||||
return linevector
|
return linevector
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@ class twolines_pt(connector_pt):
|
||||||
if alength is not None: no_lengths += 1
|
if alength is not None: no_lengths += 1
|
||||||
|
|
||||||
if no_angles + no_lengths != 2:
|
if no_angles + no_lengths != 2:
|
||||||
raise NotImplementedError, "Please specify exactly two angles or lengths"
|
raise NotImplementedError("Please specify exactly two angles or lengths")
|
||||||
|
|
||||||
# calculate necessary angles and armlengths
|
# calculate necessary angles and armlengths
|
||||||
# always length1 and relangle1
|
# always length1 and relangle1
|
||||||
|
|
@ -301,7 +301,7 @@ class twolines_pt(connector_pt):
|
||||||
relangle1 = acos((distance**2 + length1**2 - length2**2) / (2.0*distance*length1))
|
relangle1 = acos((distance**2 + length1**2 - length2**2) / (2.0*distance*length1))
|
||||||
middle = self._middle_a(begin, dangle, length1, relangle1)
|
middle = self._middle_a(begin, dangle, length1, relangle1)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError, "I found a strange combination of arguments"
|
raise NotImplementedError("I found a strange combination of arguments")
|
||||||
|
|
||||||
connectorpath = path.path(path.moveto_pt(*self.box1.center),
|
connectorpath = path.path(path.moveto_pt(*self.box1.center),
|
||||||
path.lineto_pt(*middle),
|
path.lineto_pt(*middle),
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ def controldists_from_endgeometry_pt(A, B, tangA, tangB, curvA, curvB, allownega
|
||||||
return []
|
return []
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
print "fallback with exact zero value"
|
print("fallback with exact zero value")
|
||||||
return [(a, b)]
|
return [(a, b)]
|
||||||
# >>>
|
# >>>
|
||||||
def fallback_smallT(T, D, E, AB, curvA, curvB, threshold, debug):# <<<
|
def fallback_smallT(T, D, E, AB, curvA, curvB, threshold, debug):# <<<
|
||||||
|
|
@ -147,7 +147,7 @@ def controldists_from_endgeometry_pt(A, B, tangA, tangB, curvA, curvB, allownega
|
||||||
abs(b*T) < threshold * q1 and abs(1.5*a*abs(a)*curvA - D) < threshold * q1 and
|
abs(b*T) < threshold * q1 and abs(1.5*a*abs(a)*curvA - D) < threshold * q1 and
|
||||||
abs(a*T) < threshold * q2 and abs(1.5*b*abs(b)*curvB - E) < threshold * q2):
|
abs(a*T) < threshold * q2 and abs(1.5*b*abs(b)*curvB - E) < threshold * q2):
|
||||||
if debug:
|
if debug:
|
||||||
print "fallback with T approx 0"
|
print("fallback with T approx 0")
|
||||||
return [(a, b)]
|
return [(a, b)]
|
||||||
return []
|
return []
|
||||||
# >>>
|
# >>>
|
||||||
|
|
@ -161,7 +161,7 @@ def controldists_from_endgeometry_pt(A, B, tangA, tangB, curvA, curvB, allownega
|
||||||
abs(1.5*b*b*curvB) < threshold * min(abs(a*T), abs(E)) and
|
abs(1.5*b*b*curvB) < threshold * min(abs(a*T), abs(E)) and
|
||||||
abs(a*T - E) < threshold * min(abs(a*T), abs(E))):
|
abs(a*T - E) < threshold * min(abs(a*T), abs(E))):
|
||||||
if debug:
|
if debug:
|
||||||
print "fallback with curvB approx 0"
|
print("fallback with curvB approx 0")
|
||||||
result.append((a, b))
|
result.append((a, b))
|
||||||
|
|
||||||
# is curvA approx zero?
|
# is curvA approx zero?
|
||||||
|
|
@ -171,7 +171,7 @@ def controldists_from_endgeometry_pt(A, B, tangA, tangB, curvA, curvB, allownega
|
||||||
abs(1.5*a*a*curvA) < threshold * min(abs(b*T), abs(D)) and
|
abs(1.5*a*a*curvA) < threshold * min(abs(b*T), abs(D)) and
|
||||||
abs(b*T - D) < threshold * min(abs(b*T), abs(D))):
|
abs(b*T - D) < threshold * min(abs(b*T), abs(D))):
|
||||||
if debug:
|
if debug:
|
||||||
print "fallback with curvA approx 0"
|
print("fallback with curvA approx 0")
|
||||||
result.append((a, b))
|
result.append((a, b))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
@ -754,7 +754,7 @@ class parallel(deformer): # <<<
|
||||||
# get the next parallel piece for the normpath
|
# get the next parallel piece for the normpath
|
||||||
try:
|
try:
|
||||||
next_parallel_normpath = self.deformsubpathitem(next_orig_nspitem, epsilon)
|
next_parallel_normpath = self.deformsubpathitem(next_orig_nspitem, epsilon)
|
||||||
except InvalidParamException, e:
|
except InvalidParamException as e:
|
||||||
invalid_nspitem_param = e.normsubpathitemparam
|
invalid_nspitem_param = e.normsubpathitemparam
|
||||||
# split the nspitem apart and continue with pieces that do not contain
|
# split the nspitem apart and continue with pieces that do not contain
|
||||||
# the invalid point anymore. At the end, simply take one piece, otherwise two.
|
# the invalid point anymore. At the end, simply take one piece, otherwise two.
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ class TFMError(exceptions.Exception): pass
|
||||||
|
|
||||||
class char_info_word:
|
class char_info_word:
|
||||||
def __init__(self, word):
|
def __init__(self, word):
|
||||||
self.width_index = int((word & 0xFF000000L) >> 24) #make sign-safe
|
self.width_index = int((word & 0xFF000000) >> 24) #make sign-safe
|
||||||
self.height_index = (word & 0x00F00000) >> 20
|
self.height_index = (word & 0x00F00000) >> 20
|
||||||
self.depth_index = (word & 0x000F0000) >> 16
|
self.depth_index = (word & 0x000F0000) >> 16
|
||||||
self.italic_index = (word & 0x0000FC00) >> 10
|
self.italic_index = (word & 0x0000FC00) >> 10
|
||||||
|
|
@ -135,10 +135,10 @@ class tfmfile:
|
||||||
self.ne <= 256 and
|
self.ne <= 256 and
|
||||||
self.lf == 6+self.lh+(self.ec-self.bc+1)+self.nw+self.nh+self.nd
|
self.lf == 6+self.lh+(self.ec-self.bc+1)+self.nw+self.nh+self.nd
|
||||||
+self.ni+self.nl+self.nk+self.ne+self.np):
|
+self.ni+self.nl+self.nk+self.ne+self.np):
|
||||||
raise TFMError, "error in TFM pre-header"
|
raise TFMError("error in TFM pre-header")
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
print "lh=%d" % self.lh
|
print("lh=%d" % self.lh)
|
||||||
|
|
||||||
#
|
#
|
||||||
# read header
|
# read header
|
||||||
|
|
@ -160,9 +160,9 @@ class tfmfile:
|
||||||
self.fontfamily = None
|
self.fontfamily = None
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
print "(FAMILY %s)" % self.fontfamily
|
print("(FAMILY %s)" % self.fontfamily)
|
||||||
print "(CODINGSCHEME %s)" % self.charcoding
|
print("(CODINGSCHEME %s)" % self.charcoding)
|
||||||
print "(DESINGSIZE R %f)" % 16.0*self.designsize/16777216L
|
print("(DESINGSIZE R %f)" % 16.0*self.designsize/16777216)
|
||||||
|
|
||||||
if self.lh > 17:
|
if self.lh > 17:
|
||||||
self.sevenbitsave = self.file.readuchar()
|
self.sevenbitsave = self.file.readuchar()
|
||||||
|
|
@ -201,7 +201,7 @@ class tfmfile:
|
||||||
|
|
||||||
if self.lh > 18:
|
if self.lh > 18:
|
||||||
# just ignore the rest
|
# just ignore the rest
|
||||||
print self.file.read((self.lh-18)*4)
|
print(self.file.read((self.lh-18)*4))
|
||||||
|
|
||||||
#
|
#
|
||||||
# read char_info
|
# read char_info
|
||||||
|
|
@ -392,9 +392,9 @@ def readfontmap(filenames):
|
||||||
if not (line=="" or line[0] in (" ", "%", "*", ";" , "#")):
|
if not (line=="" or line[0] in (" ", "%", "*", ";" , "#")):
|
||||||
try:
|
try:
|
||||||
fm = fontmapping(line)
|
fm = fontmapping(line)
|
||||||
except (RuntimeError, UnsupportedPSFragment), e:
|
except (RuntimeError, UnsupportedPSFragment) as e:
|
||||||
warnings.warn("Ignoring line %i in mapping file '%s': %s" % (lineno, mappath, e))
|
warnings.warn("Ignoring line %i in mapping file '%s': %s" % (lineno, mappath, e))
|
||||||
except UnsupportedFontFormat, e:
|
except UnsupportedFontFormat as e:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
fontmap[fm.texname] = fm
|
fontmap[fm.texname] = fm
|
||||||
|
|
@ -468,16 +468,16 @@ class font:
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "font %s designed at %g TeX pts used at %g TeX pts" % (self.name,
|
return "font %s designed at %g TeX pts used at %g TeX pts" % (self.name,
|
||||||
16.0*self.d/16777216L,
|
16.0*self.d/16777216,
|
||||||
16.0*self.q/16777216L)
|
16.0*self.q/16777216)
|
||||||
__repr__ = __str__
|
__repr__ = __str__
|
||||||
|
|
||||||
def getsize_pt(self):
|
def getsize_pt(self):
|
||||||
""" return size of font in (PS) points """
|
""" return size of font in (PS) points """
|
||||||
# The factor 16L/16777216L=2**(-20) converts a fix_word (here self.q)
|
# The factor 16/16777216=2**(-20) converts a fix_word (here self.q)
|
||||||
# to the corresponding float. Furthermore, we have to convert from TeX
|
# to the corresponding float. Furthermore, we have to convert from TeX
|
||||||
# points to points, hence the factor 72/72.27.
|
# points to points, hence the factor 72/72.27.
|
||||||
return 16L*self.q/16777216L*72/72.27
|
return 16*self.q/16777216*72/72.27
|
||||||
|
|
||||||
def _convert_tfm_to_dvi(self, length):
|
def _convert_tfm_to_dvi(self, length):
|
||||||
# doing the integer math with long integers will lead to different roundings
|
# doing the integer math with long integers will lead to different roundings
|
||||||
|
|
@ -1269,7 +1269,7 @@ class vffile:
|
||||||
# of the virtual font itself. Note that realscale has
|
# of the virtual font itself. Note that realscale has
|
||||||
# to be a fix_word (like s)
|
# to be a fix_word (like s)
|
||||||
# XXX: check rounding
|
# XXX: check rounding
|
||||||
reals = int(round(self.scale * (16*self.ds/16777216L) * s))
|
reals = int(round(self.scale * (16*self.ds/16777216) * s))
|
||||||
|
|
||||||
# print ("defining font %s -- VF scale: %g, VF design size: %d, relative font size: %d => real size: %d" %
|
# print ("defining font %s -- VF scale: %g, VF design size: %d, relative font size: %d => real size: %d" %
|
||||||
# (fontname, self.scale, self.ds, s, reals)
|
# (fontname, self.scale, self.ds, s, reals)
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,7 @@ class epsfile(canvas.canvasitem):
|
||||||
try:
|
try:
|
||||||
epsfile=open(self.filename,"rb")
|
epsfile=open(self.filename,"rb")
|
||||||
except:
|
except:
|
||||||
raise IOError, "cannot open EPS file '%s'" % self.filename
|
raise IOError("cannot open EPS file '%s'" % self.filename)
|
||||||
|
|
||||||
file.write("BeginEPSF\n")
|
file.write("BeginEPSF\n")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -365,7 +365,9 @@ class AFMfile:
|
||||||
else:
|
else:
|
||||||
raise AFMError("Unsupported key %s in kerning data section" % key)
|
raise AFMError("Unsupported key %s in kerning data section" % key)
|
||||||
|
|
||||||
def _processline_kernpairs(self, line, (direction, i)):
|
def _processline_kernpairs(self, line, arg):
|
||||||
|
direction = arg[0]
|
||||||
|
i = arg[1]
|
||||||
try:
|
try:
|
||||||
key, args = line.split(None, 1)
|
key, args = line.split(None, 1)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
@ -484,6 +486,6 @@ class AFMfile:
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
a = AFMfile("/opt/local/share/texmf-dist/fonts/afm/yandy/lucida/lbc.afm")
|
a = AFMfile("/opt/local/share/texmf-dist/fonts/afm/yandy/lucida/lbc.afm")
|
||||||
print a.charmetrics[0].name
|
print(a.charmetrics[0].name)
|
||||||
a = AFMfile("/usr/share/enscript/hv.afm")
|
a = AFMfile("/usr/share/enscript/hv.afm")
|
||||||
print a.charmetrics[32].name
|
print(a.charmetrics[32].name)
|
||||||
|
|
|
||||||
|
|
@ -815,9 +815,9 @@ class T1font:
|
||||||
elif 251 <= x <= 254: # mid size ints
|
elif 251 <= x <= 254: # mid size ints
|
||||||
cmds.append(-((x - 251)*256) - code.pop(0) - 108)
|
cmds.append(-((x - 251)*256) - code.pop(0) - 108)
|
||||||
else: # x = 255, i.e. full size ints
|
else: # x = 255, i.e. full size ints
|
||||||
y = ((code.pop(0)*256l+code.pop(0))*256+code.pop(0))*256+code.pop(0)
|
y = ((code.pop(0)*256+code.pop(0))*256+code.pop(0))*256+code.pop(0)
|
||||||
if y > (1l << 31):
|
if y > (1 << 31):
|
||||||
cmds.append(y - (1l << 32))
|
cmds.append(y - (1 << 32))
|
||||||
else:
|
else:
|
||||||
cmds.append(y)
|
cmds.append(y)
|
||||||
return cmds
|
return cmds
|
||||||
|
|
@ -843,7 +843,7 @@ class T1font:
|
||||||
code.append(b)
|
code.append(b)
|
||||||
else:
|
else:
|
||||||
if cmd < 0:
|
if cmd < 0:
|
||||||
cmd += 1l << 32
|
cmd += 1 << 32
|
||||||
cmd, x4 = divmod(cmd, 256)
|
cmd, x4 = divmod(cmd, 256)
|
||||||
cmd, x3 = divmod(cmd, 256)
|
cmd, x3 = divmod(cmd, 256)
|
||||||
x1, x2 = divmod(cmd, 256)
|
x1, x2 = divmod(cmd, 256)
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ class exponential:
|
||||||
skipexp1=None,
|
skipexp1=None,
|
||||||
nomantissaexp=r"{10^{%s}}",
|
nomantissaexp=r"{10^{%s}}",
|
||||||
minusnomantissaexp=r"{-10^{%s}}",
|
minusnomantissaexp=r"{-10^{%s}}",
|
||||||
mantissamin=tick.rational((1, 1)), mantissamax=tick.rational((10L, 1)),
|
mantissamin=tick.rational((1, 1)), mantissamax=tick.rational((10, 1)),
|
||||||
skipmantissa1=0, skipallmantissa1=1,
|
skipmantissa1=0, skipallmantissa1=1,
|
||||||
mantissatexter=decimal()):
|
mantissatexter=decimal()):
|
||||||
r"""initializes the instance
|
r"""initializes the instance
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ class rational:
|
||||||
if autolong:
|
if autolong:
|
||||||
self.denom = 10 ** len(commaparts[1])
|
self.denom = 10 ** len(commaparts[1])
|
||||||
else:
|
else:
|
||||||
self.denom = 10L ** len(commaparts[1])
|
self.denom = 10 ** len(commaparts[1])
|
||||||
neg = len(commaparts[0]) and commaparts[0][0] == "-"
|
neg = len(commaparts[0]) and commaparts[0][0] == "-"
|
||||||
if neg:
|
if neg:
|
||||||
commaparts[0] = commaparts[0][1:]
|
commaparts[0] = commaparts[0][1:]
|
||||||
|
|
|
||||||
|
|
@ -82,5 +82,5 @@ writer.writeToFile(gds_file_out)
|
||||||
# inputPath = "./gdsFiles/arrayLayout.gds")
|
# inputPath = "./gdsFiles/arrayLayout.gds")
|
||||||
|
|
||||||
|
|
||||||
print "LIB: %s" , gds_file_in
|
print("LIB: %s" , gds_file_in)
|
||||||
print "\nCompleted ", gds_file_out
|
print("\nCompleted ", gds_file_out)
|
||||||
|
|
|
||||||
|
|
@ -95,5 +95,5 @@ writer.writeToFile(gds_file_out)
|
||||||
# inputPath = "./gdsFiles/arrayLayout.gds")
|
# inputPath = "./gdsFiles/arrayLayout.gds")
|
||||||
|
|
||||||
|
|
||||||
print "LIB: %s" % gds_file_in
|
print("LIB: %s" % gds_file_in)
|
||||||
print "\nCompleted ", gds_file_out
|
print("\nCompleted ", gds_file_out)
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ class multibank(design):
|
||||||
self.central_bus_width = self.m2_pitch * self.num_control_lines + 2*self.m2_width
|
self.central_bus_width = self.m2_pitch * self.num_control_lines + 2*self.m2_width
|
||||||
|
|
||||||
# A space for wells or jogging m2
|
# A space for wells or jogging m2
|
||||||
self.m2_gap = max(2*drc("pwell_to_nwell"] + drc["well_enclose_active"),
|
self.m2_gap = max(2*drc("pwell_to_nwell") + drc("well_enclose_active"),
|
||||||
2*self.m2_pitch)
|
2*self.m2_pitch)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue