Add more information in SB XML outputter

This commit is contained in:
tangxifan 2019-05-28 15:56:41 -06:00
parent ca402f87e5
commit e7e18eb4c1
2 changed files with 35 additions and 22 deletions

View File

@ -1067,7 +1067,6 @@ RRSwitchBlock rotate_rr_switch_block_for_mirror(DeviceCoordinator& device_range,
return rotated_rr_switch_block;
}
/* 3. TOP-RIGHT corner:
* swap the opin_node between TOP and BOTTOM,
* swap the chan_node between TOP and BOTTOM,
@ -1225,6 +1224,16 @@ DeviceRRSwitchBlock build_device_rr_switch_blocks(boolean output_sb_xml, char* s
"Backannotated %d switch blocks.\n",
(nx + 1) * (ny + 1) );
if (TRUE == output_sb_xml) {
write_device_rr_switch_block_to_xml(sb_xml_dir, LL_device_rr_switch_block);
/* Skip rotating mirror searching */
vpr_printf(TIO_MESSAGE_INFO,
"Output XML description of Switch Blocks to %s.\n",
sb_xml_dir);
}
LL_device_rr_switch_block.build_unique_mirror();
/* Report number of unique mirrors */
@ -1261,17 +1270,6 @@ DeviceRRSwitchBlock build_device_rr_switch_blocks(boolean output_sb_xml, char* s
"Detect %d rotatable unique switch blocks from %d switch blocks.\n",
LL_device_rr_switch_block.get_num_rotatable_mirror(), (nx + 1) * (ny + 1) );
if (TRUE == output_sb_xml) {
write_device_rr_switch_block_to_xml(sb_xml_dir, LL_device_rr_switch_block);
/* Skip rotating mirror searching */
vpr_printf(TIO_MESSAGE_INFO,
"Output XML description of Switch Blocks to %s.\n",
sb_xml_dir);
}
return LL_device_rr_switch_block;
}

View File

@ -13,7 +13,7 @@
void write_rr_switch_block_to_xml(std::string fname_prefix, RRSwitchBlock& rr_sb) {
/* Prepare file name */
std::string fname(fname_prefix);
fname += rr_sb.gen_verilog_instance_name();
fname += rr_sb.gen_verilog_module_name();
fname += ".xml";
vpr_printf(TIO_MESSAGE_INFO, "Output SB XML: %s\n", fname.c_str());
@ -44,7 +44,8 @@ void write_rr_switch_block_to_xml(std::string fname_prefix, RRSwitchBlock& rr_sb
/* Output node information: location, index, side */
fp << "\t<" << convert_chan_type_to_string(cur_rr_node->type)
<< " side=\"" << side_manager.to_string()
<< "\" index=\"" << inode << "\">"
<< "\" index=\"" << inode
<< "\">"
<< std::endl;
/* Check if this node is directly connected to the node on the opposite side */
@ -60,9 +61,10 @@ void write_rr_switch_block_to_xml(std::string fname_prefix, RRSwitchBlock& rr_sb
/* Direct connection: output the node on the opposite side */
if (0 == num_drive_rr_nodes) {
Side oppo_side = side_manager.get_opposite();
fp << "\t\t<drive_node type=\"" << convert_chan_type_to_string(cur_rr_node->type)
fp << "\t\t<driver_node type=\"" << convert_chan_type_to_string(cur_rr_node->type)
<< "\" side=\"" << oppo_side.to_string()
<< "\" index=\"" << rr_sb.get_node_index(cur_rr_node, oppo_side.get_side(), IN_PORT) << "\"/>"
<< "\" index=\"" << rr_sb.get_node_index(cur_rr_node, oppo_side.get_side(), IN_PORT)
<< "\"/>"
<< std::endl;
} else {
for (size_t jnode = 0; jnode < num_drive_rr_nodes; ++jnode) {
@ -73,20 +75,33 @@ void write_rr_switch_block_to_xml(std::string fname_prefix, RRSwitchBlock& rr_sb
std::string node_type_str;
if (OPIN == drive_rr_nodes[jnode]->type) {
node_type_str = "opin";
Side grid_side(rr_sb.get_opin_node_grid_side(drive_node_side, drive_node_index));
fp << "\t\t<driver_node type=\"" << node_type_str
<< "\" side=\"" << drive_side.to_string()
<< "\" index=\"" << drive_node_index
<< "\" grid_side=\"" << grid_side.to_string()
<<"\"/>"
<< std::endl;
} else {
node_type_str = convert_chan_type_to_string(drive_rr_nodes[jnode]->type);
size_t segment_id = rr_sb.get_chan_node_segment(drive_node_side, drive_node_index);
fp << "\t\t<driver_node type=\"" << node_type_str
<< "\" side=\"" << drive_side.to_string()
<< "\" index=\"" << drive_node_index
<< "\" segment_id=\"" << segment_id
<< "\"/>"
<< std::endl;
}
fp << "\t\t<drive_node type=\"" << node_type_str
<< "\" side=\"" << drive_side.to_string()
<< "\" index=\"" << drive_node_index << "\"/>"
<< std::endl;
}
}
fp << "\t</" << convert_chan_type_to_string(cur_rr_node->type) << ">" << std::endl;
fp << "\t</" << convert_chan_type_to_string(cur_rr_node->type)
<< ">"
<< std::endl;
}
}
fp << "</rr_sb>" << std::endl;
fp << "</rr_sb>"
<< std::endl;
/* close a file */
fp.close();