mirror of https://github.com/VLSIDA/OpenRAM.git
Use magic for LEF abstract. Fix supply perimter pin.
This commit is contained in:
parent
0e48e020c1
commit
a730fd0f10
|
|
@ -124,6 +124,8 @@ class layout():
|
||||||
|
|
||||||
if len(self.pin_map) > 0:
|
if len(self.pin_map) > 0:
|
||||||
for pin_set in self.pin_map.values():
|
for pin_set in self.pin_map.values():
|
||||||
|
if len(pin_set) == 0:
|
||||||
|
continue
|
||||||
lowestx = min(min(pin.lx() for pin in pin_set), lowestx)
|
lowestx = min(min(pin.lx() for pin in pin_set), lowestx)
|
||||||
lowesty = min(min(pin.by() for pin in pin_set), lowesty)
|
lowesty = min(min(pin.by() for pin in pin_set), lowesty)
|
||||||
|
|
||||||
|
|
@ -146,6 +148,8 @@ class layout():
|
||||||
|
|
||||||
if len(self.pin_map) > 0:
|
if len(self.pin_map) > 0:
|
||||||
for pin_set in self.pin_map.values():
|
for pin_set in self.pin_map.values():
|
||||||
|
if len(pin_set) == 0:
|
||||||
|
continue
|
||||||
highestx = max(max(pin.rx() for pin in pin_set), highestx)
|
highestx = max(max(pin.rx() for pin in pin_set), highestx)
|
||||||
highesty = max(max(pin.uy() for pin in pin_set), highesty)
|
highesty = max(max(pin.uy() for pin in pin_set), highesty)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@
|
||||||
#
|
#
|
||||||
import debug
|
import debug
|
||||||
from tech import layer_names
|
from tech import layer_names
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
from globals import OPTS
|
||||||
|
|
||||||
|
|
||||||
class lef:
|
class lef:
|
||||||
|
|
@ -23,9 +26,53 @@ class lef:
|
||||||
# Round to ensure float values are divisible by 0.0025 (the manufacturing grid)
|
# Round to ensure float values are divisible by 0.0025 (the manufacturing grid)
|
||||||
self.round_grid = 4
|
self.round_grid = 4
|
||||||
|
|
||||||
|
def magic_lef_write(self, lef_name):
|
||||||
|
""" Use a magic script to perform LEF creation. """
|
||||||
|
debug.info(3, "Writing abstracted LEF to {0}".format(lef_name))
|
||||||
|
|
||||||
|
# Copy .magicrc file into the output directory
|
||||||
|
magic_file = OPTS.openram_tech + "tech/.magicrc"
|
||||||
|
if os.path.exists(magic_file):
|
||||||
|
shutil.copy(magic_file, OPTS.openram_temp)
|
||||||
|
else:
|
||||||
|
debug.warning("Could not locate .magicrc file: {}".format(magic_file))
|
||||||
|
|
||||||
|
gds_name = OPTS.openram_temp + "{}.gds".format(self.name)
|
||||||
|
self.gds_write(gds_name)
|
||||||
|
|
||||||
|
run_file = OPTS.openram_temp + "run_lef.sh"
|
||||||
|
f = open(run_file, "w")
|
||||||
|
f.write("#!/bin/sh\n")
|
||||||
|
f.write('export OPENRAM_TECH="{}"\n'.format(os.environ['OPENRAM_TECH']))
|
||||||
|
f.write('echo "$(date): Starting GDS to MAG using Magic {}"\n'.format(OPTS.drc_exe[1]))
|
||||||
|
f.write('\n')
|
||||||
|
f.write("{} -dnull -noconsole << EOF\n".format(OPTS.drc_exe[1]))
|
||||||
|
f.write("drc off\n")
|
||||||
|
f.write("gds polygon subcell true\n")
|
||||||
|
f.write("gds warning default\n")
|
||||||
|
f.write("gds flatten true\n")
|
||||||
|
f.write("gds ordering true\n")
|
||||||
|
f.write("gds readonly true\n")
|
||||||
|
f.write("gds read {}\n".format(gds_name))
|
||||||
|
f.write('puts "Finished reading gds {}"\n'.format(gds_name))
|
||||||
|
f.write("load {}\n".format(self.name))
|
||||||
|
f.write('puts "Finished loading cell {}"\n'.format(self.name))
|
||||||
|
f.write("cellname delete \\(UNNAMED\\)\n")
|
||||||
|
f.write("lef write {} -hide\n".format(lef_name))
|
||||||
|
f.write('puts "Finished writing LEF cell {}"\n'.format(self.name))
|
||||||
|
f.close()
|
||||||
|
os.system("chmod u+x {}".format(run_file))
|
||||||
|
from run_script import run_script
|
||||||
|
(outfile, errfile, resultsfile) = run_script(self.name, "lef")
|
||||||
|
|
||||||
def lef_write(self, lef_name):
|
def lef_write(self, lef_name):
|
||||||
"""Write the entire lef of the object to the file."""
|
""" Write the entire lef of the object to the file. """
|
||||||
debug.info(3, "Writing to {0}".format(lef_name))
|
|
||||||
|
if OPTS.drc_exe[0] == "magic":
|
||||||
|
self.magic_lef_write(lef_name)
|
||||||
|
return
|
||||||
|
|
||||||
|
debug.info(3, "Writing detailed LEF to {0}".format(lef_name))
|
||||||
|
|
||||||
self.indent = "" # To maintain the indent level easily
|
self.indent = "" # To maintain the indent level easily
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1215,8 +1215,9 @@ class router(router_tech):
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_pin(self, pin_name):
|
def get_ll_pin(self, pin_name):
|
||||||
""" Return the lowest, leftest pin group """
|
""" Return the lowest, leftest pin group """
|
||||||
|
|
||||||
keep_pin = None
|
keep_pin = None
|
||||||
for index,pg in enumerate(self.pin_groups[pin_name]):
|
for index,pg in enumerate(self.pin_groups[pin_name]):
|
||||||
for pin in pg.enclosures:
|
for pin in pg.enclosures:
|
||||||
|
|
|
||||||
|
|
@ -248,21 +248,27 @@ class sram_base(design, verilog, lef):
|
||||||
|
|
||||||
# Find the lowest leftest pin for vdd and gnd
|
# Find the lowest leftest pin for vdd and gnd
|
||||||
for pin_name in ["vdd", "gnd"]:
|
for pin_name in ["vdd", "gnd"]:
|
||||||
# Copy the pin shape to rectangles
|
# Copy the pin shape(s) to rectangles
|
||||||
for pin in self.get_pins(pin_name):
|
for pin in self.get_pins(pin_name):
|
||||||
self.add_rect(pin.layer,
|
self.add_rect(pin.layer,
|
||||||
pin.ll(),
|
pin.ll(),
|
||||||
pin.width(),
|
pin.width(),
|
||||||
pin.height())
|
pin.height())
|
||||||
# Remove the pins
|
|
||||||
|
# Remove the pin shape(s)
|
||||||
self.remove_layout_pin(pin_name)
|
self.remove_layout_pin(pin_name)
|
||||||
|
|
||||||
pin = rtr.get_pin(pin_name)
|
# Get the lowest, leftest pin
|
||||||
|
pin = rtr.get_ll_pin(pin_name)
|
||||||
|
|
||||||
|
# Add it as an IO pin to the perimeter
|
||||||
|
lowest_coord = self.find_lowest_coords()
|
||||||
|
pin_width = pin.rx() - lowest_coord.x
|
||||||
|
pin_offset = vector(lowest_coord.x, pin.by())
|
||||||
self.add_layout_pin(pin_name,
|
self.add_layout_pin(pin_name,
|
||||||
pin.layer,
|
pin.layer,
|
||||||
pin.ll(),
|
pin_offset,
|
||||||
pin.width(),
|
pin_width,
|
||||||
pin.height())
|
pin.height())
|
||||||
|
|
||||||
def route_escape_pins(self):
|
def route_escape_pins(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue