Ejemplo n.º 1
0
    def local_check(self, a, final_verification=False):

        self.reset()

        tempspice = "{0}{1}.sp".format(OPTS.openram_temp,a.name)
        tempgds = "{0}{1}.gds".format(OPTS.openram_temp,a.name)

        a.sp_write(tempspice)
        # cannot write gds in netlist_only mode
        if not OPTS.netlist_only:
            a.gds_write(tempgds)

            import verify
            result=verify.run_drc(a.name, tempgds, extract=True, final_verification=final_verification)
            if result != 0:
                #zip_file = "/tmp/{0}_{1}".format(a.name,os.getpid())
                #debug.info(0,"Archiving failed files to {}.zip".format(zip_file))
                #shutil.make_archive(zip_file, 'zip', OPTS.openram_temp)
                self.fail("DRC failed: {}".format(a.name))


            result=verify.run_lvs(a.name, tempgds, tempspice, final_verification=final_verification)
            if result != 0:
                #zip_file = "/tmp/{0}_{1}".format(a.name,os.getpid())
                #debug.info(0,"Archiving failed files to {}.zip".format(zip_file))
                #shutil.make_archive(zip_file, 'zip', OPTS.openram_temp)
                self.fail("LVS mismatch: {}".format(a.name))

        # For debug...
        #import pdb; pdb.set_trace()
        if OPTS.purge_temp:
            self.cleanup()
Ejemplo n.º 2
0
    def local_check(self, a, final_verification=False):

        tempspice = OPTS.openram_temp + "temp.sp"
        tempgds = OPTS.openram_temp + "temp.gds"

        a.sp_write(tempspice)
        a.gds_write(tempgds)

        import verify
        try:
            self.assertTrue(verify.run_drc(a.name, tempgds)==0)
        except:
            self.reset()
            self.fail("DRC failed: {}".format(a.name))

            
        try:
            self.assertTrue(verify.run_lvs(a.name, tempgds, tempspice, final_verification)==0)
        except:
            self.reset()
            self.fail("LVS mismatch: {}".format(a.name))

        self.reset()
        if OPTS.purge_temp:
            self.cleanup()
Ejemplo n.º 3
0
    def DRC_LVS(self, final_verification=False, top_level=False):
        """Checks both DRC and LVS for a module"""
        
        # Final verification option does not allow nets to be connected by label.
        # Unit tests will check themselves.
        if OPTS.is_unit_test:
            return
        if not OPTS.check_lvsdrc:
            return
        # Do not run if disabled in options.
        if (OPTS.inline_lvsdrc or top_level):

            global total_drc_errors
            global total_lvs_errors
            tempspice = "{0}/{1}.sp".format(OPTS.openram_temp,self.name)
            tempgds = "{0}/{1}.gds".format(OPTS.openram_temp,self.name)
            self.sp_write(tempspice)
            self.gds_write(tempgds)

            num_drc_errors = verify.run_drc(self.name, tempgds, final_verification) 
            num_lvs_errors = verify.run_lvs(self.name, tempgds, tempspice, final_verification) 
            debug.check(num_drc_errors == 0,"DRC failed for {0} with {1} error(s)".format(self.name,num_drc_errors))
            debug.check(num_lvs_errors == 0,"LVS failed for {0} with {1} errors(s)".format(self.name,num_lvs_errors))
            total_drc_errors += num_drc_errors
            total_lvs_errors += num_lvs_errors

            os.remove(tempspice)
            os.remove(tempgds)
Ejemplo n.º 4
0
    def runTest(self):
        globals.init_openram("config_{0}".format(OPTS.tech_name))
        import verify

        (gds_dir, sp_dir, allnames) = setup_files()
        drc_errors = 0
        lvs_errors = 0
        debug.info(1, "Performing LVS on: " + ", ".join(allnames))

        for f in allnames:
            gds_name = "{0}/{1}.gds".format(gds_dir, f)
            sp_name = "{0}/{1}.sp".format(sp_dir, f)
            name = re.sub('\.gds$', '', f)
            if not os.path.isfile(gds_name):
                lvs_errors += 1
                debug.error("Missing GDS file {}".format(gds_name))
            if not os.path.isfile(sp_name):
                lvs_errors += 1
                debug.error("Missing SPICE file {}".format(gds_name))
            drc_errors += verify.run_drc(name, gds_name)
            lvs_errors += verify.run_lvs(f, gds_name, sp_name)

        # fail if the error count is not zero
        self.assertEqual(drc_errors + lvs_errors, 0)
        globals.end_openram()
