From 1e763515b3ba64300016da5e2b100f13b546cb07 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Sat, 20 Jun 2020 18:39:21 -0600 Subject: [PATCH] bug fix in bitstream parser and writer --- .../libfpgabitstream/src/arch_bitstream_writer.cpp | 4 ++-- .../libfpgabitstream/src/read_xml_arch_bitstream.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libopenfpga/libfpgabitstream/src/arch_bitstream_writer.cpp b/libopenfpga/libfpgabitstream/src/arch_bitstream_writer.cpp index ebb0a3129..2e4e81054 100644 --- a/libopenfpga/libfpgabitstream/src/arch_bitstream_writer.cpp +++ b/libopenfpga/libfpgabitstream/src/arch_bitstream_writer.cpp @@ -98,7 +98,7 @@ void rec_write_block_bitstream_to_xml_file(std::fstream& fp, for (const std::string& net : bitstream_manager.block_input_net_ids(block)) { write_tab_to_file(fp, hierarchy_level + 2); fp << ""; @@ -116,7 +116,7 @@ void rec_write_block_bitstream_to_xml_file(std::fstream& fp, for (const std::string& net : bitstream_manager.block_output_net_ids(block)) { write_tab_to_file(fp, hierarchy_level + 2); fp << ""; diff --git a/libopenfpga/libfpgabitstream/src/read_xml_arch_bitstream.cpp b/libopenfpga/libfpgabitstream/src/read_xml_arch_bitstream.cpp index e7bcb726c..3895b85b6 100644 --- a/libopenfpga/libfpgabitstream/src/read_xml_arch_bitstream.cpp +++ b/libopenfpga/libfpgabitstream/src/read_xml_arch_bitstream.cpp @@ -57,7 +57,7 @@ void rec_read_xml_bitstream_block(pugi::xml_node& xml_bitstream_block, bad_tag(xml_input_net, loc_data, xml_input_nets, {"path"}); } const int& id = get_attribute(xml_input_net, "id", loc_data).as_int(); - const std::string& net_name = get_attribute(xml_input_net, "name", loc_data).as_string(); + const std::string& net_name = get_attribute(xml_input_net, "net_name", loc_data).as_string(); VTR_ASSERT((size_t)id < input_nets.size()); input_nets[id] = net_name; } @@ -81,7 +81,7 @@ void rec_read_xml_bitstream_block(pugi::xml_node& xml_bitstream_block, bad_tag(xml_output_net, loc_data, xml_output_nets, {"path"}); } const int& id = get_attribute(xml_output_net, "id", loc_data).as_int(); - const std::string& net_name = get_attribute(xml_output_net, "name", loc_data).as_string(); + const std::string& net_name = get_attribute(xml_output_net, "net_name", loc_data).as_string(); VTR_ASSERT((size_t)id < output_nets.size()); output_nets[id] = net_name; } @@ -95,7 +95,7 @@ void rec_read_xml_bitstream_block(pugi::xml_node& xml_bitstream_block, pugi::xml_node xml_bitstream = get_single_child(xml_bitstream_block, "bitstream", loc_data, pugiutil::ReqOpt::OPTIONAL); if (xml_bitstream) { /* Parse path_id: -2 is an invalid value defined in the bitstream manager internally */ - const int& path_id = get_attribute(xml_bitstream, "path_id", loc_data).as_int(); + const int& path_id = get_attribute(xml_bitstream, "path_id", loc_data, pugiutil::ReqOpt::OPTIONAL).as_int(-2); if (-2 < path_id) { bitstream_manager.add_path_id_to_block(curr_block, path_id); } @@ -117,7 +117,7 @@ void rec_read_xml_bitstream_block(pugi::xml_node& xml_bitstream_block, for (pugi::xml_node xml_child : xml_bitstream_block.children()) { /* We only care child bitstream blocks here */ if (xml_child.name() == std::string("bitstream_block")) { - rec_read_xml_bitstream_block(xml_bitstream_block, loc_data, bitstream_manager, curr_block); + rec_read_xml_bitstream_block(xml_child, loc_data, bitstream_manager, curr_block); } } }