[FPGA-Bitstream] Now has a new option ``--no_time_stamp`` to all the commands that output bitstream files
This commit is contained in:
parent
a4659020f2
commit
25143d07f1
|
@ -41,6 +41,10 @@ build_architecture_bitstream
|
|||
.. option:: --write_file <string>
|
||||
|
||||
Output the fabric-independent bitstream to an XML file. See details at :ref:`file_formats_architecture_bitstream`.
|
||||
|
||||
.. option:: --no_time_stamp
|
||||
|
||||
Do not print time stamp in bitstream files
|
||||
|
||||
.. option:: --verbose
|
||||
|
||||
|
@ -81,6 +85,10 @@ write_fabric_bitstream
|
|||
|
||||
Keep don't care bits (``x``) in the outputted bitstream file. This is only applicable to plain text file format. If not enabled, the don't care bits are converted to either logic ``0`` or ``1``.
|
||||
|
||||
.. option:: --no_time_stamp
|
||||
|
||||
Do not print time stamp in bitstream files
|
||||
|
||||
.. option:: --verbose
|
||||
|
||||
Show verbose log
|
||||
|
@ -95,6 +103,10 @@ write_io_mapping
|
|||
Specify the file name where the I/O mapping will be outputted to.
|
||||
See file formats in :ref:`file_format_io_mapping_file`.
|
||||
|
||||
.. option:: --no_time_stamp
|
||||
|
||||
Do not print time stamp in bitstream files
|
||||
|
||||
.. option:: --verbose
|
||||
|
||||
Show verbose log
|
||||
|
@ -113,6 +125,10 @@ report_bitstream_distribution
|
|||
|
||||
Specify the maximum depth of the block which should appear in the block
|
||||
|
||||
.. option:: --no_time_stamp
|
||||
|
||||
Do not print time stamp in bitstream files
|
||||
|
||||
.. option:: --verbose
|
||||
|
||||
Show verbose log
|
||||
|
|
|
@ -27,16 +27,20 @@ namespace openfpga {
|
|||
* This function write header information for an XML file of bitstream distribution
|
||||
*******************************************************************/
|
||||
static
|
||||
void report_architecture_bitstream_distribution_xml_file_head(std::fstream& fp) {
|
||||
void report_architecture_bitstream_distribution_xml_file_head(std::fstream& fp,
|
||||
const bool& include_time_stamp) {
|
||||
valid_file_stream(fp);
|
||||
|
||||
auto end = std::chrono::system_clock::now();
|
||||
std::time_t end_time = std::chrono::system_clock::to_time_t(end);
|
||||
|
||||
fp << "<!-- " << std::endl;
|
||||
fp << "\t- Report Architecture Bitstream Distribution" << std::endl;
|
||||
fp << "\t- Version: " << openfpga::VERSION << std::endl;
|
||||
fp << "\t- Date: " << std::ctime(&end_time) ;
|
||||
|
||||
if (include_time_stamp) {
|
||||
auto end = std::chrono::system_clock::now();
|
||||
std::time_t end_time = std::chrono::system_clock::to_time_t(end);
|
||||
fp << "\t- Date: " << std::ctime(&end_time) ;
|
||||
}
|
||||
|
||||
fp << "--> " << std::endl;
|
||||
fp << std::endl;
|
||||
}
|
||||
|
@ -88,6 +92,7 @@ void rec_report_block_bitstream_distribution_to_xml_file(std::fstream& fp,
|
|||
*******************************************************************/
|
||||
int report_architecture_bitstream_distribution(const BitstreamManager& bitstream_manager,
|
||||
const std::string& fname,
|
||||
const bool& include_time_stamp,
|
||||
const size_t& max_hierarchy_level) {
|
||||
/* Ensure that we have a valid file name */
|
||||
if (true == fname.empty()) {
|
||||
|
@ -105,7 +110,7 @@ int report_architecture_bitstream_distribution(const BitstreamManager& bitstream
|
|||
check_file_stream(fname.c_str(), fp);
|
||||
|
||||
/* Put down a brief introduction */
|
||||
report_architecture_bitstream_distribution_xml_file_head(fp);
|
||||
report_architecture_bitstream_distribution_xml_file_head(fp, include_time_stamp);
|
||||
|
||||
/* Find the top block, which has not parents */
|
||||
std::vector<ConfigBlockId> top_block = find_bitstream_manager_top_blocks(bitstream_manager);
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace openfpga {
|
|||
|
||||
int report_architecture_bitstream_distribution(const BitstreamManager& bitstream_manager,
|
||||
const std::string& fname,
|
||||
const bool& include_time_stamp,
|
||||
const size_t& max_hierarchy_level = 1);
|
||||
|
||||
} /* end namespace openfpga */
|
||||
|
|
|
@ -27,17 +27,21 @@ namespace openfpga {
|
|||
* This function write header information to a bitstream file
|
||||
*******************************************************************/
|
||||
static
|
||||
void write_bitstream_xml_file_head(std::fstream& fp) {
|
||||
void write_bitstream_xml_file_head(std::fstream& fp,
|
||||
const bool& include_time_stamp) {
|
||||
valid_file_stream(fp);
|
||||
|
||||
auto end = std::chrono::system_clock::now();
|
||||
std::time_t end_time = std::chrono::system_clock::to_time_t(end);
|
||||
|
||||
fp << "<!--" << std::endl;
|
||||
fp << "\t- Architecture independent bitstream" << std::endl;
|
||||
fp << "\t- Author: Xifan TANG" << std::endl;
|
||||
fp << "\t- Organization: University of Utah" << std::endl;
|
||||
fp << "\t- Date: " << std::ctime(&end_time) ;
|
||||
|
||||
if (include_time_stamp) {
|
||||
auto end = std::chrono::system_clock::now();
|
||||
std::time_t end_time = std::chrono::system_clock::to_time_t(end);
|
||||
fp << "\t- Date: " << std::ctime(&end_time) ;
|
||||
}
|
||||
|
||||
fp << "-->" << std::endl;
|
||||
fp << std::endl;
|
||||
}
|
||||
|
@ -172,7 +176,8 @@ void rec_write_block_bitstream_to_xml_file(std::fstream& fp,
|
|||
* 3. TODO: support FASM format
|
||||
*******************************************************************/
|
||||
void write_xml_architecture_bitstream(const BitstreamManager& bitstream_manager,
|
||||
const std::string& fname) {
|
||||
const std::string& fname,
|
||||
const bool& include_time_stamp) {
|
||||
/* Ensure that we have a valid file name */
|
||||
if (true == fname.empty()) {
|
||||
VTR_LOG_ERROR("Received empty file name to output bitstream!\n\tPlease specify a valid file name.\n");
|
||||
|
@ -188,7 +193,7 @@ void write_xml_architecture_bitstream(const BitstreamManager& bitstream_manager,
|
|||
check_file_stream(fname.c_str(), fp);
|
||||
|
||||
/* Put down a brief introduction */
|
||||
write_bitstream_xml_file_head(fp);
|
||||
write_bitstream_xml_file_head(fp, include_time_stamp);
|
||||
|
||||
/* Find the top block, which has not parents */
|
||||
std::vector<ConfigBlockId> top_block = find_bitstream_manager_top_blocks(bitstream_manager);
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
namespace openfpga {
|
||||
|
||||
void write_xml_architecture_bitstream(const BitstreamManager& bitstream_manager,
|
||||
const std::string& fname);
|
||||
const std::string& fname,
|
||||
const bool& include_time_stamp);
|
||||
|
||||
} /* end namespace openfpga */
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
int main(int argc, const char** argv) {
|
||||
/* Ensure we have only one or two or 3 argument */
|
||||
VTR_ASSERT((2 == argc) || (3 == argc) || (4 == argc));
|
||||
VTR_ASSERT((2 == argc) || (3 == argc) || (4 == argc) || (5 == argc));
|
||||
|
||||
/* Parse the bitstream from an XML file */
|
||||
openfpga::BitstreamManager test_bitstream = openfpga::read_xml_architecture_bitstream(argv[1]);
|
||||
|
@ -25,16 +25,22 @@ int main(int argc, const char** argv) {
|
|||
* This is optional only used when there is a second argument
|
||||
*/
|
||||
if (3 <= argc) {
|
||||
openfpga::write_xml_architecture_bitstream(test_bitstream, argv[2]);
|
||||
VTR_LOG("Echo the bitstream to an XML file: %s.\n",
|
||||
openfpga::write_xml_architecture_bitstream(test_bitstream, argv[2], true);
|
||||
VTR_LOG("Echo the bitstream (with time stamp) to an XML file: %s.\n",
|
||||
argv[2]);
|
||||
openfpga::write_xml_architecture_bitstream(test_bitstream, argv[2], false);
|
||||
VTR_LOG("Echo the bitstream (w/o time stamp) to an XML file: %s.\n",
|
||||
argv[2]);
|
||||
}
|
||||
/* Output the bitstream distribution to an XML file
|
||||
* This is optional only used when there is a third argument
|
||||
*/
|
||||
if (4 <= argc) {
|
||||
openfpga::report_architecture_bitstream_distribution(test_bitstream, argv[3]);
|
||||
VTR_LOG("Echo the bitstream distribution to an XML file: %s.\n",
|
||||
openfpga::report_architecture_bitstream_distribution(test_bitstream, argv[3], true);
|
||||
VTR_LOG("Echo the bitstream distribution (with time stamp) to an XML file: %s.\n",
|
||||
argv[3]);
|
||||
openfpga::report_architecture_bitstream_distribution(test_bitstream, argv[3], false);
|
||||
VTR_LOG("Echo the bitstream distribution (w/o time stamp) to an XML file: %s.\n",
|
||||
argv[3]);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ int fpga_bitstream(OpenfpgaContext& openfpga_ctx,
|
|||
const Command& cmd, const CommandContext& cmd_context) {
|
||||
|
||||
CommandOptionId opt_verbose = cmd.option("verbose");
|
||||
CommandOptionId opt_no_time_stamp = cmd.option("no_time_stamp");
|
||||
CommandOptionId opt_write_file = cmd.option("write_file");
|
||||
CommandOptionId opt_read_file = cmd.option("read_file");
|
||||
|
||||
|
@ -58,7 +59,8 @@ int fpga_bitstream(OpenfpgaContext& openfpga_ctx,
|
|||
create_directory(src_dir_path);
|
||||
|
||||
write_xml_architecture_bitstream(openfpga_ctx.bitstream_manager(),
|
||||
cmd_context.option_value(cmd, opt_write_file));
|
||||
cmd_context.option_value(cmd, opt_write_file),
|
||||
!cmd_context.option_enable(cmd, opt_no_time_stamp));
|
||||
}
|
||||
|
||||
/* TODO: should identify the error code from internal function execution */
|
||||
|
@ -95,6 +97,7 @@ int write_fabric_bitstream(const OpenfpgaContext& openfpga_ctx,
|
|||
CommandOptionId opt_file_format = cmd.option("format");
|
||||
CommandOptionId opt_fast_config = cmd.option("fast_configuration");
|
||||
CommandOptionId opt_keep_dont_care_bits = cmd.option("keep_dont_care_bits");
|
||||
CommandOptionId opt_no_time_stamp = cmd.option("no_time_stamp");
|
||||
|
||||
/* Write fabric bitstream if required */
|
||||
int status = CMD_EXEC_SUCCESS;
|
||||
|
@ -117,6 +120,7 @@ int write_fabric_bitstream(const OpenfpgaContext& openfpga_ctx,
|
|||
openfpga_ctx.fabric_bitstream(),
|
||||
openfpga_ctx.arch().config_protocol,
|
||||
cmd_context.option_value(cmd, opt_file),
|
||||
!cmd_context.option_enable(cmd, opt_no_time_stamp),
|
||||
cmd_context.option_enable(cmd, opt_verbose));
|
||||
} else {
|
||||
/* By default, output in plain text format */
|
||||
|
@ -128,6 +132,7 @@ int write_fabric_bitstream(const OpenfpgaContext& openfpga_ctx,
|
|||
cmd_context.option_value(cmd, opt_file),
|
||||
cmd_context.option_enable(cmd, opt_fast_config),
|
||||
cmd_context.option_enable(cmd, opt_keep_dont_care_bits),
|
||||
!cmd_context.option_enable(cmd, opt_no_time_stamp),
|
||||
cmd_context.option_enable(cmd, opt_verbose));
|
||||
}
|
||||
|
||||
|
@ -141,6 +146,7 @@ int write_io_mapping(const OpenfpgaContext& openfpga_ctx,
|
|||
const Command& cmd, const CommandContext& cmd_context) {
|
||||
|
||||
CommandOptionId opt_verbose = cmd.option("verbose");
|
||||
CommandOptionId opt_no_time_stamp = cmd.option("no_time_stamp");
|
||||
CommandOptionId opt_file = cmd.option("file");
|
||||
|
||||
/* Write fabric bitstream if required */
|
||||
|
@ -175,6 +181,7 @@ int write_io_mapping(const OpenfpgaContext& openfpga_ctx,
|
|||
|
||||
status = write_io_mapping_to_xml_file(io_map,
|
||||
cmd_context.option_value(cmd, opt_file),
|
||||
!cmd_context.option_enable(cmd, opt_no_time_stamp),
|
||||
cmd_context.option_enable(cmd, opt_verbose));
|
||||
|
||||
return status;
|
||||
|
@ -187,6 +194,7 @@ int report_bitstream_distribution(const OpenfpgaContext& openfpga_ctx,
|
|||
const Command& cmd, const CommandContext& cmd_context) {
|
||||
|
||||
CommandOptionId opt_file = cmd.option("file");
|
||||
CommandOptionId opt_no_time_stamp = cmd.option("no_time_stamp");
|
||||
|
||||
int status = CMD_EXEC_SUCCESS;
|
||||
|
||||
|
@ -212,6 +220,7 @@ int report_bitstream_distribution(const OpenfpgaContext& openfpga_ctx,
|
|||
|
||||
status = report_architecture_bitstream_distribution(openfpga_ctx.bitstream_manager(),
|
||||
cmd_context.option_value(cmd, opt_file),
|
||||
!cmd_context.option_enable(cmd, opt_no_time_stamp),
|
||||
depth);
|
||||
|
||||
return status;
|
||||
|
|
|
@ -57,6 +57,8 @@ ShellCommandId add_openfpga_build_arch_bitstream_command(openfpga::Shell<Openfpg
|
|||
CommandOptionId opt_read_file = shell_cmd.add_option("read_file", false, "file path to read the bitstream database");
|
||||
shell_cmd.set_option_require_value(opt_read_file, openfpga::OPT_STRING);
|
||||
|
||||
/* Add an option '--no_time_stamp' */
|
||||
shell_cmd.add_option("no_time_stamp", false, "Do not print time stamp in output files");
|
||||
|
||||
/* Add an option '--verbose' */
|
||||
shell_cmd.add_option("verbose", false, "Enable verbose output");
|
||||
|
@ -92,6 +94,9 @@ ShellCommandId add_openfpga_report_bitstream_distribution_command(openfpga::Shel
|
|||
CommandOptionId opt_depth = shell_cmd.add_option("depth", false, "Specify the max. depth of blocks which will appear in report");
|
||||
shell_cmd.set_option_require_value(opt_depth, openfpga::OPT_STRING);
|
||||
|
||||
/* Add an option '--no_time_stamp' */
|
||||
shell_cmd.add_option("no_time_stamp", false, "Do not print time stamp in output files");
|
||||
|
||||
/* Add an option '--verbose' */
|
||||
shell_cmd.add_option("verbose", false, "Enable verbose output");
|
||||
|
||||
|
@ -157,6 +162,9 @@ ShellCommandId add_openfpga_write_fabric_bitstream_command(openfpga::Shell<Openf
|
|||
/* Add an option '--keep_dont_care_bit' */
|
||||
shell_cmd.add_option("keep_dont_care_bits", 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 '--no_time_stamp' */
|
||||
shell_cmd.add_option("no_time_stamp", false, "Do not print time stamp in output files");
|
||||
|
||||
/* Add an option '--verbose' */
|
||||
shell_cmd.add_option("verbose", false, "Enable verbose output");
|
||||
|
||||
|
@ -187,6 +195,9 @@ ShellCommandId add_openfpga_write_io_mapping_command(openfpga::Shell<OpenfpgaCon
|
|||
shell_cmd.set_option_short_name(opt_file, "f");
|
||||
shell_cmd.set_option_require_value(opt_file, openfpga::OPT_STRING);
|
||||
|
||||
/* Add an option '--no_time_stamp' */
|
||||
shell_cmd.add_option("no_time_stamp", false, "Do not print time stamp in output files");
|
||||
|
||||
/* Add an option '--verbose' */
|
||||
shell_cmd.add_option("verbose", false, "Enable verbose output");
|
||||
|
||||
|
|
|
@ -30,15 +30,18 @@ namespace openfpga {
|
|||
* This function write header information to a bitstream file
|
||||
*******************************************************************/
|
||||
static
|
||||
void write_fabric_bitstream_text_file_head(std::fstream& fp) {
|
||||
void write_fabric_bitstream_text_file_head(std::fstream& fp,
|
||||
const bool& include_time_stamp) {
|
||||
valid_file_stream(fp);
|
||||
|
||||
auto end = std::chrono::system_clock::now();
|
||||
std::time_t end_time = std::chrono::system_clock::to_time_t(end);
|
||||
|
||||
fp << "// Fabric bitstream" << std::endl;
|
||||
fp << "// Version: " << openfpga::VERSION << std::endl;
|
||||
fp << "// Date: " << std::ctime(&end_time);
|
||||
|
||||
if (include_time_stamp) {
|
||||
auto end = std::chrono::system_clock::now();
|
||||
std::time_t end_time = std::chrono::system_clock::to_time_t(end);
|
||||
fp << "// Date: " << std::ctime(&end_time);
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
|
@ -370,6 +373,7 @@ int write_fabric_bitstream_to_text_file(const BitstreamManager& bitstream_manage
|
|||
const std::string& fname,
|
||||
const bool& fast_configuration,
|
||||
const bool& keep_dont_care_bits,
|
||||
const bool& include_time_stamp,
|
||||
const bool& verbose) {
|
||||
/* Ensure that we have a valid file name */
|
||||
if (true == fname.empty()) {
|
||||
|
@ -399,7 +403,7 @@ int write_fabric_bitstream_to_text_file(const BitstreamManager& bitstream_manage
|
|||
}
|
||||
|
||||
/* Write file head */
|
||||
write_fabric_bitstream_text_file_head(fp);
|
||||
write_fabric_bitstream_text_file_head(fp, include_time_stamp);
|
||||
|
||||
/* Output fabric bitstream to the file */
|
||||
int status = 0;
|
||||
|
|
|
@ -27,6 +27,7 @@ int write_fabric_bitstream_to_text_file(const BitstreamManager& bitstream_manage
|
|||
const std::string& fname,
|
||||
const bool& fast_configuration,
|
||||
const bool& keep_dont_care_bits,
|
||||
const bool& include_time_stamp,
|
||||
const bool& verbose);
|
||||
|
||||
} /* end namespace openfpga */
|
||||
|
|
|
@ -28,17 +28,21 @@ namespace openfpga {
|
|||
* This function write header information to a bitstream file
|
||||
*******************************************************************/
|
||||
static
|
||||
void write_fabric_bitstream_xml_file_head(std::fstream& fp) {
|
||||
void write_fabric_bitstream_xml_file_head(std::fstream& fp,
|
||||
const bool& include_time_stamp) {
|
||||
valid_file_stream(fp);
|
||||
|
||||
auto end = std::chrono::system_clock::now();
|
||||
std::time_t end_time = std::chrono::system_clock::to_time_t(end);
|
||||
|
||||
fp << "<!--" << std::endl;
|
||||
fp << "\t- Fabric bitstream" << std::endl;
|
||||
fp << "\t- Author: Xifan TANG" << std::endl;
|
||||
fp << "\t- Organization: University of Utah" << std::endl;
|
||||
fp << "\t- Date: " << std::ctime(&end_time) ;
|
||||
|
||||
auto end = std::chrono::system_clock::now();
|
||||
std::time_t end_time = std::chrono::system_clock::to_time_t(end);
|
||||
if (include_time_stamp) {
|
||||
fp << "\t- Date: " << std::ctime(&end_time) ;
|
||||
}
|
||||
|
||||
fp << "-->" << std::endl;
|
||||
fp << std::endl;
|
||||
}
|
||||
|
@ -201,6 +205,7 @@ int write_fabric_bitstream_to_xml_file(const BitstreamManager& bitstream_manager
|
|||
const FabricBitstream& fabric_bitstream,
|
||||
const ConfigProtocol& config_protocol,
|
||||
const std::string& fname,
|
||||
const bool& include_time_stamp,
|
||||
const bool& verbose) {
|
||||
/* Ensure that we have a valid file name */
|
||||
if (true == fname.empty()) {
|
||||
|
@ -217,7 +222,7 @@ int write_fabric_bitstream_to_xml_file(const BitstreamManager& bitstream_manager
|
|||
check_file_stream(fname.c_str(), fp);
|
||||
|
||||
/* Write XML head */
|
||||
write_fabric_bitstream_xml_file_head(fp);
|
||||
write_fabric_bitstream_xml_file_head(fp, include_time_stamp);
|
||||
|
||||
int xml_hierarchy_depth = 0;
|
||||
fp << "<fabric_bitstream>\n";
|
||||
|
|
|
@ -21,6 +21,7 @@ int write_fabric_bitstream_to_xml_file(const BitstreamManager& bitstream_manager
|
|||
const FabricBitstream& fabric_bitstream,
|
||||
const ConfigProtocol& config_protocol,
|
||||
const std::string& fname,
|
||||
const bool& include_time_stamp,
|
||||
const bool& verbose);
|
||||
|
||||
} /* end namespace openfpga */
|
||||
|
|
|
@ -29,16 +29,20 @@ namespace openfpga {
|
|||
* This function write header information to an I/O mapping file
|
||||
*******************************************************************/
|
||||
static
|
||||
void write_io_mapping_xml_file_head(std::fstream& fp) {
|
||||
void write_io_mapping_xml_file_head(std::fstream& fp,
|
||||
const bool& include_time_stamp) {
|
||||
valid_file_stream(fp);
|
||||
|
||||
auto end = std::chrono::system_clock::now();
|
||||
std::time_t end_time = std::chrono::system_clock::to_time_t(end);
|
||||
|
||||
fp << "<!--" << std::endl;
|
||||
fp << "\t- I/O mapping" << std::endl;
|
||||
fp << "\t- Version: " << openfpga::VERSION << std::endl;
|
||||
fp << "\t- Date: " << std::ctime(&end_time) ;
|
||||
|
||||
if (include_time_stamp) {
|
||||
auto end = std::chrono::system_clock::now();
|
||||
std::time_t end_time = std::chrono::system_clock::to_time_t(end);
|
||||
fp << "\t- Date: " << std::ctime(&end_time) ;
|
||||
}
|
||||
|
||||
fp << "-->" << std::endl;
|
||||
fp << std::endl;
|
||||
}
|
||||
|
@ -93,6 +97,7 @@ int write_io_mapping_pair_to_xml_file(std::fstream& fp,
|
|||
*******************************************************************/
|
||||
int write_io_mapping_to_xml_file(const IoMap& io_map,
|
||||
const std::string& fname,
|
||||
const bool& include_time_stamp,
|
||||
const bool& verbose) {
|
||||
/* Ensure that we have a valid file name */
|
||||
if (true == fname.empty()) {
|
||||
|
@ -110,7 +115,7 @@ int write_io_mapping_to_xml_file(const IoMap& io_map,
|
|||
check_file_stream(fname.c_str(), fp);
|
||||
|
||||
/* Write XML head */
|
||||
write_io_mapping_xml_file_head(fp);
|
||||
write_io_mapping_xml_file_head(fp, include_time_stamp);
|
||||
|
||||
int xml_hierarchy_depth = 0;
|
||||
fp << "<io_mapping>\n";
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace openfpga {
|
|||
|
||||
int write_io_mapping_to_xml_file(const IoMap& io_map,
|
||||
const std::string& fname,
|
||||
const bool& include_time_stamp,
|
||||
const bool& verbose);
|
||||
|
||||
} /* end namespace openfpga */
|
||||
|
|
Loading…
Reference in New Issue