예제 #1
0
def generate_channelizer_executable(name, n_chans, width, filter_length, defines):
    """
    Generate an icarus verilog channelizer executable.
    
    Args:
        name: A name to identify the executable by.
        n_chans: Number of channels to split into.
        width: The width of a complex number
               (actually required so we can get the twiddle factor widths for fft).
        filter_length: The length of each filter in the filterbank.
        defines: Macro definitions for the verilog files.
    """
    builddir = get_builddir()
    inputfiles = generate_channelizer_files(n_chans, width, filter_length)                      
    dut_channelizer_fn = copyfile('channelizer', 'dut_channelizer.v')
    executable = "channelizer_{name}".format(name=name)
    executable = os.path.join(config.builddir, 'channelizer', executable)
    inputfilestr = ' '.join(inputfiles + [dut_channelizer_fn])
    defines.update({
            'N': n_chans,
            'LOG_N': int(math.ceil(math.log(n_chans)/math.log(2))),
            'FLTLEN': filter_length,
            'LOG_FLTLEN': int(math.ceil(math.log(filter_length)/math.log(2))),
})
    definestr = make_define_string(defines)
    cmd = ("iverilog -o {executable} {definestr} {inputfiles}"
           ).format(executable=executable,
                    definestr=definestr,
                    inputfiles=inputfilestr)
    logger.debug(cmd)
    os.system(cmd)
    return executable
예제 #2
0
def generate_dit_executable(name, fft_length, defines):
    log_fft_length = math.log(fft_length) / math.log(2)
    if log_fft_length != int(log_fft_length):
        raise ValueError("fft_length must be a power of two")
    log_fft_length = int(log_fft_length)
    get_builddir()
    defines['N'] = fft_length
    defines['LOG_N'] = log_fft_length
    dut_dit_fn = copyfile('fft', 'dut_dit.v')
    inputfiles = generate_dit_files(fft_length, defines['WIDTH'] / 2)
    executable = "dit_{name}".format(name=name)
    executable = os.path.join(config.builddir, 'fft', executable)
    inputfilestr = ' '.join(inputfiles + [dut_dit_fn])
    definestr = make_define_string(defines)
    cmd = ("iverilog -o {executable} {definestr} {inputfiles}").format(
        executable=executable, definestr=definestr, inputfiles=inputfilestr)
    logger.debug(cmd)
    os.system(cmd)
    return executable
예제 #3
0
def generate_dit_executable(name, fft_length, defines): 
    log_fft_length = math.log(fft_length)/math.log(2)
    if log_fft_length != int(log_fft_length):
        raise ValueError("fft_length must be a power of two")
    log_fft_length = int(log_fft_length)
    get_builddir()
    defines['N'] = fft_length
    defines['LOG_N'] = log_fft_length
    dut_dit_fn = copyfile('fft', 'dut_dit.v')
    inputfiles = generate_dit_files(fft_length, defines['WIDTH']/2)
    executable = "dit_{name}".format(name=name)
    executable = os.path.join(config.builddir, 'fft', executable)
    inputfilestr = ' '.join(inputfiles + [dut_dit_fn])
    definestr = make_define_string(defines)
    cmd = ("iverilog -o {executable} {definestr} {inputfiles}"
           ).format(executable=executable,
                    definestr=definestr,
                    inputfiles=inputfilestr)
    logger.debug(cmd)
    os.system(cmd)
    return executable