コード例 #1
0
def command_tb_file(tb_name, config,source_control, format_type):
    data = Template(templates_dir+"/TestBenchCommandTemplate.py.temp")
    data.set_property_value('config',config)
    data.set_property_value('source_control',source_control)
    data.set_property_value('tb_name', tb_name)
    data.set_property_value('stimuli_source',format_type)
    return data.return_temp_buf()
コード例 #2
0
def vhd_tb_file(gconfig, vhdfile,tb_name,source_dir,format_type):
    headers = vhdl_headers['normal']
    Name = vhdfile.get_name()
    Component = vhdfile.get_component_def()
    clock_gen, signals, const_time = return_signals_and_gen_clk_code(vhdfile,gconfig)
    instance = vhdfile.gen_instance("UTT0")
    p = process[input_formats[format_type]]
    process_code,stimuli_code = p[1](gconfig,vhdfile.get_ports_dic(),
                                     p[0],p[2],'tb_'+Name,
                                     source_dir,format_type)
    vhd_tb = Template(templates_dir+"/tb_tbl.vhd")
    vhd_tb.set_property_value('headers',headers)
    vhd_tb.set_property_value('Name',tb_name)
    vhd_tb.set_property_value('component',Component)
    vhd_tb.set_property_value('clock_gen',clock_gen)
    vhd_tb.set_property_value('signals',signals+const_time)
    vhd_tb.set_property_value('instance',instance)
    vhd_tb.set_property_value('process',process_code)
    vhd_tb.set_property_value('stimuli_input',stimuli_code)

    return vhd_tb.return_temp_buf()
コード例 #3
0
        stemplate.set_property_value('file_name',source_dir+'/'+tbl_file)
        stimuli_data += stemplate.return_temp_buf()
    return process_data,stimuli_data

input_formats = {'xls':'tbl',
                 'xlsx':'tbl',
                 'ods':'tbl',
                 'manual':'single'
                }

input_format_module = {'xls':'vhd_tb.sheets',
                        'xlsx':'vhd_tb.sheets',
                        'ods':'vhd_tb.sheets',
                        }

process = {'tbl': [Template(templates_dir+'/process_tbl.tmp').return_temp_buf(),
                   return_process_tbl,
                   'file <name> : text open read_mode is \"<file_name>\";\n'],
           'single': '<process_name>:process\n<data>',
          }

input_formats_h = '/'.join(input_formats)

def return_signals_and_gen_clk_code(vhdfile,gconfig):
    initial_state_dic = {}
    gen_clk_code = ""
    constant_time_code = ""
    for clk in gconfig['clks_period']:
        template = TemplateBuf(clkgt)
        clk_period,istate = gconfig['clks_period'][clk]
        initial_state_dic[clk] = istate