From aded675633b4f2c3fe84f1d3034ca6ae4e4c95df Mon Sep 17 00:00:00 2001 From: tangxifan Date: Sun, 21 Jun 2020 13:06:39 -0600 Subject: [PATCH] rename files in fpga bitstream library to be consistent with conventions --- ...tstream_writer.cpp => write_xml_arch_bitstream.cpp} | 10 ++++------ ...h_bitstream_writer.h => write_xml_arch_bitstream.h} | 9 ++++----- .../libfpgabitstream/test/test_arch_bitstream.cpp | 4 ++-- openfpga/src/base/openfpga_bitstream.cpp | 8 +++----- 4 files changed, 13 insertions(+), 18 deletions(-) rename libopenfpga/libfpgabitstream/src/{arch_bitstream_writer.cpp => write_xml_arch_bitstream.cpp} (94%) rename libopenfpga/libfpgabitstream/src/{arch_bitstream_writer.h => write_xml_arch_bitstream.h} (61%) diff --git a/libopenfpga/libfpgabitstream/src/arch_bitstream_writer.cpp b/libopenfpga/libfpgabitstream/src/write_xml_arch_bitstream.cpp similarity index 94% rename from libopenfpga/libfpgabitstream/src/arch_bitstream_writer.cpp rename to libopenfpga/libfpgabitstream/src/write_xml_arch_bitstream.cpp index 17a3bc9cf..0cc8c88b0 100644 --- a/libopenfpga/libfpgabitstream/src/arch_bitstream_writer.cpp +++ b/libopenfpga/libfpgabitstream/src/write_xml_arch_bitstream.cpp @@ -17,7 +17,7 @@ #include "openfpga_reserved_words.h" #include "bitstream_manager_utils.h" -#include "arch_bitstream_writer.h" +#include "write_xml_arch_bitstream.h" /* begin namespace openfpga */ namespace openfpga { @@ -166,9 +166,8 @@ void rec_write_block_bitstream_to_xml_file(std::fstream& fp, * specific FPGAs * 3. TODO: support FASM format *******************************************************************/ -void write_arch_independent_bitstream_to_xml_file(const BitstreamManager& bitstream_manager, - const std::string& top_block_name, - const std::string& fname) { +void write_xml_architecture_bitstream(const BitstreamManager& bitstream_manager, + const std::string& fname) { /* 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,9 +187,8 @@ void write_arch_independent_bitstream_to_xml_file(const BitstreamManager& bitstr /* Find the top block, which has not parents */ std::vector top_block = find_bitstream_manager_top_blocks(bitstream_manager); - /* Make sure we have only 1 top block and its name matches the top module */ + /* Make sure we have only 1 top block */ VTR_ASSERT(1 == top_block.size()); - VTR_ASSERT(0 == top_block_name.compare(bitstream_manager.block_name(top_block[0]))); /* Write bitstream, block by block, in a recursive way */ rec_write_block_bitstream_to_xml_file(fp, bitstream_manager, top_block[0], 0); diff --git a/libopenfpga/libfpgabitstream/src/arch_bitstream_writer.h b/libopenfpga/libfpgabitstream/src/write_xml_arch_bitstream.h similarity index 61% rename from libopenfpga/libfpgabitstream/src/arch_bitstream_writer.h rename to libopenfpga/libfpgabitstream/src/write_xml_arch_bitstream.h index 91f9e271d..5d30b8d6d 100644 --- a/libopenfpga/libfpgabitstream/src/arch_bitstream_writer.h +++ b/libopenfpga/libfpgabitstream/src/write_xml_arch_bitstream.h @@ -1,5 +1,5 @@ -#ifndef ARCH_BITSTREAM_WRITER_H -#define ARCH_BITSTREAM_WRITER_H +#ifndef WRITE_XML_ARCH_BITSTREAM_H +#define WRITE_XML_ARCH_BITSTREAM_H /******************************************************************** * Include header files that are required by function declaration @@ -14,9 +14,8 @@ /* begin namespace openfpga */ namespace openfpga { -void write_arch_independent_bitstream_to_xml_file(const BitstreamManager& bitstream_manager, - const std::string& top_block_name, - const std::string& fname); +void write_xml_architecture_bitstream(const BitstreamManager& bitstream_manager, + const std::string& fname); } /* end namespace openfpga */ diff --git a/libopenfpga/libfpgabitstream/test/test_arch_bitstream.cpp b/libopenfpga/libfpgabitstream/test/test_arch_bitstream.cpp index 05915c1ed..88d00601e 100644 --- a/libopenfpga/libfpgabitstream/test/test_arch_bitstream.cpp +++ b/libopenfpga/libfpgabitstream/test/test_arch_bitstream.cpp @@ -9,7 +9,7 @@ /* Headers from fabric key */ #include "read_xml_arch_bitstream.h" -#include "arch_bitstream_writer.h" +#include "write_xml_arch_bitstream.h" int main(int argc, const char** argv) { /* Ensure we have only one or two argument */ @@ -24,7 +24,7 @@ int main(int argc, const char** argv) { * This is optional only used when there is a second argument */ if (3 <= argc) { - openfpga::write_arch_independent_bitstream_to_xml_file(test_bitstream, std::string("fpga_top"), argv[2]); + openfpga::write_xml_architecture_bitstream(test_bitstream, argv[2]); VTR_LOG("Echo the bitstream to an XML file: %s.\n", argv[2]); } diff --git a/openfpga/src/base/openfpga_bitstream.cpp b/openfpga/src/base/openfpga_bitstream.cpp index 870b5935a..32fb8b945 100644 --- a/openfpga/src/base/openfpga_bitstream.cpp +++ b/openfpga/src/base/openfpga_bitstream.cpp @@ -10,11 +10,10 @@ /* Headers from openfpgautil library */ #include "openfpga_digest.h" -#include "openfpga_reserved_words.h" /* Headers from fpgabitstream library */ #include "read_xml_arch_bitstream.h" -#include "arch_bitstream_writer.h" +#include "write_xml_arch_bitstream.h" #include "build_device_bitstream.h" #include "fabric_bitstream_writer.h" @@ -51,9 +50,8 @@ int fpga_bitstream(OpenfpgaContext& openfpga_ctx, /* Create directories */ create_directory(src_dir_path); - write_arch_independent_bitstream_to_xml_file(openfpga_ctx.bitstream_manager(), - std::string(FPGA_TOP_MODULE_NAME), - cmd_context.option_value(cmd, opt_write_file)); + write_xml_architecture_bitstream(openfpga_ctx.bitstream_manager(), + cmd_context.option_value(cmd, opt_write_file)); } /* TODO: should identify the error code from internal function execution */