diff --git a/openfpga/src/base/openfpga_bitstream.cpp b/openfpga/src/base/openfpga_bitstream.cpp
index b1af639b5..1a6345040 100644
--- a/openfpga/src/base/openfpga_bitstream.cpp
+++ b/openfpga/src/base/openfpga_bitstream.cpp
@@ -43,6 +43,7 @@ int fpga_bitstream(OpenfpgaContext& openfpga_ctx,
create_directory(src_dir_path);
write_arch_independent_bitstream_to_xml_file(openfpga_ctx.bitstream_manager(),
+ g_vpr_ctx.atom(),
cmd_context.option_value(cmd, opt_file));
}
diff --git a/openfpga/src/fpga_bitstream/arch_bitstream_writer.cpp b/openfpga/src/fpga_bitstream/arch_bitstream_writer.cpp
index eeaa5a417..3006a6db6 100644
--- a/openfpga/src/fpga_bitstream/arch_bitstream_writer.cpp
+++ b/openfpga/src/fpga_bitstream/arch_bitstream_writer.cpp
@@ -51,13 +51,14 @@ void write_bitstream_xml_file_head(std::fstream& fp) {
*******************************************************************/
static
void rec_write_block_bitstream_to_xml_file(std::fstream& fp,
+ const AtomContext& atom_ctx,
const BitstreamManager& bitstream_manager,
const ConfigBlockId& block) {
valid_file_stream(fp);
/* Dive to child blocks if this block has any */
for (const ConfigBlockId& child_block : bitstream_manager.block_children(block)) {
- rec_write_block_bitstream_to_xml_file(fp, bitstream_manager, child_block);
+ rec_write_block_bitstream_to_xml_file(fp, atom_ctx, bitstream_manager, child_block);
}
if (0 == bitstream_manager.block_bits(block).size()) {
@@ -80,6 +81,37 @@ void rec_write_block_bitstream_to_xml_file(std::fstream& fp,
}
fp << "\t" << std::endl;
+ /* Output input/output nets if there are any */
+ if (false == bitstream_manager.block_input_net_ids(block).empty()) {
+ fp << "\t\n";
+ fp << "\t\t\n";
+ for (const AtomNetId& net : bitstream_manager.block_input_net_ids(block)) {
+ if (false == atom_ctx.nlist.valid_net_id(net)) {
+ fp << " unmapped";
+ } else {
+ VTR_ASSERT_SAFE(true == atom_ctx.nlist.valid_net_id(net));
+ fp << " " << atom_ctx.nlist.net_name(net);
+ }
+ }
+ fp << "\n";
+ fp << "\t\n";
+ }
+
+ if (false == bitstream_manager.block_output_net_ids(block).empty()) {
+ fp << "\t\n";
+ fp << "\t\t\n";
+ for (const AtomNetId& net : bitstream_manager.block_output_net_ids(block)) {
+ if (false == atom_ctx.nlist.valid_net_id(net)) {
+ fp << " unmapped";
+ } else {
+ VTR_ASSERT_SAFE(true == atom_ctx.nlist.valid_net_id(net));
+ fp << " " << atom_ctx.nlist.net_name(net);
+ }
+ }
+ fp << "\n";
+ fp << "\t\n";
+ }
+
/* Output child bits under this block */
size_t bit_counter = 0;
fp << "\t" << std::endl;
+
for (const ConfigBitId& child_bit : bitstream_manager.block_bits(block)) {
fp << "\t\t
+#include "vpr_context.h"
#include "bitstream_manager.h"
/********************************************************************
@@ -15,6 +16,7 @@
namespace openfpga {
void write_arch_independent_bitstream_to_xml_file(const BitstreamManager& bitstream_manager,
+ const AtomContext& clustering_ctx,
const std::string& fname);
} /* end namespace openfpga */
diff --git a/openfpga/src/fpga_bitstream/bitstream_manager.cpp b/openfpga/src/fpga_bitstream/bitstream_manager.cpp
index aaa3a384f..15946c292 100644
--- a/openfpga/src/fpga_bitstream/bitstream_manager.cpp
+++ b/openfpga/src/fpga_bitstream/bitstream_manager.cpp
@@ -115,6 +115,20 @@ int BitstreamManager::block_path_id(const ConfigBlockId& block_id) const {
return block_path_ids_[block_id];
}
+std::vector BitstreamManager::block_input_net_ids(const ConfigBlockId& block_id) const {
+ /* Ensure the input ids are valid */
+ VTR_ASSERT(true == valid_block_id(block_id));
+
+ return block_input_net_ids_[block_id];
+}
+
+std::vector BitstreamManager::block_output_net_ids(const ConfigBlockId& block_id) const {
+ /* Ensure the input ids are valid */
+ VTR_ASSERT(true == valid_block_id(block_id));
+
+ return block_output_net_ids_[block_id];
+}
+
/******************************************************************************
* Public Mutators
******************************************************************************/
@@ -136,6 +150,8 @@ ConfigBlockId BitstreamManager::add_block(const std::string& block_name) {
block_names_.push_back(block_name);
block_bit_ids_.emplace_back();
block_path_ids_.push_back(-2);
+ block_input_net_ids_.emplace_back();
+ block_output_net_ids_.emplace_back();
parent_block_ids_.push_back(ConfigBlockId::INVALID());
child_block_ids_.emplace_back();
@@ -182,6 +198,24 @@ void BitstreamManager::add_path_id_to_block(const ConfigBlockId& block, const in
block_path_ids_[block] = path_id;
}
+void BitstreamManager::add_input_net_id_to_block(const ConfigBlockId& block,
+ const AtomNetId& input_net_id) {
+ /* Ensure the input ids are valid */
+ VTR_ASSERT(true == valid_block_id(block));
+
+ /* Add the bit to the block */
+ block_input_net_ids_[block].push_back(input_net_id);
+}
+
+void BitstreamManager::add_output_net_id_to_block(const ConfigBlockId& block,
+ const AtomNetId& output_net_id) {
+ /* Ensure the input ids are valid */
+ VTR_ASSERT(true == valid_block_id(block));
+
+ /* Add the bit to the block */
+ block_output_net_ids_[block].push_back(output_net_id);
+}
+
void BitstreamManager::add_shared_config_bit_values(const ConfigBitId& bit, const std::vector& shared_config_bits) {
/* Ensure the input ids are valid */
VTR_ASSERT(true == valid_bit_id(bit));
diff --git a/openfpga/src/fpga_bitstream/bitstream_manager.h b/openfpga/src/fpga_bitstream/bitstream_manager.h
index 4ed2570bd..0621a214e 100644
--- a/openfpga/src/fpga_bitstream/bitstream_manager.h
+++ b/openfpga/src/fpga_bitstream/bitstream_manager.h
@@ -38,6 +38,9 @@
#include