Ejemplo n.º 5
0
    def local_drc_check(self, w):
        tempgds = OPTS.openram_temp + "temp.gds"
        w.gds_write(tempgds)
        import verify
        self.assertFalse(verify.run_drc(w.name, tempgds))

        files = glob.glob(OPTS.openram_temp + '*')
        for f in files:
            os.remove(f)        
Ejemplo n.º 6
0
 def DRC(self):
     """Checks DRC for a module"""
     if OPTS.check_lvsdrc:
         tempgds = OPTS.openram_temp + "/temp.gds"
         self.gds_write(tempgds)
         debug.check(
             verify.run_drc(self.name, tempgds) == 0,
             "DRC failed for {0}".format(self.name))
         os.remove(tempgds)
Ejemplo n.º 7
0
    def local_check(self, fet):
        tempspice = OPTS.openram_temp + "temp.sp"
        tempgds = OPTS.openram_temp + "temp.gds"

        fet.sp_write(tempspice)
        fet.gds_write(tempgds)

        self.assertFalse(verify.run_drc(fet.name, tempgds))

        globals.end_openram()
Ejemplo n.º 8
0
 def DRC(self):
     """Checks DRC for a module"""
     # Unit tests will check themselves.
     # Do not run if disabled in options.
     if not OPTS.is_unit_test and OPTS.check_lvsdrc:
         tempgds = OPTS.openram_temp + "/temp.gds"
         self.gds_write(tempgds)
         debug.check(
             verify.run_drc(self.name, tempgds) == 0,
             "DRC failed for {0}".format(self.name))
         os.remove(tempgds)
Ejemplo n.º 9
0
    def local_check(self, a, final_verification=False):

        self.reset()

        tempspice = "{}.sp".format(a.name)
        tempgds = "{}.gds".format(a.name)

        a.lvs_write("{0}{1}".format(OPTS.openram_temp, tempspice))
        # cannot write gds in netlist_only mode
        if not OPTS.netlist_only:
            a.gds_write("{0}{1}".format(OPTS.openram_temp, tempgds))

            import verify
            # Run both DRC and LVS even if DRC might fail
            # Magic can still extract despite DRC failing, so it might be ok in some techs
            # if we ignore things like minimum metal area of pins
            drc_result = verify.run_drc(a.name,
                                        tempgds,
                                        tempspice,
                                        extract=True,
                                        final_verification=final_verification)

            # We can still run LVS even if DRC fails in Magic OR Calibre
            lvs_result = verify.run_lvs(a.name,
                                        tempgds,
                                        tempspice,
                                        final_verification=final_verification)

            # Only allow DRC to fail and LVS to pass if we are using magic
            if lvs_result == 0 and drc_result != 0:
                # import shutil
                # zip_file = "/tmp/{0}_{1}".format(a.name, os.getpid())
                # debug.info(0, "Archiving failed files to {}.zip".format(zip_file))
                # shutil.make_archive(zip_file, 'zip', OPTS.openram_temp)
                self.fail("DRC failed but LVS passed: {}".format(a.name))
            elif drc_result != 0:
                # import shutil
                # zip_file = "/tmp/{0}_{1}".format(a.name, os.getpid())
                # debug.info(0,"Archiving failed files to {}.zip".format(zip_file))
                # shutil.make_archive(zip_file, 'zip', OPTS.openram_temp)
                self.fail("DRC failed: {}".format(a.name))

            if lvs_result != 0:
                # import shutil
                # zip_file = "/tmp/{0}_{1}".format(a.name, os.getpid())
                # debug.info(0,"Archiving failed files to {}.zip".format(zip_file))
                # shutil.make_archive(zip_file, 'zip', OPTS.openram_temp)
                self.fail("LVS mismatch: {}".format(a.name))

        # For debug...
        # import pdb; pdb.set_trace()
        if not OPTS.keep_temp:
            self.cleanup()
