write bin function no compile error

This commit is contained in:
Lin 2024-09-27 11:34:57 +08:00
parent 0cca4952bc
commit 3fcdc10d3a
3 changed files with 64 additions and 52 deletions

View File

@ -18,13 +18,13 @@ enum BlockType {
struct BlockInfo { struct BlockInfo {
type @0: BlockType; type @0: BlockType;
x @1: Int32; x @1: UInt32;
y @2: Int32; y @2: UInt32;
} }
struct InstanceInfo { struct InstanceInfo {
x @0: Int32; x @0: UInt32;
y @1: Int32; y @1: UInt32;
} }

View File

@ -190,26 +190,24 @@ int write_xml_unique_blocks(const DeviceRRGSB& device_rr_gsb, const char* fname,
return CMD_EXEC_SUCCESS; return CMD_EXEC_SUCCESS;
} }
// int write_bin_atom_block(std::fstream& fp, // int write_bin_atom_block(const std::vector<vtr::Point<size_t>>& instance_map,
// const std::vector<vtr::Point<size_t>>& instance_map,
// const vtr::Point<size_t>& unique_block_coord, // const vtr::Point<size_t>& unique_block_coord,
// std::string type, // const uniqueblockcap::BlockType type,
// ucap::RrGraph::Builder &root) { // uniqueblockcap::UniqueBlockPacked::Builder &root) {
//
// root.init // auto block_info = root.initBlockInfo();
// write_xml_attribute(fp, "type", type.c_str()); // block_info.setX(unique_block_coord.x());
// write_xml_attribute(fp, "x", unique_block_coord.x()); // block_info.setY(unique_block_coord.y());
// write_xml_attribute(fp, "y", unique_block_coord.y()); // block_info.setType(type);
// auto instance_list = root.initInstanceList(instance_map.size());
// for (const auto& instance_info : instance_map) { // for (size_t instance_id = 0; instance_id < instance_map; instance_id++) {
// if (instance_info.x() == unique_block_coord.x() && // if (instance_map[instance_id].x() == unique_block_coord.x() &&
// instance_info.y() == unique_block_coord.y()) { // instance_map[instance_id].y() == unique_block_coord.y()) {
// ; // ;
// } else { // } else {
// openfpga::write_tab_to_file(fp, 2); // auto instance = instance_list[instance_id];
// fp << "<instance"; // instance.setX(instance_map[instance_id].x());
// write_xml_attribute(fp, "x", instance_info.x()); // instance.setY(instance_map[instance_id].y());
// write_xml_attribute(fp, "y", instance_info.y());
// } // }
// } // }
// return openfpga::CMD_EXEC_SUCCESS; // return openfpga::CMD_EXEC_SUCCESS;
@ -224,37 +222,46 @@ int write_bin_unique_blocks(const DeviceRRGSB& device_rr_gsb, const char* fname,
int num_unique_blocks = device_rr_gsb.get_num_sb_unique_module() + int num_unique_blocks = device_rr_gsb.get_num_sb_unique_module() +
device_rr_gsb.get_num_cb_unique_module(CHANX) + device_rr_gsb.get_num_cb_unique_module(CHANX) +
device_rr_gsb.get_num_cb_unique_module(CHANY); device_rr_gsb.get_num_cb_unique_module(CHANY);
unique_blocks.initAtomInfo(num_unique_blocks); auto block_list = unique_blocks.initAtomInfo(num_unique_blocks);
// for (size_t id = 0; id < device_rr_gsb.get_num_sb_unique_module(); ++id) {
// const auto unique_block_coord = device_rr_gsb.get_sb_unique_block_coord(id);
// const std::vector<vtr::Point<size_t>> instance_map =
// device_rr_gsb.get_sb_unique_block_instance_coord(unique_block_coord);
// auto unique_block = unique_blocks[id]; for (size_t id = 0; id < device_rr_gsb.get_num_sb_unique_module(); ++id) {
// auto block_info = unique_block.initBlockInfo(); const auto unique_block_coord = device_rr_gsb.get_sb_unique_block_coord(id);
// block_info.setX(unique_block_coord.x()); const std::vector<vtr::Point<size_t>> instance_map =
// block_info.setY(unique_block_coord.y()); device_rr_gsb.get_sb_unique_block_instance_coord(unique_block_coord);
// block_info.setType(SB);
// auto instance_list = unique_block.initInstanceList(instance_map.size());
// for (size_t instance_id = 0; instance_id < instance_map; instance_id++) {
// if (instance_map[instance_id].x() == unique_block_coord.x() &&
// instance_map[instance_id].y() == unique_block_coord.y()) {
// ;
// } else {
// auto instance = instance_list[instance_id];
// instance.setX(instance_map[instance_id].x());
// instance.setY(instance_map[instance_id].y());
// }
// }
// }
auto unique_block = block_list[id];
auto block_info = unique_block.initBlockInfo();
block_info.setX(unique_block_coord.x());
block_info.setY(unique_block_coord.y());
block_info.setType(uniqueblockcap::BlockType::SB);
auto instance_list = unique_block.initInstanceList(instance_map.size());
for (size_t instance_id = 0; instance_id < instance_map; instance_id++) {
if (instance_map[instance_id].x() == unique_block_coord.x() &&
instance_map[instance_id].y() == unique_block_coord.y()) {
;
} else {
auto instance = instance_list[instance_id];
instance.setX(instance_map[instance_id].x());
instance.setY(instance_map[instance_id].y());
}
}
// int status_code = write_bin_atom_block(instance_map, unique_block_coord,
// uniqueblockcap::BlockType::SB, unique_block);
// if (status_code != 0) {
// VTR_LOG_ERROR("write cbx unique blocks into xml file failed!");
// return CMD_EXEC_FATAL_ERROR;
// }
}
// for (size_t id = device_rr_gsb.get_num_sb_unique_module(); // for (size_t id = device_rr_gsb.get_num_sb_unique_module();
// id < device_rr_gsb.get_num_sb_unique_module() + // id < device_rr_gsb.get_num_sb_unique_module() +
// device_rr_gsb.get_num_cb_unique_module(CHANX); // device_rr_gsb.get_num_cb_unique_module(CHANX);
// ++id) { // ++id) {
// const auto unique_block_coord = device_rr_gsb.get_cbx_unique_block_coord(id); // const auto unique_block_coord =
// const std::vector<vtr::Point<size_t>> instance_map = // device_rr_gsb.get_cbx_unique_block_coord(id); const
// std::vector<vtr::Point<size_t>> instance_map =
// device_rr_gsb.get_cbx_unique_block_instance_coord(unique_block_coord); // device_rr_gsb.get_cbx_unique_block_instance_coord(unique_block_coord);
// auto unique_block = unique_blocks[id]; // auto unique_block = unique_blocks[id];
@ -275,13 +282,13 @@ int write_bin_unique_blocks(const DeviceRRGSB& device_rr_gsb, const char* fname,
// } // }
// } // }
// for (size_t id = device_rr_gsb.get_num_sb_unique_module(); // for (size_t id = device_rr_gsb.get_num_sb_unique_module();
// id < device_rr_gsb.get_num_sb_unique_module() + // id < device_rr_gsb.get_num_sb_unique_module() +
// device_rr_gsb.get_num_cb_unique_module(CHANY); // device_rr_gsb.get_num_cb_unique_module(CHANY);
// ++id) { // ++id) {
// const auto unique_block_coord = device_rr_gsb.get_cby_unique_block_coord(id); // const auto unique_block_coord =
// const std::vector<vtr::Point<size_t>> instance_map = // device_rr_gsb.get_cby_unique_block_coord(id); const
// std::vector<vtr::Point<size_t>> instance_map =
// device_rr_gsb.get_cby_unique_block_instance_coord(unique_block_coord); // device_rr_gsb.get_cby_unique_block_instance_coord(unique_block_coord);
// auto unique_block = unique_blocks[id]; // auto unique_block = unique_blocks[id];
@ -301,7 +308,7 @@ int write_bin_unique_blocks(const DeviceRRGSB& device_rr_gsb, const char* fname,
// } // }
// } // }
// } // }
// writeMessageToFile(fname, &builder); writeMessageToFile(fname, &builder);
return 0; return 0;
} }

View File

@ -35,5 +35,10 @@ int write_xml_unique_blocks(const DeviceRRGSB& device_rr_gsb, const char* fname,
bool verbose_output); bool verbose_output);
int write_bin_unique_blocks(const DeviceRRGSB& device_rr_gsb, const char* fname, int write_bin_unique_blocks(const DeviceRRGSB& device_rr_gsb, const char* fname,
bool verbose_output); bool verbose_output);
// int write_bin_atom_block(const std::vector<vtr::Point<size_t>>& instance_map,
// const vtr::Point<size_t>& unique_block_coord,
// const ::uniqueblockcap::BlockType type,
// uniqueblockcap::UniqueBlockPacked::Builder &root);
} // namespace openfpga } // namespace openfpga
#endif #endif