def __init__(self, ph, test_cfg, logger_id='logger_id'):
    ''' 
      ph: Port Handler class instance
      test_cfg: TestConfig class instance
    '''

    self._logger_id = logger_id
    self._logger = DaVELogger.get_logger('%s.%s.%s' % (logger_id, __name__, self.__class__.__name__))
    self.option = { # read vector generation options from test config
                   #'oa_depth': test_cfg.get_option_regression_oa_depth(),
                   'oa_depth': int(test_cfg.get_option_regression_min_oa_depth()),
                   'min_oa_depth': int(test_cfg.get_option_regression_min_oa_depth()),
                   'max_sample': int(test_cfg.get_option_regression_max_sample()),
                   'en_interact': test_cfg.get_option_regression_en_interact(),
                   'order': int(test_cfg.get_option_regression_order()) }

    map(self._logger.info, print_section(mcode.INFO_036, 2)) # print section header

    # all possible linear circuit configurations by DigitalModePort
    self._generate_digital_vector(ph.get_digital_input()) 

    # process analog ports
    self._ph = ph
    if self._ph.get_by_name('dummy_analoginput') != None:
      self.option['max_sample'] = 1
    self._count_port(ph) # count number of (pinned, unpinned) ports

    self._update_analog_grid()

    analog_raw_vector = self._generate_analog_raw_vector()

    # analog test vectors by scaling raw vector to real range
    self._a_vector = self._map_analog_vector(analog_raw_vector)

    self._logger.info(mcode.INFO_045 % self.get_analog_vector_length())
Esempio n. 2
0
  def __init__(self, args, csocket, logger_id='logger_id'):
    self._testfile = args.test # test configuration file name
    self._simfile = args.sim   # simulator configuration file name
    self._workdir = args.workdir # working directory
    self._rptfile = os.path.abspath(os.path.join(self._workdir,args.rpt)) # report file name
    self._cache = args.use_cache # use cached data if True
    self._no_otfc = args.no_otf_check # no on-the-fly check for pin consistency
    self._np = args.process # num. of threads for simulations
    self._goldenonly = args.extract # run in extraction mode
    self._port_xref = args.port_xref # port cross reference filename of modules
    self._csocket = csocket # client socket if any
    self._logger_id = logger_id # logger id string

    self._logger = DaVELogger.get_logger('%s.%s.%s' % (logger_id, __name__, self.__class__.__name__))
    self._mp = LinearModelParameter()

    self._inv = not ehdnsxmgor(featureinfo())

    self._tcfg = TestConfig(self._testfile, port_xref = self._port_xref, logger_id=logger_id) # get test cfg obj
    self._scfg = SimulatorConfig(self._simfile, self._goldenonly, logger_id=logger_id) # get sim cfg obj
    self._rptgen = ReportGenerator(filename=self._rptfile, logger_id=logger_id) # reportgenerator obj

    self._root_rundir = os.path.join(self._workdir, EnvFileLoc().root_rundir) # for e.g. workdir/.mProbo, this will store all the data for the checking
    make_dir(self._workdir, self._logger)
    make_dir(self._root_rundir, self._logger)

    if self._inv: dlrtmvkdldjem()
 def __init__(self, sim_cfg, is_golden, logger_id='logger_id'):
     self._logger = DaVELogger.get_logger(
         '%s.%s.%s' %
         (logger_id, __name__, self.__class__.__name__))  # logger
     self._tenv = EnvSimcfg()
     self.cfg_model = sim_cfg  # get the corresponding section from the sim configuration
     self._is_golden = is_golden
Esempio n. 4
0
    def __init__(self,
                 test_name,
                 unit_test_cfg,
                 port_xref='',
                 logger_id='logger_id'):
        self._logger = DaVELogger.get_logger(
            '%s.%s.%s' % (logger_id, __name__, self.__class__.__name__))
        self._tenvs = EnvTestcfgSection()
        self._tenvtp = EnvTestcfgPort()
        self._tenvr = EnvTestcfgOption()
        self._tenvts = EnvTestcfgSimTime()
        self._tenvtb = EnvTestcfgTestbench()
        self._tenvp = EnvPortName()
        self._tenvsim = EnvSimcfg()
        self._portref_filename = interpolate_env(port_xref)

        self._logger.info(mcode.INFO_055 % test_name)

        _tmpcfg = dict([(test_name,
                         dict([(self._tenvs.test_name, test_name)] +
                              dict(unit_test_cfg).items()))])
        cfg = ConfigObj(_tmpcfg)
        schema_testcfg = SchemaTestConfig(cfg)
        schema_testcfg.raise_vdterror()
        self._test_cfg = schema_testcfg.get_cfg()[test_name]

        self._test_cfg.update(self._compile_test(unit_test_cfg))