Ejemplo n.º 10
0
    def local_check(self, tx):
        tempspice = OPTS.openram_temp + "temp.sp"
        tempgds = OPTS.openram_temp + "temp.gds"

        tx.sp_write(tempspice)
        tx.gds_write(tempgds)

        self.assertFalse(verify.run_drc(tx.name, tempgds))
        self.assertFalse(verify.run_lvs(tx.name, tempgds, tempspice))

        os.remove(tempspice)
        os.remove(tempgds)
Ejemplo n.º 11
0
    def local_check(self, a):
        tempspice = OPTS.openram_temp + "temp.sp"
        tempgds = OPTS.openram_temp + "temp.gds"

        a.sp_write(tempspice)
        a.gds_write(tempgds)

        self.assertFalse(verify.run_drc(a.name, tempgds))
        self.assertFalse(verify.run_lvs(a.name, tempgds, tempspice))
        #self.assertFalse(verify.run_pex(a.name, tempgds, tempspice, output=OPTS.openram_temp+"temp_pex.sp"))

        os.remove(tempspice)
        os.remove(tempgds)
Ejemplo n.º 12
0
    def local_drc_check(self, w):

        self.reset()

        tempgds = OPTS.openram_temp + "temp.gds"
        w.gds_write(tempgds)
        import verify

        result = verify.run_drc(w.name, tempgds)
        if result != 0:
            self.fail("DRC failed: {}".format(w.name))

        self.cleanup()
Ejemplo n.º 13
0
    def local_drc_check(self, w):

        self.reset()

        tempgds = "{0}{1}.gds".format(OPTS.openram_temp,w.name)
        w.gds_write(tempgds)
        import verify

        result=verify.run_drc(w.name, tempgds)
        if result != 0:
            self.fail("DRC failed: {}".format(w.name))

        if OPTS.purge_temp:
            self.cleanup()
Ejemplo n.º 14
0
    def DRC(self, final_verification=False):
        """Checks DRC for a module"""
        # Unit tests will check themselves.
        # Do not run if disabled in options.

        if (not OPTS.is_unit_test and OPTS.check_lvsdrc and (OPTS.inline_lvsdrc or final_verification)):
            global total_drc_errors
            tempgds = OPTS.openram_temp + "/temp.gds"
            self.gds_write(tempgds)
            num_errors = verify.run_drc(self.name, tempgds, final_verification)  
            total_drc_errors += num_errors
            debug.check(num_errors == 0,"DRC failed for {0} with {1} error(s)".format(self.name,num_error))

            os.remove(tempgds)
Ejemplo n.º 15
0
 def DRC_LVS(self):
     """Checks both DRC and LVS for a module"""
     if OPTS.check_lvsdrc:
         tempspice = OPTS.openram_temp + "/temp.sp"
         tempgds = OPTS.openram_temp + "/temp.gds"
         self.sp_write(tempspice)
         self.gds_write(tempgds)
         debug.check(
             verify.run_drc(self.name, tempgds) == 0,
             "DRC failed for {0}".format(self.name))
         debug.check(
             verify.run_lvs(self.name, tempgds, tempspice) == 0,
             "LVS failed for {0}".format(self.name))
         os.remove(tempspice)
         os.remove(tempgds)
Ejemplo n.º 16
0
    def local_check(self, a):
        tempspice = OPTS.openram_temp + "temp.sp"
        tempgds = OPTS.openram_temp + "temp.gds"

        a.sp_write(tempspice)
        a.gds_write(tempgds)

        self.assertFalse(verify.run_drc(a.name, tempgds))
        self.assertFalse(verify.run_lvs(a.name, tempgds, tempspice))

        os.remove(tempspice)
        os.remove(tempgds)

        # reset the static duplicate name checker for unit tests
        import design
        design.design.name_map=[]
