def compute_ss(): output = 'ibias' for mos_type in mos_list: for thres in thres_list: for lch in lch_list: # load simulation results tb_name = get_tb_name(mos_type, thres, lch) fname = os.path.join(data_dir, '%s.data' % tb_name) results = load_sim_file(fname) info = compute_ss_helper(mos_type, results, output) for key, val in info.items(): results[key] = val results['sweep_params'][key] = results['sweep_params'][output] save_sim_results(results, fname)
def sim_tia_inverter(prj, db_n, db_p, sim_env, vdd, cpd, cload, nf_n_vec, nf_p_vec, rf_vec): """ Inputs: Outputs: """ tb_name = get_tb_name() fname = os.path.join(data_dir, '%s.data' % tb_name) print("Creating testbench %s..." % tb_name) # Generate schematic tb_sch = prj.create_design_module(tb_lib, tb_cell) tb_sch.design() tb_sch.implement_design(impl_lib, top_cell_name=tb_name) tb_obj = prj.configure_testbench(impl_lib, tb_name) # Simulating nf_n, nf_p, and rf combinations in the vectors # In the interest of time, it matches each element in the vectors # i.e. nf_n_vec[i] will only be simulated with nf_p_vec[i] and rf_vec[i] for i in range(len(nf_n_vec)): # Setting the parameters in the testbench nf_n = nf_n_vec[i] nf_p = nf_p_vec[i] rf = rf_vec[i] tb_obj.set_parameter('nf_n', nf_n) tb_obj.set_parameter('nf_p', nf_p) tb_obj.set_parameter('Rf', rf) tb_obj.set_parameter('CL', cload) tb_obj.set_parameter('CPD', cpd) tb_obj.set_parameter('VDD', vdd) tb_obj.set_parameter('FIN', 5e9) tb_obj.set_parameter('IIN', 1) # Update the testbench and run the simulation tb_obj.update_testbench() print("Simulating testbench %s..." % tb_name) save_dir = tb_obj.run_simulation() # Load sim results into Python print('Simulation done, saving results') results = load_sim_results(save_dir) # Save sim results into data directory save_sim_results(results, fname) pprint.pprint(results)
def characterize(prj): # iterate through all parameters combinations for mos_type in mos_list: for thres in thres_list: for lch in lch_list: # new generated testbench name tb_name = get_tb_name(mos_type, thres, lch) print('Creating testbench %s...' % tb_name) # create schematic generator tb_sch = prj.create_design_module(tb_lib, tb_cell) tb_sch.design(mos_type=mos_type, lch=lch, threshold=thres) tb_sch.implement_design(impl_lib, top_cell_name=tb_name) # copy and load ADEXL state of generated testbench tb_obj = prj.configure_testbench(impl_lib, tb_name) # make sure vgs/vds has correct sign if mos_type == 'nch': tb_obj.set_sweep_parameter('vgs', start=0.0, stop=1.2, step=0.02) tb_obj.set_sweep_parameter('vds', start=0.0, stop=1.2, step=0.10) else: tb_obj.set_sweep_parameter('vgs', start=-1.2, stop=0.0, step=0.02) tb_obj.set_sweep_parameter('vds', start=-1.2, stop=0.0, step=0.10) # update testbench changes and run simulation tb_obj.update_testbench() print('Simulating testbench %s...' % tb_name) save_dir = tb_obj.run_simulation() # load simulation results into Python print('Simulation done, saving results') results = load_sim_results(save_dir) # save simulation results to data directory save_sim_results(results, os.path.join(data_dir, '%s.data' % tb_name)) print('Characterization done.')
async def setup_and_simulate(self, prj, sch_params): # type: (BagProject, Dict[str, Any]) -> Dict[str, Any] if sch_params is None: print('loading testbench %s' % self.tb_name) tb = prj.load_testbench(self.impl_lib, self.tb_name) else: print('Creating testbench %s' % self.tb_name) tb = self._create_tb_schematic(prj, sch_params) print('Configuring testbench %s' % self.tb_name) tb.set_simulation_environments(self.env_list) self.setup_testbench(tb) for cell_name, view_name in self.sim_view_list: tb.set_simulation_view(self.impl_lib, cell_name, view_name) tb.update_testbench() # run simulation and save/return raw result print('Simulating %s' % self.tb_name) save_dir = await tb.async_run_simulation() print('Finished simulating %s' % self.tb_name) results = load_sim_results(save_dir) save_sim_results(results, self.data_fname) return results