Example #1
0
def get_sch_master(module_db: ModuleDB,
                   sch_design_params: Dict[str, Any]) -> Module:
    lib_name = sch_design_params['lib_name']
    cell_name = sch_design_params['cell_name']
    params = sch_design_params['params']

    gen_cls = cast(Type[Module],
                   module_db.get_schematic_class(lib_name, cell_name))
    ans = module_db.new_master(gen_cls, params=params)
    return ans
Example #2
0
def generate(prj,
             temp_lib,
             impl_lib,
             cell_name,
             lay_params,
             sch_params,
             mdl_params,
             grid_opts,
             mdl_dir,
             mdl_opts=None,
             impl_cell_name=None):
    """
        generate layout, schematic and model.
    """

    # temp_db = make_tdb(prj, impl_loib, grid_opts)
    #
    # print('designing module')
    # # layout
    # print(lay_params)
    # template = temp_db.new_template(params=lay_params, temp_cls=NAND, debug=True)
    # if impl_cell_name is None:
    #     temp_db.instantiate_layout(prj, template, cell_name, debug=True)
    # else:
    #     temp_db.instantiate_layout(prj, template, impl_cell_name, debug=True)

    # generate schematic
    if sch_params is None:
        sch_params = {}
    # sch_params.update(template.sch_params)
    print(sch_params)

    sch_db = ModuleDB(prj.tech_info, impl_lib, prj=prj)
    gen_cls = sch_db.get_schematic_class(temp_lib, cell_name)
    dsn = sch_db.new_master(gen_cls, params=sch_params)
    if impl_cell_name is None:
        sch_db.instantiate_master(DesignOutput.SCHEMATIC, dsn)
    else:
        sch_db.instantiate_master(DesignOutput.SCHEMATIC,
                                  dsn,
                                  top_cell_name=impl_cell_name)

    # generate model
    file_name = f"{mdl_dir}/{cell_name}.sv"
    top_cell_name = cell_name if impl_cell_name is None else impl_cell_name
    if mdl_opts is None:
        mdl_opts = {}
    sch_db.instantiate_model(dsn,
                             mdl_params,
                             top_cell_name=top_cell_name,
                             fname=file_name,
                             **mdl_opts)
Example #3
0
def run_main(prj: BagProject, gen_sch: bool = True, gen_cdl: bool = True, run_lvs: bool = True) \
        -> None:
    lib_name = 'AAA_XBASE_TEST'
    fname = '00_mom_cap.yaml'

    impl_cell = 'MOMCap_core'
    fname_cdl = 'pvs_run/lvs_run_dir/' + lib_name + '/' + impl_cell + '/schematic.net'

    params = read_yaml(Path('specs_test', 'xbase', fname))

    db = TemplateDB(prj.grid, lib_name, prj=prj)

    print('creating new template')
    master = db.new_template(MOMCapCore, params)
    print('creating batch layout')
    # db.batch_layout([(master, '')], DesignOutput.LAYOUT)
    db.batch_layout([(master, impl_cell)], DesignOutput.LAYOUT)
    print('done')

    if gen_sch or gen_cdl:
        sch_db = ModuleDB(prj.tech_info, lib_name, prj=prj)

        sch_master = sch_db.new_master(xbase__momcap_core, master.sch_params)
        cv_info_list = []

        print('creating schematic')
        sch_db.batch_schematic([(sch_master, impl_cell)],
                               cv_info_out=cv_info_list)
        print('schematic creation done')

        if gen_cdl:
            print('creating CDL netlist')
            sch_db.batch_schematic([(sch_master, impl_cell)],
                                   output=DesignOutput.CDL,
                                   fname=fname_cdl,
                                   cv_info_list=cv_info_list)
            print('netlist creation done')

    if run_lvs:
        print('Running LVS ...')
        lvs_passed, lvs_log = prj.run_lvs(lib_name,
                                          impl_cell,
                                          netlist=fname_cdl)
        print('LVS log file:' + lvs_log)
        if lvs_passed:
            print('LVS passed!')
        else:
            print('LVS failed :(')
Example #4
0
def generate_wrapper(sch_db: ModuleDB, wrapper_params: Dict[str, Any],
                     cv_info_list: List, dut_netlist: str,
                     gen_sch: bool) -> None:
    wrapper_lib = wrapper_params.pop('wrapper_lib')
    wrapper_cell = wrapper_params.pop('wrapper_cell')
    wrapper_impl_cell = wrapper_params.pop('impl_cell')
    wrapper_netlist_path = Path(wrapper_params.pop('netlist_file'))
    wrapper_netlist_path.parent.mkdir(parents=True, exist_ok=True)

    wrapper_cls = sch_db.get_schematic_class(wrapper_lib, wrapper_cell)
    wrapper_master = sch_db.new_master(wrapper_cls,
                                       params=wrapper_params['params'])
    wrapper_list = [(wrapper_master, wrapper_impl_cell)]

    sch_db.batch_schematic(wrapper_list,
                           output=DesignOutput.SPECTRE,
                           fname=str(wrapper_netlist_path),
                           cv_info_list=cv_info_list,
                           cv_netlist=dut_netlist)
    print(f'wrapper_netlist: {str(wrapper_netlist_path)}')
    if gen_sch:
        sch_db.batch_schematic(wrapper_list, output=DesignOutput.SCHEMATIC)