コード例 #1
0
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
        template.set_property_value('clk',clk)
        template.set_property_value('clk_period',"%s_PERIOD"%(clk))
        gen_clk_code += template.return_temp_buf()+'\n'
        constant_time_code += "constant %s_PERIOD : TIME := %s\n;"%(clk,clk_period)

    signals_code = vhdfile.gen_signals_code(initial_state_dic)
    return gen_clk_code, signals_code, constant_time_code
コード例 #2
0
def return_process_tbl(gconfig,pdic, temp_buf, stimuli_f, tb_name,source_dir, format_type):
    tables = gconfig['tables']
    process_data = ""
    stimuli_data = ""
    tb_periods = gconfig['tb_period']
    for table in tables:
        template = TemplateBuf(temp_buf)
        stemplate = TemplateBuf(stimuli_f)
        ports = tables[table]
        vector_conf = get_vector_conf(ports,pdic)
        max_size = vector_conf[2]
        file_var_name = 'data_in_%s'%table
        tbl_file = '%s_%s_%s.tbl'%(tb_name.lower(),format_type,table)
        data = ""
        for port in ports:
            (msb,lsb) = vector_conf[1][port]
            if msb == lsb:
                data += "\t%s <= data_s(%s);\n"%(port,lsb)
            else:
                data += "\t%s <=data_s(%s downto %s);\n"%(port,msb,lsb)
        template.set_property_value('process_name',table+"_process")
        template.set_property_value('data',data)
        template.set_property_value('max',max_size)
        template.set_property_value('max-1',max_size-1)
        if len(tb_periods) == 1:
            period = tb_periods['tb']
        else:
            period = tb_periods[table]
        template.set_property_value('PERIOD',period)
        template.set_property_value('file_var_name',file_var_name)
        process_data += template.return_temp_buf()
        stemplate.set_property_value('name',file_var_name)
        stemplate.set_property_value('file_name',source_dir+'/'+tbl_file)
        stimuli_data += stemplate.return_temp_buf()
    return process_data,stimuli_data