From 9d0e002532f5ea6547ecbd321b7a2d649ef175ec Mon Sep 17 00:00:00 2001 From: tangxifan Date: Tue, 16 Jun 2020 21:29:45 -0600 Subject: [PATCH] echo path in architecture bitstream database --- .../fpga_bitstream/arch_bitstream_writer.cpp | 7 ++++++- .../src/fpga_bitstream/bitstream_manager.cpp | 20 +++++++++++++++++++ .../src/fpga_bitstream/bitstream_manager.h | 9 +++++++++ .../fpga_bitstream/build_grid_bitstream.cpp | 2 ++ .../build_routing_bitstream.cpp | 4 ++++ 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/openfpga/src/fpga_bitstream/arch_bitstream_writer.cpp b/openfpga/src/fpga_bitstream/arch_bitstream_writer.cpp index 7f7e8ed07..eeaa5a417 100644 --- a/openfpga/src/fpga_bitstream/arch_bitstream_writer.cpp +++ b/openfpga/src/fpga_bitstream/arch_bitstream_writer.cpp @@ -82,7 +82,12 @@ void rec_write_block_bitstream_to_xml_file(std::fstream& fp, /* Output child bits under this block */ size_t bit_counter = 0; - fp << "\t" << std::endl; + fp << "\t" << std::endl; for (const ConfigBitId& child_bit : bitstream_manager.block_bits(block)) { fp << "\t\t& shared_config_bits) { /* Ensure the input ids are valid */ VTR_ASSERT(true == valid_bit_id(bit)); @@ -184,4 +200,8 @@ bool BitstreamManager::valid_block_id(const ConfigBlockId& block_id) const { return (size_t(block_id) < block_ids_.size()) && (block_id == block_ids_[block_id]); } +bool BitstreamManager::valid_block_path_id(const ConfigBlockId& block_id) const { + return (true == valid_block_id(block_id)) && (-2 != block_path_id(block_id)); +} + } /* end namespace openfpga */ diff --git a/openfpga/src/fpga_bitstream/bitstream_manager.h b/openfpga/src/fpga_bitstream/bitstream_manager.h index 58a2af8ee..4ed2570bd 100644 --- a/openfpga/src/fpga_bitstream/bitstream_manager.h +++ b/openfpga/src/fpga_bitstream/bitstream_manager.h @@ -82,6 +82,9 @@ class BitstreamManager { /* Find the child block in a bitstream manager with a given name */ ConfigBlockId find_child_block(const ConfigBlockId& block_id, const std::string& child_block_name) const; + /* Find path id of a block */ + int block_path_id(const ConfigBlockId& block_id) const; + public: /* Public Mutators */ /* Add a new configuration bit to the bitstream manager */ ConfigBitId add_bit(const bool& bit_value); @@ -95,6 +98,9 @@ class BitstreamManager { /* Add a configuration bit to a block */ void add_bit_to_block(const ConfigBlockId& block, const ConfigBitId& bit); + /* Add a path id to a block */ + void add_path_id_to_block(const ConfigBlockId& block, const int& path_id); + /* Add share configuration bits to a configuration bit */ void add_shared_config_bit_values(const ConfigBitId& bit, const std::vector& shared_config_bits); @@ -103,6 +109,8 @@ class BitstreamManager { bool valid_block_id(const ConfigBlockId& block_id) const; + bool valid_block_path_id(const ConfigBlockId& block_id) const; + private: /* Internal data */ /* Unique id of a block of bits in the Bitstream */ vtr::vector block_ids_; @@ -118,6 +126,7 @@ class BitstreamManager { vtr::vector block_names_; vtr::vector parent_block_ids_; vtr::vector> child_block_ids_; + vtr::vector block_path_ids_; /* Unique id of a bit in the Bitstream */ vtr::vector bit_ids_; diff --git a/openfpga/src/fpga_bitstream/build_grid_bitstream.cpp b/openfpga/src/fpga_bitstream/build_grid_bitstream.cpp index 204d7b31e..20a8ccf0a 100644 --- a/openfpga/src/fpga_bitstream/build_grid_bitstream.cpp +++ b/openfpga/src/fpga_bitstream/build_grid_bitstream.cpp @@ -203,6 +203,8 @@ void build_physical_block_pin_interc_bitstream(BitstreamManager& bitstream_manag /* Link the memory bits to the mux mem block */ bitstream_manager.add_bit_to_block(mux_mem_block, config_bit); } + /* Record path ids */ + bitstream_manager.add_path_id_to_block(mux_mem_block, mux_input_pin_id); break; } default: diff --git a/openfpga/src/fpga_bitstream/build_routing_bitstream.cpp b/openfpga/src/fpga_bitstream/build_routing_bitstream.cpp index 0713fcb09..6f0803c03 100644 --- a/openfpga/src/fpga_bitstream/build_routing_bitstream.cpp +++ b/openfpga/src/fpga_bitstream/build_routing_bitstream.cpp @@ -85,6 +85,8 @@ void build_switch_block_mux_bitstream(BitstreamManager& bitstream_manager, /* Link the memory bits to the mux mem block */ bitstream_manager.add_bit_to_block(mux_mem_block, config_bit); } + /* Record path ids */ + bitstream_manager.add_path_id_to_block(mux_mem_block, path_id); } /******************************************************************** @@ -239,6 +241,8 @@ void build_connection_block_mux_bitstream(BitstreamManager& bitstream_manager, /* Link the memory bits to the mux mem block */ bitstream_manager.add_bit_to_block(mux_mem_block, config_bit); } + /* Record path ids */ + bitstream_manager.add_path_id_to_block(mux_mem_block, path_id); }