OpenRAM/compiler/router/tests/01_no_blockages_test.py

81 lines
2.6 KiB
Python
Raw Normal View History

#!/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
OPTS = globals.OPTS
2016-11-17 22:26:03 +01:00
class no_blockages_test(unittest.TestCase):
"""
Simplest two pin route test with no blockages.
"""
def runTest(self):
2016-11-17 22:26:03 +01:00
globals.init_openram("config_{0}".format(OPTS.tech_name))
import design
import router
2016-11-17 22:26:03 +01:00
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
2016-11-18 20:33:03 +01:00
self.gds_file = "{0}/{1}.gds".format(os.path.dirname(os.path.realpath(__file__)),name)
self.sp_file = "{0}/{1}.sp".format(os.path.dirname(os.path.realpath(__file__)),name)
2016-11-17 22:26:03 +01:00
design.hierarchy_layout.layout.__init__(self, name)
design.hierarchy_spice.spice.__init__(self, name)
class routing(design.design,unittest.TestCase):
2016-11-17 22:26:03 +01:00
"""
A generic GDS design that we can route on.
"""
def __init__(self, name):
2016-11-17 22:26:03 +01:00
design.design.__init__(self, name)
debug.info(2, "Create {0} object".format(name))
cell = gdscell(name)
self.add_inst(name=name,
2016-11-17 22:26:03 +01:00
mod=cell,
offset=[0,0])
self.connect_inst([])
self.gdsname = "{0}/{1}.gds".format(os.path.dirname(os.path.realpath(__file__)),name)
2016-11-18 20:33:03 +01:00
r=router.router(self.gdsname)
2016-11-17 22:26:03 +01:00
layer_stack =("metal1","via1","metal2")
self.assertTrue(r.route(self,layer_stack,src="A",dest="B"))
2016-11-17 22:26:03 +01:00
r = routing("01_no_blockages_test_{0}".format(OPTS.tech_name))
2016-11-17 22:26:03 +01:00
self.local_check(r)
# fails if there are any DRC errors on any cells
globals.end_openram()
2016-11-17 22:26:03 +01:00
def local_check(self, r):
tempgds = OPTS.openram_temp + "temp.gds"
2016-11-17 22:26:03 +01:00
r.gds_write(tempgds)
self.assertFalse(calibre.run_drc(r.name, tempgds))
os.remove(tempgds)
2016-11-18 01:33:38 +01:00
# 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()