Esempio n. 5
0
 def __init__(self, pref_filename, vlog_tb='', logger_id='logger_id'):
     self._logger = DaVELogger.get_logger(
         '%s.%s.%s' %
         (logger_id, __name__, self.__class__.__name__))  # logger
     _envfile = EnvFileLoc()
     if vlog_tb != '':
         self.load_testbench(vlog_tb)
     self._pref = WireCrossReference(
         pref_filename)  # port reference class obj.
Esempio n. 6
0
 def __init__(self, conn, workdir, addr, logger_id):
     self._logger = DaVELogger.get_logger(
         '%s.%s.%s' %
         (logger_id, __name__, self.__class__.__name__))  # logger
     self._workdir = workdir  # mProbo working directory on server side
     self._csocket = conn
     self.clear_command()
     # run wait_for_command in background
     self._thread = threading.Thread(target=self.wait_for_command, args=())
     self._thread.daemon = True
     self._thread.start()
Esempio n. 7
0
    def __init__(self, filename='result.html', logger_id=0):
        self._logger = DaVELogger.get_logger(
            '%s.%s.%s' %
            (logger_id, __name__, self.__class__.__name__))  # logger
        self._logger_id = logger_id

        # system reserved words
        self._tenvtp = EnvTestcfgPort()
        self._tenvsc = EnvSimcfg()
        self._tenvpn = EnvPortName()

        self.fid = open(filename, 'w')  # report output in html
Esempio n. 8
0
 def __init__(self, logger_id='logger_id'):
   ''' 
   '''
   self._logger = DaVELogger.get_logger('%s.%s.%s' % (logger_id, __name__, self.__class__.__name__))
   self._tenv = EnvTestcfgOption()
   self._option = {self._tenv.regression_do_not_regress : {}, 
                    self._tenv.regression_basis : self._tenv.polynomial,
                    self._tenv.regression_order : 1, 
                    self._tenv.regression_pval_threshold : 0.05, 
                    self._tenv.regression_cint_threshold : 0.95, 
                    self._tenv.regression_en_interact : False,
                    self._tenv.regression_sval_threshold : 0.01
                   }
Esempio n. 9
0
 def __init__(self,
              cfg_filename,
              ifc_filename,
              api_file=None,
              template_rootdir=''):
     '''
   cfg_filename : User configuration file that customizes its master cell interface
   ifc_filename : Interface file name of a master cell
   api_file     : Python file that contains API functions of a template
   template_rootdir: Reserved 
 '''
     self._logger = DaVELogger.get_logger(
         '%s.%s' % (__name__, self.__class__.__name__))
     self._display_logo()
     self.mc = UserConfiguration(cfg_filename, ifc_filename,
                                 template_rootdir, self._logger)
     self.ip = TemplateInterpreter(api_file, self._logger)
Esempio n. 10
0
    def __init__(self,
                 configobj,
                 configspecfile,
                 config_type,
                 logger_id='logger_id'):

        self._logger = DaVELogger.get_logger(
            '%s.%s.%s' %
            (logger_id, __name__, self.__class__.__name__))  # logger
        self.cfgtype = config_type
        configspec = ConfigObj(infile=configspecfile,
                               interpolation=False,
                               list_values=False)
        vfile = StringIO()
        configobj.write(vfile)
        self.config = ConfigObj(vfile.getvalue().splitlines(),
                                configspec=configspec)
        vfile.close()
Esempio n. 11
0
 def __init__(self, args):
     signal.signal(signal.SIGINT, self.sigint_handler)
     self._ur_filename = args.user
     self._NO_CLIENTS = int(args.number)
     self._PORT = int(args.port)
     self._ADDR = (self._HOST, self._PORT)
     self._logger = DaVELogger.get_logger(
         '%s.%s.%s' %
         (logger_id, __name__, self.__class__.__name__))  # logger
     self._ssocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     #self._ssocket.settimeout(self._TIMEOUT)
     self._ssocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,
                              1)  # reuse the socket immediately
     self._ssocket.bind(self._ADDR)  # bind socket to the address
     self._ssocket.listen(
         self._NO_CLIENTS
     )  # start listening. limit the number of clients being connected
     self._print_setting()
     self._logger.info("TCPServer Waiting for client on port %d" %
                       self._PORT)
     self.connect()
