|
49 | 49 | #include "pugixml.hpp"
|
50 | 50 | #include "pugixml_util.hpp"
|
51 | 51 |
|
| 52 | +#include "read_xml_arch_file_interposer.h" |
52 | 53 | #include "read_xml_arch_file_vib.h"
|
53 | 54 | #include "vtr_assert.h"
|
54 | 55 | #include "vtr_log.h"
|
@@ -2620,7 +2621,7 @@ static t_grid_def process_grid_layout(vtr::string_internment& strings,
|
2620 | 2621 | if (has_layer) {
|
2621 | 2622 | // TODO ASSERT INTERPOSER
|
2622 | 2623 | std::unordered_set<int> seen_die_numbers; //Check that die numbers in the specific layout tag are unique
|
2623 |
| - for (auto layer_child : layout_type_tag.children("layer")) { |
| 2624 | + for (pugi::xml_node layer_child : layout_type_tag.children("layer")) { |
2624 | 2625 |
|
2625 | 2626 | // More than one layer tag is specified, meaning that multi-die FPGA is specified in the arch file
|
2626 | 2627 | // Need to process each <layer> tag children to get block types locations for each grid
|
@@ -2651,6 +2652,26 @@ static void process_block_type_locs(t_grid_def& grid_def,
|
2651 | 2652 | //Process all the block location specifications
|
2652 | 2653 | for (pugi::xml_node loc_spec_tag : layout_block_type_tag.children()) {
|
2653 | 2654 | const char* loc_type = loc_spec_tag.name();
|
| 2655 | + |
| 2656 | + // There are multiple attributes that are shared by every other tag that interposer |
| 2657 | + // tags do not have. For this reason we check if loc_spec_tag is an interposer tag |
| 2658 | + // and switch code paths if it is. |
| 2659 | + if (loc_type == std::string("interposer_cut")) { |
| 2660 | + if (grid_def.grid_type == GridDefType::AUTO) { |
| 2661 | + archfpga_throw(loc_data.filename_c_str(), loc_data.line(loc_spec_tag), "Interposers are not currently supported for auto sized devices."); |
| 2662 | + } |
| 2663 | + |
| 2664 | + t_interposer_cut_inf interposer_cut = parse_interposer_cut_tag(loc_spec_tag, loc_data); |
| 2665 | + |
| 2666 | + if ((interposer_cut.dim == e_interposer_cut_dim::X && interposer_cut.loc >= grid_def.height) || (interposer_cut.dim == e_interposer_cut_dim::Y && interposer_cut.loc >= grid_def.width)) { |
| 2667 | + archfpga_throw(loc_data.filename_c_str(), loc_data.line(loc_spec_tag), "Interposer cut dimensions are outside of device bounds"); |
| 2668 | + } |
| 2669 | + |
| 2670 | + grid_def.layers.at(die_number).interposer_cuts.push_back(interposer_cut); |
| 2671 | + continue; |
| 2672 | + } |
| 2673 | + |
| 2674 | + // Continue parsing for non-interposer tags |
2654 | 2675 | const char* type_name = get_attribute(loc_spec_tag, "type", loc_data).value();
|
2655 | 2676 | int priority = get_attribute(loc_spec_tag, "priority", loc_data).as_int();
|
2656 | 2677 | t_metadata_dict meta = process_meta_data(strings, loc_spec_tag, loc_data);
|
@@ -2872,42 +2893,6 @@ static void process_block_type_locs(t_grid_def& grid_def,
|
2872 | 2893 | region.meta = region.owned_meta.get();
|
2873 | 2894 |
|
2874 | 2895 | grid_def.layers.at(die_number).loc_defs.emplace_back(std::move(region));
|
2875 |
| - } else if (loc_type == std::string("interposer_cut")) { |
2876 |
| - t_interposer_cut_inf interposer; |
2877 |
| - pugiutil::expect_only_attributes(loc_spec_tag, {"dim", "loc"}, loc_data); |
2878 |
| - |
2879 |
| - std::string interposer_dim = pugiutil::get_attribute(loc_spec_tag, "dim", loc_data).as_string(); |
2880 |
| - if (interposer_dim.size() != 1 || !CHAR_INTERPOSER_DIM_MAP.contains(interposer_dim[0])) { |
2881 |
| - archfpga_throw(loc_data.filename_c_str(), loc_data.line(loc_spec_tag), "Interposer tag dimension must be a single character of either X, x, Y or y."); |
2882 |
| - } |
2883 |
| - |
2884 |
| - interposer.dim = CHAR_INTERPOSER_DIM_MAP.at(interposer_dim[0]); |
2885 |
| - |
2886 |
| - interposer.loc = pugiutil::get_attribute(loc_spec_tag, "loc", loc_data).as_int(); |
2887 |
| - if (interposer.loc < 0) { |
2888 |
| - // TODO: should also check if it's inside device bounds |
2889 |
| - archfpga_throw(loc_data.filename_c_str(), loc_data.line(loc_spec_tag), "Interposer location must be positive."); |
2890 |
| - } |
2891 |
| - |
2892 |
| - pugiutil::expect_only_children(loc_spec_tag, {"interdie_wire"}, loc_data); |
2893 |
| - |
2894 |
| - for (pugi::xml_node interdie_wire_tag : loc_spec_tag.children()) { |
2895 |
| - pugiutil::expect_only_attributes(interdie_wire_tag, {"sg", "sg_offset"}, loc_data); |
2896 |
| - |
2897 |
| - t_interdie_wire_inf interdie_wire; |
2898 |
| - |
2899 |
| - interdie_wire.sg_name = pugiutil::get_attribute(interdie_wire_tag, "sg_name", loc_data).as_string(); |
2900 |
| - interdie_wire.sg_offset = pugiutil::get_attribute(interdie_wire_tag, "sg_offset", loc_data).as_string(); |
2901 |
| - interdie_wire.offset_start = pugiutil::get_attribute(interdie_wire_tag, "offset_start", loc_data).as_int(); |
2902 |
| - interdie_wire.offset_end = pugiutil::get_attribute(interdie_wire_tag, "offset_end", loc_data).as_int(); |
2903 |
| - interdie_wire.offset_incr = pugiutil::get_attribute(interdie_wire_tag, "offset_incr", loc_data).as_int(); |
2904 |
| - interdie_wire.offset_num = pugiutil::get_attribute(interdie_wire_tag, "offset_num", loc_data).as_int(); |
2905 |
| - |
2906 |
| - interposer.interdie_wires.push_back(interdie_wire); |
2907 |
| - } |
2908 |
| - |
2909 |
| - //TODO: save interposer somewhere (need to add *arch to this function's args) |
2910 |
| - |
2911 | 2896 | } else {
|
2912 | 2897 | archfpga_throw(loc_data.filename_c_str(), loc_data.line(loc_spec_tag),
|
2913 | 2898 | vtr::string_fmt("Unrecognized grid location specification type '%s'\n", loc_type).c_str());
|
|
0 commit comments