Ejemplo n.º 17
0
    def DRC_LVS(self, final_verification=False, force_check=False):
        """Checks both DRC and LVS for a module"""
        import verify

        # No layout to check
        if OPTS.netlist_only:
            return
        # Unit tests will check themselves.
        elif not force_check and OPTS.is_unit_test:
            return
        elif not force_check and not OPTS.check_lvsdrc:
            return
        # Do not run if disabled in options.
        elif (OPTS.inline_lvsdrc or force_check or final_verification):

            tempspice = "{0}/{1}.sp".format(OPTS.openram_temp, self.name)
            tempgds = "{0}/{1}.gds".format(OPTS.openram_temp, self.name)
            self.lvs_write(tempspice)
            self.gds_write(tempgds)
            # Final verification option does not allow nets to be connected by label.
            self.drc_errors = verify.run_drc(
                self.name,
                tempgds,
                extract=True,
                final_verification=final_verification)
            self.lvs_errors = verify.run_lvs(
                self.name,
                tempgds,
                tempspice,
                final_verification=final_verification)

            # force_check is used to determine decoder height and other things, so we shouldn't fail
            # if that flag is set
            if OPTS.inline_lvsdrc and not force_check:
                debug.check(
                    self.drc_errors == 0,
                    "DRC failed for {0} with {1} error(s)".format(
                        self.name, self.drc_errors))
                debug.check(
                    self.lvs_errors == 0,
                    "LVS failed for {0} with {1} errors(s)".format(
                        self.name, self.lvs_errors))

            if OPTS.purge_temp:
                os.remove(tempspice)
                os.remove(tempgds)
Ejemplo n.º 18
0
    def runTest(self):
        globals.init_openram("config_20_{0}".format(OPTS.tech_name))

        (gds_dir, gds_files) = setup_files()
        drc_errors = 0
        debug.info(1, "\nPerforming DRC on: " + ", ".join(gds_files))
        for f in gds_files:
            name = re.sub('\.gds$', '', f)
            gds_name = "{0}/{1}".format(gds_dir, f)
            if not os.path.isfile(gds_name):
                drc_errors += 1
                debug.error("Missing GDS file: {}".format(gds_name))
            drc_errors += verify.run_drc(name, gds_name)

        # fails if there are any DRC errors on any cells
        self.assertEqual(drc_errors, 0)
        globals.end_openram()
Ejemplo n.º 19
0
 def DRC_LVS(self, final_verification=False):
     """Checks both DRC and LVS for a module"""
     # Unit tests will check themselves.
     # Do not run if disabled in options.
     if not OPTS.is_unit_test and OPTS.check_lvsdrc:
         tempspice = OPTS.openram_temp + "/temp.sp"
         tempgds = OPTS.openram_temp + "/temp.gds"
         self.sp_write(tempspice)
         self.gds_write(tempgds)
         debug.check(
             verify.run_drc(self.name, tempgds) == 0,
             "DRC failed for {0}".format(self.name))
         debug.check(
             verify.run_lvs(self.name, tempgds, tempspice,
                            final_verification) == 0,
             "LVS failed for {0}".format(self.name))
         os.remove(tempspice)
         os.remove(tempgds)
Ejemplo n.º 20
0
    def runTest(self):
        config_file = "{}/tests/configs/config".format(
            os.getenv("OPENRAM_HOME"))
        globals.init_openram(config_file)
        import verify

        (gds_dir, allnames) = setup_files()
        drc_errors = 0
        debug.info(1, "\nPerforming DRC on: " + ", ".join(allnames))
        for f in allnames:
            gds_name = "{0}/{1}.gds".format(gds_dir, f)
            if not os.path.isfile(gds_name):
                drc_errors += 1
                debug.error("Missing GDS file: {}".format(gds_name))
            drc_errors += verify.run_drc(f, gds_name)

        # fails if there are any DRC errors on any cells
        self.assertEqual(drc_errors, 0)
        globals.end_openram()
