From c102ed728c7f1d539e9bed0f1e3b82ed1ddcbba2 Mon Sep 17 00:00:00 2001 From: mrg Date: Wed, 3 Nov 2021 11:36:19 -0700 Subject: [PATCH] Move tests to test Makefile --- Makefile | 47 ----------------------- compiler/Makefile | 13 +++---- compiler/tests/testutils.py | 22 +++++------ technology/freepdk45/tech/freepdk45.lylvs | 14 ++----- technology/freepdk45/tech/tech.py | 13 ++++--- 5 files changed, 29 insertions(+), 80 deletions(-) diff --git a/Makefile b/Makefile index 5c175302..b85f5336 100644 --- a/Makefile +++ b/Makefile @@ -145,51 +145,6 @@ macros: .PHONY: macros -TEST_DIR = $(TOP_DIR)/compiler/tests -TEST_SRCS=$(sort $(notdir $(wildcard $(TEST_DIR)/*_test.py))) -TEST_DIRS=$(basename $(TEST_SRCS)) -TEST_STAMPS=$(addsuffix .ok,$(TEST_DIRS)) - -TEST_BROKEN := \ - sky130_sram_1kbyte_1r1w_8x1024_8 \ - sky130_sram_1kbyte_1rw_32x256_8 \ - sky130_sram_2kbyte_1rw_32x512_8 \ - sky130_sram_4kbyte_1rw_32x1024_8 \ - -WORKING_TEST_STAMPS=$(filter-out $(addsuffix .ok, (TEST_BROKEN)), $(TEST_STAMPS)) - -$(TEST_DIRS): - @$(MAKE) --no-print-directory $@.ok - -tests: - @echo "Running the following tests" - @for S in $(WORKING_TEST_STAMPS); do echo " - $$S"; done - $(MAKE) $(WORKING_TEST_STAMPS) -.PHONY: tests - -%.ok: compiler/tests/%.py - @mkdir -p $* - @docker run -v $(TOP_DIR):/openram \ - -v $(SKY130_PDK):$(SKY130_PDK) \ - -e PDK_ROOT=$(PDK_ROOT) \ - -e OPENRAM_HOME=/openram/compiler \ - -e OPENRAM_TECH=/openram/technology \ - -e OPENRAM_TMP=/openram/$* \ - --user $(UID):$(GID) \ - vlsida/openram-ubuntu:latest \ - python3 -u /openram/compiler/tests/$*.py -v -k && touch $@ - -.DELETE_ON_ERROR: $(TEST_STAMPS) - -regress: - @docker run -v $(TOP_DIR):/openram \ - -e OPENRAM_HOME=/openram/compiler \ - -e OPENRAM_TECH=/openram/technology \ - --user $(UID):$(GID) \ - vlsida/openram-ubuntu:latest \ - sh -c "python3 -u /openram/compiler/tests/regress.py" -.PHONY: regress - mount: @docker run -it -v $(TOP_DIR):/openram \ -v $(SKY130_PDK):$(SKY130_PDK) \ @@ -201,8 +156,6 @@ mount: .PHONY: mount clean: - @rm -rf $(TEST_STAMPS) - @rm -rf $(TEST_DIRS) @rm -f *.zip .PHONE: clean diff --git a/compiler/Makefile b/compiler/Makefile index 171c1a10..117e4bd2 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -35,7 +35,7 @@ ${CELL_TESTS} \ ${MODULE_TESTS} \ ${TOP_TESTS} \ ${CHAR_TESTS} \ -${USAGE_TESTS} +${USAGE_TESTS} .PHONY: ${ALL_TESTS} @@ -64,8 +64,8 @@ usage: ${USAGE_TESTS} $(ALL_TESTS): python3 $@ -t ${TECH} - - + + OPENRAM_TECHS = $(subst :, ,$(OPENRAM_TECH)) TECH_DIR := $(word 1, $(foreach dir,$(OPENRAM_TECHS),$(wildcard $(dir)/$(TECH)))) CONFIG_DIR = $(OPENRAM_HOME)/model_configs @@ -75,9 +75,9 @@ CSV_DIR = $(TECH_DIR)/sim_data # Creates names of technology specific okay files for the configs STAMPS=$(addprefix $(SIM_DIR)/, $(addsuffix .ok, $(notdir $(basename $(MODEL_CONFIGS))))) -OPTS = +OPTS = # Characterize and perform DRC/LVS -OPTS += -c +OPTS += -c # Do not characterize or perform DRC/LVS OPTS += -n # Verbosity @@ -100,8 +100,7 @@ model: $(STAMPS) clean_model: rm -f -r $(SIM_DIR)/*.ok - + clean: find . -name \*.pyc -exec rm {} \; find . -name \*~ -exec rm {} \; - diff --git a/compiler/tests/testutils.py b/compiler/tests/testutils.py index 928536a7..67c08d2e 100644 --- a/compiler/tests/testutils.py +++ b/compiler/tests/testutils.py @@ -24,24 +24,24 @@ class openram_test(unittest.TestCase): def tearDown(self): duration = time.time() - self.start_time print('%s: %.3fs' % (self.id(), duration)) - + def fail(self, msg): import inspect s = inspect.stack() base_filename = os.path.splitext(os.path.basename(s[2].filename))[0] - + try: OPENRAM_HOME = os.path.abspath(os.environ.get("OPENRAM_HOME")) except: debug.error("$OPENRAM_HOME is not properly defined.", 1) - - import shutil - zip_file = "{0}/../{1}_{2}".format(OPENRAM_HOME, base_filename, os.getpid()) - debug.info(0, "Archiving failed temp files {0} to {1}".format(OPTS.openram_temp, zip_file)) - shutil.make_archive(zip_file, 'zip', OPTS.openram_temp) - + + # import shutil + # zip_file = "{0}/../{1}_{2}".format(OPENRAM_HOME, base_filename, os.getpid()) + # debug.info(0, "Archiving failed temp files {0} to {1}".format(OPTS.openram_temp, zip_file)) + # shutil.make_archive(zip_file, 'zip', OPTS.openram_temp) + super().fail(msg) - + def local_drc_check(self, w): self.reset() @@ -55,7 +55,7 @@ class openram_test(unittest.TestCase): self.fail("DRC failed: {}".format(w.name)) elif not OPTS.keep_temp: self.cleanup() - + def local_check(self, a, final_verification=False): self.reset() @@ -128,7 +128,7 @@ class openram_test(unittest.TestCase): def cleanup(self): """ Reset the duplicate checker and cleanup files. """ - + files = glob.glob(OPTS.openram_temp + '*') for f in files: # Only remove the files diff --git a/technology/freepdk45/tech/freepdk45.lylvs b/technology/freepdk45/tech/freepdk45.lylvs index 5d8e50b3..640454d6 100644 --- a/technology/freepdk45/tech/freepdk45.lylvs +++ b/technology/freepdk45/tech/freepdk45.lylvs @@ -209,16 +209,10 @@ connect_global(pwell, "PWELL") connect_global(nwell, "NWELL") connect_global(bulk, "BULK") -#for pat in %w(pnand*_0 and2_dec_0 port_address* replica_bitcell_array) -# connect_explicit(pat, [ "NWELL", "vdd" ]) -# connect_explicit(pat, [ "BULK", "PWELL", "gnd" ]) -#end - -#for pat in %w(XOR* XNOR* TLAT* TINV* TBUF* SDFF* OR* OAI* NOR* NAND* MUX* LOGIC* INV* HA* FILLCELL* -# FA* DLL* DLH* DFF* DFFS* DFFR* DFFRS* CLKGATE* CLKBUF* BUF* AOI* ANTENNA* AND*) -# connect_explicit(pat, [ "NWELL", "VDD" ]) -# connect_explicit(pat, [ "BULK", "VSS" ]) -#end +for pat in %w(pnand* and2_dec* port_address* replica_bitcell_array) + connect_explicit(pat, [ "NWELL", "vdd" ]) + connect_explicit(pat, [ "BULK", "PWELL", "gnd" ]) +end # Actually performs the extraction netlist # ... not really required diff --git a/technology/freepdk45/tech/tech.py b/technology/freepdk45/tech/tech.py index fd477077..3988a411 100644 --- a/technology/freepdk45/tech/tech.py +++ b/technology/freepdk45/tech/tech.py @@ -457,10 +457,10 @@ parameter["sa_inv_nmos_size"] = 0.27 # micro-meters parameter["bitcell_drain_cap"] = 0.1 # In Femto-Farad, approximation of drain capacitance # Spice Values uses to calculate analytical delay based on CACTI equations -spice["i_on_n"] = 0.0004463 # A/um +spice["i_on_n"] = 0.0004463 # A/um spice["i_on_p"] = 0.0000771 # A/um spice["tox"] = 0.00114 # microns -spice["eps_ox"] = 0.00245e-14 # F/um, calculated from CACTI 45nm data +spice["eps_ox"] = 0.00245e-14 # F/um, calculated from CACTI 45nm data spice["cox"] = spice["eps_ox"]/spice["tox"] # F/um^2 spice["c_g_ideal"] = spice["cox"]*drc["minlength_channel"] # F/um spice["c_overlap"] = 0.2*spice["c_g_ideal"] # F/um @@ -477,8 +477,11 @@ spice["sa_transconductance"] = (spice["mobility_n"])*spice["cox"]*(parameter["sa # Technology Tool Preferences ################################################### -drc_name = "calibre" -lvs_name = "calibre" -pex_name = "calibre" +#drc_name = "calibre" +#lvs_name = "calibre" +#pex_name = "calibre" +drc_name = "klayout" +lvs_name = "klayout" +pex_name = "klayout" blackbox_bitcell = False