diff --git a/docs/source/manual/openfpga_shell/openfpga_commands/fpga_bitstream_commands.rst b/docs/source/manual/openfpga_shell/openfpga_commands/fpga_bitstream_commands.rst index bf66e4b09..d764ced67 100644 --- a/docs/source/manual/openfpga_shell/openfpga_commands/fpga_bitstream_commands.rst +++ b/docs/source/manual/openfpga_shell/openfpga_commands/fpga_bitstream_commands.rst @@ -41,6 +41,10 @@ build_architecture_bitstream .. option:: --write_file 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 diff --git a/libopenfpga/libfpgabitstream/src/report_arch_bitstream_distribution.cpp b/libopenfpga/libfpgabitstream/src/report_arch_bitstream_distribution.cpp index 1667b3e86..4446d1aac 100644 --- a/libopenfpga/libfpgabitstream/src/report_arch_bitstream_distribution.cpp +++ b/libopenfpga/libfpgabitstream/src/report_arch_bitstream_distribution.cpp @@ -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 << 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 top_block = find_bitstream_manager_top_blocks(bitstream_manager); diff --git a/libopenfpga/libfpgabitstream/src/report_arch_bitstream_distribution.h b/libopenfpga/libfpgabitstream/src/report_arch_bitstream_distribution.h index 322a65901..4b684d3b8 100644 --- a/libopenfpga/libfpgabitstream/src/report_arch_bitstream_distribution.h +++ b/libopenfpga/libfpgabitstream/src/report_arch_bitstream_distribution.h @@ -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 */ diff --git a/libopenfpga/libfpgabitstream/src/write_xml_arch_bitstream.cpp b/libopenfpga/libfpgabitstream/src/write_xml_arch_bitstream.cpp index 17e94cd15..0c6c5fe49 100644 --- a/libopenfpga/libfpgabitstream/src/write_xml_arch_bitstream.cpp +++ b/libopenfpga/libfpgabitstream/src/write_xml_arch_bitstream.cpp @@ -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 << 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 top_block = find_bitstream_manager_top_blocks(bitstream_manager); diff --git a/libopenfpga/libfpgabitstream/src/write_xml_arch_bitstream.h b/libopenfpga/libfpgabitstream/src/write_xml_arch_bitstream.h index 5d30b8d6d..9a93280b4 100644 --- a/libopenfpga/libfpgabitstream/src/write_xml_arch_bitstream.h +++ b/libopenfpga/libfpgabitstream/src/write_xml_arch_bitstream.h @@ -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 */ diff --git a/libopenfpga/libfpgabitstream/test/test_arch_bitstream.cpp b/libopenfpga/libfpgabitstream/test/test_arch_bitstream.cpp index d71b077c4..ed88406c5 100644 --- a/libopenfpga/libfpgabitstream/test/test_arch_bitstream.cpp +++ b/libopenfpga/libfpgabitstream/test/test_arch_bitstream.cpp @@ -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]); } diff --git a/openfpga/src/base/openfpga_bitstream.cpp b/openfpga/src/base/openfpga_bitstream.cpp index 9dff1c7a8..43d9801b3 100644 --- a/openfpga/src/base/openfpga_bitstream.cpp +++ b/openfpga/src/base/openfpga_bitstream.cpp @@ -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; diff --git a/openfpga/src/base/openfpga_bitstream_command.cpp b/openfpga/src/base/openfpga_bitstream_command.cpp index fcf431890..4f633b5b4 100644 --- a/openfpga/src/base/openfpga_bitstream_command.cpp +++ b/openfpga/src/base/openfpga_bitstream_command.cpp @@ -57,6 +57,8 @@ ShellCommandId add_openfpga_build_arch_bitstream_command(openfpga::Shell" << 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 << "\n"; diff --git a/openfpga/src/fpga_bitstream/write_xml_fabric_bitstream.h b/openfpga/src/fpga_bitstream/write_xml_fabric_bitstream.h index 73bf57912..26673e0c7 100644 --- a/openfpga/src/fpga_bitstream/write_xml_fabric_bitstream.h +++ b/openfpga/src/fpga_bitstream/write_xml_fabric_bitstream.h @@ -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 */ diff --git a/openfpga/src/fpga_bitstream/write_xml_io_mapping.cpp b/openfpga/src/fpga_bitstream/write_xml_io_mapping.cpp index 5b3f383b1..9f8ed3fa8 100644 --- a/openfpga/src/fpga_bitstream/write_xml_io_mapping.cpp +++ b/openfpga/src/fpga_bitstream/write_xml_io_mapping.cpp @@ -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 << 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 << "\n"; diff --git a/openfpga/src/fpga_bitstream/write_xml_io_mapping.h b/openfpga/src/fpga_bitstream/write_xml_io_mapping.h index 330106141..1a68cb75a 100644 --- a/openfpga/src/fpga_bitstream/write_xml_io_mapping.h +++ b/openfpga/src/fpga_bitstream/write_xml_io_mapping.h @@ -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 */