Esempio n. 12
0
    def __init__(self,
                 cfg_filename,
                 bypass=False,
                 keep_raw=False,
                 port_xref='',
                 logger_id='logger_id'):
        ''' 
      set bypass to False if you don't want to create sub-regions of tests 
      set keep_raw to True if you keep the raw configuration
      set port_xref to a filename which contains port cross reference of modules
    '''

        assert os.path.exists(
            get_abspath(cfg_filename)), mcode.ERR_001 % cfg_filename
        assert os.path.exists(
            get_abspath(port_xref)), mcode.ERR_001_1 % port_xref

        self._pxref = port_xref

        self._tenvp = EnvPortName()
        self._tenvt = EnvTestcfgPort()
        self._tenvs = EnvTestcfgSection()
        self._logger = DaVELogger.get_logger(
            '%s.%s.%s' % (logger_id, __name__, self.__class__.__name__))
        self._logger_id = logger_id
        map(self._logger.info, print_section('Compile test configrations', 1))

        if keep_raw:
            self.config = self._read_raw_config_file(cfg_filename)
        else:
            self._test_cfg = {}  # list of UnitTestConfig class instances
            self._test_name_list = []  # list of the corresponding test names
            self.config = self._read_config_file(cfg_filename)

            # 1st pass to Validate and update
            schema_testcfg = SchemaTestConfig(self.config)
            schema_testcfg.raise_vdterror()
            self.config = schema_testcfg.get_cfg()

            self._build(bypass)
Esempio n. 13
0
 def __init__(self, conn, workdir, addr, ur_filename, port):
     self._logger = DaVELogger.get_logger(
         '%s.%s.%s' %
         (logger_id, __name__, self.__class__.__name__))  # logger
     self._server = mProboServer(conn, workdir, addr,
                                 logger_id)  # make communication channel
     self._addr = addr
     self._workdir = workdir
     self.check_connection()
     is_valid, no_acct, company = self.validate_user(addr[0], ur_filename)
     t = strftime("%a, %d %b %Y %H:%M:%S", localtime())
     self._logger.info("[CONN] Got a connection from %s (%s) at %s" %
                       (str(addr), company, t))
     if is_valid:
         fn_match_ip = lambda x: x == addr[0]
         ip_addrs = filter(fn_match_ip,
                           get_established_foreign_ip_address(port))
         no_runs = len(ip_addrs)
         if no_runs <= no_acct:
             self.upload_configuration_files()  # get test.cfg & sim.cfg
             self._runargs = self.get_runargs()  # get args of mProbo
             self.run()  # run mProbo
             self.send_result()  #
             self._logger.info("Temporary working directory: %s" %
                               self._workdir)
         else:
             self._server.issue_command(
                 "@max_license [CONN] Maximum # of licenses for the IP (%s): %s reached. Connection closed"
                 % (addr[0], no_acct))
             self._logger.info(
                 "[CONN] Maximum # of licenses for the IP (%s): %s reached. Connection closed"
                 % (addr[0], no_acct))
     else:
         self._logger.info("[CONN] Invalid IP: %s. Connection closed" %
                           addr[0])
     self.close_connection()
     #self.cleanup_workdir()
     thread.exit()
Esempio n. 14
0
 def __init__(self, logger_id='logger_id'):
   self._logger = DaVELogger.get_logger('%s.%s.%s' % (logger_id, __name__, self.__class__.__name__))
   self.init_port() # initialize
