36 IR::MAU::Table::Layout layout;
37 IR::MAU::Table::Way way;
42 int srams = 0, maprams = 0, tcams = 0;
45 int select_bus_split = -1;
46 int action_format_index = -1;
47 bool previously_widened =
false;
48 bool identity =
false;
50 explicit LayoutOption(
const IR::MAU::Table::Layout l,
int i)
51 : layout(l), action_format_index(i) {}
52 LayoutOption(
const IR::MAU::Table::Layout l,
const IR::MAU::Table::Way w,
int i)
53 : layout(l), way(w), action_format_index(i) {}
62 select_bus_split = -1;
64 partition_sizes.clear();
65 dleft_hash_sizes.clear();
68 int logical_tables()
const {
69 if (partition_sizes.size() > 0)
70 return static_cast<int>(partition_sizes.size());
71 else if (dleft_hash_sizes.size() > 0)
72 return static_cast<int>(dleft_hash_sizes.size());
75 friend std::ostream &operator<<(std::ostream &,
const LayoutOption &);
76 void dbprint_multiline()
const {}
92 virtual void setup_exact_match(
const IR::MAU::Table *tbl,
93 const IR::MAU::Table::Layout &layout_proto,
95 int action_data_bytes_in_table,
int immediate_bits,
int index);
96 virtual void setup_layout_option_no_match(
const IR::MAU::Table *tbl,
97 const IR::MAU::Table::Layout &layout,
99 virtual void setup_ternary_layout(
const IR::MAU::Table *tbl,
100 const IR::MAU::Table::Layout &layout_proto,
102 int action_data_bytes_in_table,
int immediate_bits,
107 void add_hash_action_option(
const IR::MAU::Table *tbl,
const IR::MAU::Table::Layout &layout,
109 static void setup_indirect_ptrs(IR::MAU::Table::Layout &layout,
const IR::MAU::Table *tbl,
111 void setup_layout_options(
const IR::MAU::Table *tbl,
const IR::MAU::Table::Layout &layout_proto,
113 void setup_ternary_layout_options(
const IR::MAU::Table *tbl,
114 const IR::MAU::Table::Layout &layout_proto,
119 using key_t = std::pair<cstring, ActionData::FormatType_t>;
121 using cache_t = std::map<key_t, safe_vector<T>>;
122 cache_t<LayoutOption> cache_layout_options;
123 cache_t<ActionData::Format::Use> cache_action_formats;
124 int get_pack_pragma_val(
const IR::MAU::Table *tbl,
const IR::MAU::Table::Layout &layout_proto);
129 BUG_CHECK(t,
"null table pointer");
130 auto key = std::make_pair(t->name, type);
131 if (!cache_layout_options.count(key)) compute_layout_options(t, type);
132 return cache_layout_options.at(key);
135 return get_layout_options(t, ActionData::FormatType_t::default_for_table(t));
140 BUG_CHECK(t,
"null table pointer");
141 auto key = std::make_pair(t->name, type);
142 if (!cache_action_formats.count(key)) compute_action_formats(t, type);
143 return cache_action_formats.at(key);
146 return get_action_formats(t, ActionData::FormatType_t::default_for_table(t));
154 if (!t || !total_meter_output_format.count(t->name) || !need_meter(t, format_type))
156 return total_meter_output_format.at(t->name);
160 cache_layout_options.clear();
161 cache_action_formats.clear();
162 total_meter_output_format.clear();
168 : phv(p), att_info(a), red_info(ri), fpc(phv) {}
169 void add_payload_gw_layout(
const IR::MAU::Table *tbl,
const LayoutOption &base_option);
static void check_for_atcam(IR::MAU::Table::Layout &layout, const IR::MAU::Table *tbl, cstring &partition_index, const PhvInfo &phv)
Definition table_layout.cpp:175
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24