[FPGA-Bitstream] Added an option to ``write_fabric_bitstream`` command to enable outputting don't care bits in bitstream files
This commit is contained in:
parent
fdd75c4ec8
commit
ad54c8547e
|
@ -94,6 +94,7 @@ int write_fabric_bitstream(const OpenfpgaContext& openfpga_ctx,
|
||||||
CommandOptionId opt_file = cmd.option("file");
|
CommandOptionId opt_file = cmd.option("file");
|
||||||
CommandOptionId opt_file_format = cmd.option("format");
|
CommandOptionId opt_file_format = cmd.option("format");
|
||||||
CommandOptionId opt_fast_config = cmd.option("fast_configuration");
|
CommandOptionId opt_fast_config = cmd.option("fast_configuration");
|
||||||
|
CommandOptionId opt_keep_dont_care_bits = cmd.option("keep_dont_care_bits");
|
||||||
|
|
||||||
/* Write fabric bitstream if required */
|
/* Write fabric bitstream if required */
|
||||||
int status = CMD_EXEC_SUCCESS;
|
int status = CMD_EXEC_SUCCESS;
|
||||||
|
@ -125,6 +126,7 @@ int write_fabric_bitstream(const OpenfpgaContext& openfpga_ctx,
|
||||||
openfpga_ctx.fabric_global_port_info(),
|
openfpga_ctx.fabric_global_port_info(),
|
||||||
cmd_context.option_value(cmd, opt_file),
|
cmd_context.option_value(cmd, opt_file),
|
||||||
cmd_context.option_enable(cmd, opt_fast_config),
|
cmd_context.option_enable(cmd, opt_fast_config),
|
||||||
|
cmd_context.option_enable(cmd, opt_keep_dont_care_bits),
|
||||||
cmd_context.option_enable(cmd, opt_verbose));
|
cmd_context.option_enable(cmd, opt_verbose));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,9 @@ ShellCommandId add_openfpga_write_fabric_bitstream_command(openfpga::Shell<Openf
|
||||||
/* Add an option '--fast_configuration' */
|
/* Add an option '--fast_configuration' */
|
||||||
shell_cmd.add_option("fast_configuration", false, "Reduce the size of bitstream to be downloaded");
|
shell_cmd.add_option("fast_configuration", false, "Reduce the size of bitstream to be downloaded");
|
||||||
|
|
||||||
|
/* Add an option '--keep_dont_care_bit' */
|
||||||
|
shell_cmd.add_option("keep_dont_care_bit", false, "Keep don't care bits in bitstream file; If not enabled, don't care bits are converted to logic '0' or '1'");
|
||||||
|
|
||||||
/* Add an option '--verbose' */
|
/* Add an option '--verbose' */
|
||||||
shell_cmd.add_option("verbose", false, "Enable verbose output");
|
shell_cmd.add_option("verbose", false, "Enable verbose output");
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "vtr_time.h"
|
#include "vtr_time.h"
|
||||||
|
|
||||||
/* Headers from openfpgautil library */
|
/* Headers from openfpgautil library */
|
||||||
|
#include "openfpga_decode.h"
|
||||||
#include "openfpga_digest.h"
|
#include "openfpga_digest.h"
|
||||||
#include "openfpga_version.h"
|
#include "openfpga_version.h"
|
||||||
|
|
||||||
|
@ -192,10 +193,15 @@ static
|
||||||
int write_memory_bank_flatten_fabric_bitstream_to_text_file(std::fstream& fp,
|
int write_memory_bank_flatten_fabric_bitstream_to_text_file(std::fstream& fp,
|
||||||
const bool& fast_configuration,
|
const bool& fast_configuration,
|
||||||
const bool& bit_value_to_skip,
|
const bool& bit_value_to_skip,
|
||||||
const FabricBitstream& fabric_bitstream) {
|
const FabricBitstream& fabric_bitstream,
|
||||||
|
const bool& keep_dont_care_bits) {
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
MemoryBankFlattenFabricBitstream fabric_bits = build_memory_bank_flatten_fabric_bitstream(fabric_bitstream, fast_configuration, bit_value_to_skip, 'x');
|
char dont_care_bit = '0';
|
||||||
|
if (keep_dont_care_bits) {
|
||||||
|
dont_care_bit = DONT_CARE_CHAR;
|
||||||
|
}
|
||||||
|
MemoryBankFlattenFabricBitstream fabric_bits = build_memory_bank_flatten_fabric_bitstream(fabric_bitstream, fast_configuration, bit_value_to_skip, dont_care_bit);
|
||||||
|
|
||||||
/* The address sizes and data input sizes are the same across any element,
|
/* The address sizes and data input sizes are the same across any element,
|
||||||
* just get it from the 1st element to save runtime
|
* just get it from the 1st element to save runtime
|
||||||
|
@ -237,10 +243,15 @@ static
|
||||||
int write_memory_bank_shift_register_fabric_bitstream_to_text_file(std::fstream& fp,
|
int write_memory_bank_shift_register_fabric_bitstream_to_text_file(std::fstream& fp,
|
||||||
const bool& fast_configuration,
|
const bool& fast_configuration,
|
||||||
const bool& bit_value_to_skip,
|
const bool& bit_value_to_skip,
|
||||||
const FabricBitstream& fabric_bitstream) {
|
const FabricBitstream& fabric_bitstream,
|
||||||
|
const bool& keep_dont_care_bits) {
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
MemoryBankShiftRegisterFabricBitstream fabric_bits = build_memory_bank_shift_register_fabric_bitstream(fabric_bitstream, fast_configuration, bit_value_to_skip, 'x');
|
char dont_care_bit = '0';
|
||||||
|
if (keep_dont_care_bits) {
|
||||||
|
dont_care_bit = DONT_CARE_CHAR;
|
||||||
|
}
|
||||||
|
MemoryBankShiftRegisterFabricBitstream fabric_bits = build_memory_bank_shift_register_fabric_bitstream(fabric_bitstream, fast_configuration, bit_value_to_skip, dont_care_bit);
|
||||||
|
|
||||||
/* Output information about how to intepret the bitstream */
|
/* Output information about how to intepret the bitstream */
|
||||||
fp << "// Bitstream word count: " << fabric_bits.num_words() << std::endl;
|
fp << "// Bitstream word count: " << fabric_bits.num_words() << std::endl;
|
||||||
|
@ -356,6 +367,7 @@ int write_fabric_bitstream_to_text_file(const BitstreamManager& bitstream_manage
|
||||||
const FabricGlobalPortInfo& global_ports,
|
const FabricGlobalPortInfo& global_ports,
|
||||||
const std::string& fname,
|
const std::string& fname,
|
||||||
const bool& fast_configuration,
|
const bool& fast_configuration,
|
||||||
|
const bool& keep_dont_care_bits,
|
||||||
const bool& verbose) {
|
const bool& verbose) {
|
||||||
/* Ensure that we have a valid file name */
|
/* Ensure that we have a valid file name */
|
||||||
if (true == fname.empty()) {
|
if (true == fname.empty()) {
|
||||||
|
@ -419,13 +431,15 @@ int write_fabric_bitstream_to_text_file(const BitstreamManager& bitstream_manage
|
||||||
status = write_memory_bank_flatten_fabric_bitstream_to_text_file(fp,
|
status = write_memory_bank_flatten_fabric_bitstream_to_text_file(fp,
|
||||||
apply_fast_configuration,
|
apply_fast_configuration,
|
||||||
bit_value_to_skip,
|
bit_value_to_skip,
|
||||||
fabric_bitstream);
|
fabric_bitstream,
|
||||||
|
keep_dont_care_bits);
|
||||||
} else {
|
} else {
|
||||||
VTR_ASSERT(BLWL_PROTOCOL_SHIFT_REGISTER == config_protocol.bl_protocol_type());
|
VTR_ASSERT(BLWL_PROTOCOL_SHIFT_REGISTER == config_protocol.bl_protocol_type());
|
||||||
status = write_memory_bank_shift_register_fabric_bitstream_to_text_file(fp,
|
status = write_memory_bank_shift_register_fabric_bitstream_to_text_file(fp,
|
||||||
apply_fast_configuration,
|
apply_fast_configuration,
|
||||||
bit_value_to_skip,
|
bit_value_to_skip,
|
||||||
fabric_bitstream);
|
fabric_bitstream,
|
||||||
|
keep_dont_care_bits);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ int write_fabric_bitstream_to_text_file(const BitstreamManager& bitstream_manage
|
||||||
const FabricGlobalPortInfo& global_ports,
|
const FabricGlobalPortInfo& global_ports,
|
||||||
const std::string& fname,
|
const std::string& fname,
|
||||||
const bool& fast_configuration,
|
const bool& fast_configuration,
|
||||||
|
const bool& keep_dont_care_bits,
|
||||||
const bool& verbose);
|
const bool& verbose);
|
||||||
|
|
||||||
} /* end namespace openfpga */
|
} /* end namespace openfpga */
|
||||||
|
|
Loading…
Reference in New Issue