| 1155 | } |
| 1156 | |
| 1157 | void Database::readFlexshelfLayoutForMultiDie(std::string const &layout_file) { |
| 1158 | // ==================== Read Layout ==================== |
| 1159 | pugi::xml_document doc; |
| 1160 | pugi::xml_parse_result result = doc.load_file(layout_file.c_str()); |
| 1161 | if (!result) { |
| 1162 | openparfPrint(kError, "failed to open file %s for read\n", layout_file.c_str()); |
| 1163 | return; |
| 1164 | } |
| 1165 | pugi::xml_node arch = doc.child("arch"); |
| 1166 | pugi::xml_node cores = arch.child("cores"); |
| 1167 | pugi::xml_node chip = arch.child("chip"); |
| 1168 | BookshelfDatabaseCallbacks cbk(*this); |
| 1169 | openparfPrint(kInfo, "read layout from %s\n", layout_file.c_str()); |
| 1170 | |
| 1171 | // ------------------- read sites ------------------- |
| 1172 | struct SiteSize { |
| 1173 | int32_t width; |
| 1174 | int32_t height; |
| 1175 | int32_t offset_x; |
| 1176 | int32_t offset_y; |
| 1177 | }; |
| 1178 | |
| 1179 | int32_t num_tile = 0; |
| 1180 | std::unordered_map<std::string, std::pair<int32_t, int32_t>> tile_sizes; |
| 1181 | std::unordered_map<std::string, std::vector<SiteSize>> site_sizes; |
| 1182 | for (pugi::xml_node tile : arch.child("tile_blocks").children("tile")) { |
| 1183 | std::string type = tile.attribute("type").as_string(); |
| 1184 | int32_t tile_width = tile.attribute("width").as_int(); |
| 1185 | int32_t tile_height = tile.attribute("height").as_int(); |
| 1186 | num_tile += 1; |
| 1187 | tile_sizes[type] = {tile_width, tile_height}; |
| 1188 | |
| 1189 | if (tile.children("sub_tiles").empty()) { |
| 1190 | // read site size |
| 1191 | site_sizes[type].push_back({tile_width, tile_height, 0, 0}); |
| 1192 | openparfPrint(kInfo, "tile %s size: %d %d\n", type.c_str(), tile_width, tile_height); |
| 1193 | |
| 1194 | // read resource capacity |
| 1195 | std::vector<std::pair<std::string, uint32_t>> resource_caps; |
| 1196 | for (pugi::xml_node resource : tile.children("resource")) { |
| 1197 | std::string resource_name = resource.attribute("name").as_string(); |
| 1198 | int32_t cap = resource.attribute("num").as_int(); |
| 1199 | resource_caps.emplace_back(resource_name, cap); |
| 1200 | openparfPrint(kInfo, "tile %s resource %s capacity %d\n", type.c_str(), resource_name.c_str(), cap); |
| 1201 | } |
| 1202 | cbk.setSiteResources(type, resource_caps); |
| 1203 | } else { |
| 1204 | // read sub tile size |
| 1205 | for (pugi::xml_node sub_tile : tile.child("sub_tiles").children("sub_tile")) { |
| 1206 | int32_t width = sub_tile.attribute("width").as_int(); |
| 1207 | int32_t height = sub_tile.attribute("height").as_int(); |
| 1208 | int32_t offset_x = sub_tile.attribute("offset_x").as_int(); |
| 1209 | int32_t offset_y = sub_tile.attribute("offset_y").as_int(); |
| 1210 | site_sizes[type].push_back({width, height, offset_x, offset_y}); |
| 1211 | openparfPrint(kInfo, "tile %s sub site size: %d %d offset: %d %d\n", type.c_str(), width, height, offset_x, |
| 1212 | offset_y); |
| 1213 | } |
| 1214 |
nothing calls this directly
no test coverage detected