Esempio n. 15
0
  def __init__(self, test_cfg, sim_cfg, testdir='/tmp', rpt=None, goldensim_only=False, revisedsim_only=False, use_cache=False, no_thread=1, no_otfc=False, csocket=None, logger_id='logger_id'):
    ''' 
      test_cfg : test configuration cls object of a single test
      sim_cfg_(golden,revised) : simulator configuration cls object for golden, revised
      testdir : top directory of this test run
      rpt : report cls object
    '''

    # get system reserved words
    self._tenv = EnvTestcfgOption()
    self._tenvf = EnvFileLoc()
    self._tenvs = EnvSimcfg()
    self._logger_id = logger_id
    self._logger = DaVELogger.get_logger('%s.%s.%s' % (logger_id, __name__, self.__class__.__name__)) # logger
    self._inv = not ehdnsxmgor(featureinfo())
    self._csocket = csocket # client socket for server-client mode

    self._rptgen = rpt # report gen obj
    self._cache = use_cache

    self._np = no_thread # no of threads
    self._no_otfc = no_otfc # no on-the-fly check for pin consistency

    sim_cfg_golden = sim_cfg.get_golden()
    sim_cfg_revised = sim_cfg.get_revised()


    # You can run only either golden sim or revised sim if you need by setting golden(revised)sim_only args
    # But, you can't turn them on both
    assert not (goldensim_only and revisedsim_only), mcode.ERR_003
    self.goldensim_only = goldensim_only
    self.revisedsim_only = revisedsim_only

    # make directories for golden and revised models
    self.testdir = testdir
    self._make_dir()

    # Simulator configuration of both golden and revised model.
    self._sim_cfg_golden = sim_cfg_golden
    self._sim_cfg_revised = sim_cfg_revised

    # Test configuration
    self._test_cfg = test_cfg # get test configuration for this unit test
    self._testname = self._test_cfg.get_test_name() # get a test name

    # generate intermediate testbench
    self._tb_golden = TestBench(
                               self._test_cfg,
                               self._sim_cfg_golden, 
                               self.testdir,
                               logger_id=self._logger_id
                               ).get_raw_filename()
    self._tb_revised = TestBench(
                                self._test_cfg,
                                self._sim_cfg_revised, 
                                self.testdir,
                                logger_id=self._logger_id
                                ).get_raw_filename()

    # display wires used in the instances, let user make sure they are all declared.
    #self._print_wires(self._tb_golden)

    # get a porthandler / create port objects from test cfg info.
    self._ph = PortHandler(logger_id=self._logger_id)
    self._create_port(self._test_cfg)

    # get vector generator obj.
    self._tvh = TestVectorGenerator(self._ph, self._test_cfg, logger_id=self._logger_id)

    # running vector instance
    self._rv_golden = RunVector(self._test_cfg, self._sim_cfg_golden, self._ph, self._tb_golden, self._cache, self._csocket, logger_id=self._logger_id)
    self._rv_revised = RunVector(self._test_cfg, self._sim_cfg_revised, self._ph, self._tb_revised, self._cache, self._csocket, logger_id=self._logger_id)

    # get a linear regressor obj.s for pin discrepancy check
    self._lrg_simple = LinearRegressionSM(self._ph, logger_id=self._logger_id)
    self._lrr_simple = LinearRegressionSM(self._ph, logger_id=self._logger_id)

    # get a linear regressor obj.s for pin discrepancy check (suggested)
    self._lrg_sgt_simple = LinearRegressionSM(self._ph, logger_id=self._logger_id)
    self._lrr_sgt_simple = LinearRegressionSM(self._ph, logger_id=self._logger_id)

    # get a linear regressor obj.s
    self._lrg = LinearRegressionSM(self._ph, logger_id=self._logger_id)
    self._lrr = LinearRegressionSM(self._ph, logger_id=self._logger_id)

    # regressor obj for selected model
    self._lrg_sgt = LinearRegressionSM(self._ph, logger_id=self._logger_id)
    self._lrr_sgt = LinearRegressionSM(self._ph, logger_id=self._logger_id)

    if self._cache:
      self._tvh.load_test_vector(self._ph, self.testdir)
    else:
      self._tvh.dump_test_vector(self._ph, self.testdir)

    # report port information
    if self._rptgen != None:
      self._rptgen.load_porthandler_obj(self._ph) # port object of this test
      self._rptgen.print_port_info() # print out 
Esempio n. 16
0
    parser = argparse.ArgumentParser(description=mcode.INFO_046)
    parser.add_argument('cell', help=mcode.INFO_047)
    parser.add_argument('-p',
                        '--cdslibpath',
                        help=mcode.INFO_048,
                        default=os.getcwd())
    parser.add_argument('-x',
                        '--xref',
                        help=mcode.INFO_049 % def_portxref,
                        default=def_portxref)
    return parser.parse_args()


# logger
logger = DaVELogger.get_logger(__name__)

# Run checks
display_logo()

args = pass_args()

# parse cell
lib, cell, view = args.cell.split(':')

# run
tb = TestBenchCDSInterface()(args.cdslibpath, lib, cell, view, args.xref)

if tb != None:
    # display generated testbench
    map(logger.info, print_end_msg(mcode.INFO_050, '--'))
Esempio n. 17
0
    def __init__(self, stol, logger_id=0):
        self._logger = DaVELogger.get_logger(
            '%s.%s.%s' %
            (logger_id, __name__, self.__class__.__name__))  # logger

        self._stol = stol  # input sensitivity tolerance