Ejemplo n.º 21
0
    def local_check(self, a, final_verification=False):

        self.reset()

        tempspice = OPTS.openram_temp + "temp.sp"
        tempgds = OPTS.openram_temp + "temp.gds"

        a.sp_write(tempspice)
        a.gds_write(tempgds)

        import verify
        result = verify.run_drc(a.name, tempgds)
        if result != 0:
            self.fail("DRC failed: {}".format(a.name))

        result = verify.run_lvs(a.name, tempgds, tempspice, final_verification)
        if result != 0:
            self.fail("LVS mismatch: {}".format(a.name))

        if OPTS.purge_temp:
            self.cleanup()
Ejemplo n.º 22
0
    def DRC(self, final_verification=False):
        """Checks DRC for a module"""
        import verify

        # Unit tests will check themselves.
        # Do not run if disabled in options.

        # No layout to check
        if OPTS.netlist_only:
            return
        elif (not OPTS.is_unit_test and OPTS.check_lvsdrc
              and (OPTS.inline_lvsdrc or final_verification)):
            tempgds = "{0}/{1}.gds".format(OPTS.openram_temp, self.name)
            self.gds_write(tempgds)
            num_errors = verify.run_drc(self.name,
                                        tempgds,
                                        final_verification=final_verification)
            debug.check(
                num_errors == 0, "DRC failed for {0} with {1} error(s)".format(
                    self.name, num_errors))

            if OPTS.purge_temp:
                os.remove(tempgds)
Ejemplo n.º 23
0
    def func_test(self, bank_num):

        import sram
        import tech

        debug.info(1,
                   "Testing timing for sample 1bit, 16words SRAM with 1 bank")
        OPTS.check_lvsdrc = False
        OPTS.use_pex = True
        s = sram.sram(word_size=OPTS.word_size,
                      num_words=OPTS.num_words,
                      num_banks=OPTS.num_banks,
                      name="test_sram1")
        OPTS.check_lvsdrc = True
        OPTS.use_pex = False

        tempspice = OPTS.openram_temp + "temp.sp"
        tempgds = OPTS.openram_temp + "temp.gds"

        s.sp_write(tempspice)
        s.gds_write(tempgds)

        self.assertFalse(verify.run_drc(s.name, tempgds))
        self.assertFalse(verify.run_lvs(s.name, tempgds, tempspice))
        self.assertFalse(
            verify.run_pex(s.name,
                           tempgds,
                           tempspice,
                           output=OPTS.openram_temp + "temp_pex.sp"))

        import sp_file
        stimulus_file = OPTS.openram_temp + "stimulus.sp"
        a_stimulus = sp_file.sp_file(stimulus_file)
        self.write_stimulus(a_stimulus)

        simulator_file = OPTS.openram_temp + "simulator.sp"
        a_simulator = sp_file.sp_file(simulator_file)
        self.write_simulator(a_simulator)

        result_file = OPTS.openram_temp + "result"

        import os

        if OPTS.spice_name == "hspice":
            cmd = "hspice -mt 2 -i {0} > {1} ".format(simulator_file,
                                                      result_file)
        else:
            cmd = "ngspice -b  -i {0} > {1}  ".format(simulator_file,
                                                      result_file)
        os.system(cmd)

        import re
        sp_result = open(result_file, "r")
        contents = sp_result.read()
        key = "vr1"
        val = re.search(r"{0}(\s*)=(\s*)(\d*(.).*)(\s*)(from)".format(key),
                        contents)
        val = val.group(3)
        value1 = float(self.convert_voltage_unit(val))

        key = "vr2"
        val = re.search(r"{0}(\s*)=(\s*)(\d*(.).*)(\s*)(from)".format(key),
                        contents)
        val = val.group(3)
        value2 = float(self.convert_voltage_unit(val))

        self.assertTrue(round(value1) > 0.5 * tech.spice["supply_voltage"])
        self.assertTrue(round(value2) < 0.5 * tech.spice["supply_voltage"])

        OPTS.check_lvsdrc = True
Ejemplo n.º 24
0
 def local_check(self, w):
     tempgds = OPTS.openram_temp + "temp.gds"
     w.gds_write(tempgds)
     self.assertFalse(verify.run_drc(w.name, tempgds))
     os.remove(tempgds)