19#ifndef BACKENDS_TOFINO_BF_P4C_MAU_ACTION_FORMAT_H_
20#define BACKENDS_TOFINO_BF_P4C_MAU_ACTION_FORMAT_H_
26#include "backends/tofino/bf-p4c/ir/bitrange.h"
27#include "backends/tofino/bf-p4c/mau/action_analysis.h"
28#include "backends/tofino/bf-p4c/mau/attached_info.h"
29#include "backends/tofino/bf-p4c/mau/ixbar_expr.h"
30#include "backends/tofino/bf-p4c/phv/phv.h"
32#include "lib/bitops.h"
33#include "lib/bitvec.h"
35#include "lib/ordered_set.h"
36#include "lib/safe_vector.h"
41using ::P4::operator<<;
45enum ModConditionally_t { NONE, VALUE, };
95 virtual int size()
const = 0;
96 virtual bool from_p4_program()
const = 0;
97 virtual cstring name()
const = 0;
98 virtual const Parameter *split(
int lo,
int hi)
const = 0;
99 virtual bool only_one_overlap_solution()
const = 0;
101 virtual bool is_next_bit_of_param(
const Parameter *,
bool same_alias)
const = 0;
102 virtual const Parameter *get_extended_param(uint32_t extension,
const Parameter *)
const = 0;
105 virtual void dbprint(std::ostream &out)
const = 0;
107 virtual bool equiv_value(
const Parameter *,
bool check_cond =
true)
const = 0;
108 virtual bool can_merge(
const Parameter *param)
const {
return equiv_value(param); }
109 virtual bool is_subset_of(
const Parameter *param)
const {
return equiv_value(param); }
110 virtual const Parameter *merge(
const Parameter *param)
const {
111 if (param !=
nullptr) BUG_CHECK(can_merge(param),
"Merging parameters that cannot merge");
115 template <
typename T>
116 const T *to()
const {
117 return dynamic_cast<const T *
>(
this);
119 template <
typename T>
121 return to<T>() !=
nullptr;
124 bool is_cond_type(ModConditionally_t type)
const {
return type ==
_cond_type; }
125 cstring cond_name()
const {
return _cond_name; }
127 void set_cond(ModConditionally_t ct,
cstring n) {
132 void set_cond(
const Parameter *p) {
134 _cond_name = p->_cond_name;
137 bool equiv_cond(
const Parameter *p)
const {
138 return _cond_type == p->_cond_type && _cond_name == p->_cond_name;
165 cstring name()
const override {
return _name.name; }
166 cstring originalName()
const {
return _name.originalName; }
167 le_bitrange param_field()
const {
return _param_field; }
172 bool from_p4_program()
const override {
return true; }
173 const Parameter *split(
int lo,
int hi)
const override {
174 le_bitrange split_range = {_param_field.
lo + lo, _param_field.
lo + hi};
175 BUG_CHECK(_param_field.
contains(split_range),
176 "Illegally splitting a parameter, as the "
177 "split contains bits outside of the range");
178 auto *rv =
new Argument(_name, split_range);
183 bool only_one_overlap_solution()
const override {
return true; }
185 bool is_next_bit_of_param(
const Parameter *ad,
bool)
const override;
187 const Parameter *get_extended_param(uint32_t extension,
const Parameter *)
const override {
189 rv->_param_field.hi += extension;
195 bool equiv_value(
const Parameter *ad,
bool check_cond =
true)
const override {
197 if (arg ==
nullptr)
return false;
198 if (check_cond && !equiv_cond(ad))
return false;
199 return _name == arg->_name && _param_field == arg->_param_field;
201 int size()
const override {
return _param_field.
size(); }
202 void dbprint(std::ostream &out)
const override {
203 out <<
"Arg:" << _name <<
" " << _param_field;
220 le_bitrange range()
const {
return {0,
static_cast<int>(_size) - 1}; }
223 Constant(
int v,
size_t sz) : _value(v), _size(sz) {}
226 const Parameter *split(
int lo,
int hi)
const override;
227 bool only_one_overlap_solution()
const override {
return false; }
228 bool from_p4_program()
const override {
return !_alias.isNull(); }
233 bool equiv_value(
const Parameter *ad,
bool check_cond =
true)
const override;
234 bitvec value()
const {
return _value; }
235 int size()
const override {
return _size; }
236 cstring name()
const override {
237 if (_alias)
return _alias;
238 return "$constant"_cs;
240 cstring alias()
const {
return _alias; }
241 void set_alias(
cstring a) { _alias = a; }
242 void dbprint(std::ostream &out)
const override {
243 out <<
"Const: 0x" << _value <<
" : " << _size <<
" bits";
253 int size()
const override {
return _func.size(); }
254 cstring name()
const override {
return _func.name(); }
255 const Parameter *split(
int lo,
int hi)
const override;
256 bool only_one_overlap_solution()
const override {
return false; }
257 bool from_p4_program()
const override {
return true; }
258 bool is_next_bit_of_param(
const Parameter *ad,
bool same_alias)
const override;
259 const Parameter *get_extended_param(uint32_t extension,
const Parameter *ad)
const override;
262 bool equiv_value(
const Parameter *ad,
bool check_cond =
true)
const override;
263 void dbprint(std::ostream &out)
const override { out <<
"Hash: " << _func; }
281 bool operator<(
const UniqueAlloc &ua)
const {
282 if (_random != ua._random)
return _random < ua._random;
283 return _action < ua._action;
286 bool operator==(
const UniqueAlloc &ua)
const {
287 return _random == ua._random && _action == ua._action;
290 bool operator!=(
const UniqueAlloc &ua)
const {
return !(*
this == ua); }
292 cstring random()
const {
return _random; }
293 cstring action()
const {
return _action; }
294 UniqueAlloc(
cstring rand,
cstring act) : _random(rand), _action(act) {}
297 std::map<UniqueAlloc, le_bitrange> _rand_nums;
298 std::string rand_num_names()
const {
299 std::stringstream str;
301 std::string sep =
"";
302 for (
auto ua : _rand_nums) {
303 str << sep << ua.first.random() <<
"$" << ua.first.action() << ua.second;
312 UniqueAlloc ua(rand, act);
313 _rand_nums.emplace(ua, range);
317 int size()
const override;
318 cstring name()
const override {
return "random"_cs; }
319 const Parameter *split(
int lo,
int hi)
const override;
320 bool from_p4_program()
const override {
return true; }
321 bool only_one_overlap_solution()
const override {
return false; }
322 bool is_next_bit_of_param(
const Parameter *ad,
bool same_alias)
const override;
323 const Parameter *get_extended_param(uint32_t extension,
const Parameter *ad)
const override;
326 bool equiv_value(
const Parameter *ad,
bool check_cond =
true)
const override;
329 bool is_subset_of(
const Parameter *ad)
const override;
330 bool can_merge(
const Parameter *ad)
const override;
332 void dbprint(std::ostream &out)
const override { out <<
"Random: " << rand_num_names(); }
335 UniqueAlloc ua(rand, act);
336 _rand_nums.emplace(ua, range);
344 int size()
const override {
return _size; }
345 cstring name()
const override {
return "rand_padding"_cs; }
346 const Parameter *split(
int lo,
int hi)
const override;
347 bool from_p4_program()
const override {
return false; }
348 bool only_one_overlap_solution()
const override {
return false; }
349 bool is_next_bit_of_param(
const Parameter *ad,
bool same_alias)
const override;
350 const Parameter *get_extended_param(uint32_t extensions,
const Parameter *ad)
const override;
353 bool equiv_value(
const Parameter *ad,
bool check_cond =
true)
const override;
354 bool is_subset_of(
const Parameter *ad)
const override;
355 bool can_merge(
const Parameter *ad)
const override;
357 void dbprint(std::ostream &out)
const override {
358 out <<
"RndPad: " << name() <<
" : " << size();
378 int size()
const override {
return _range.
size(); }
379 bool from_p4_program()
const override {
return true; }
380 cstring name()
const override {
return _meter_name; }
381 const Parameter *split(
int lo,
int hi)
const override;
382 bool only_one_overlap_solution()
const override {
return true; }
383 bool is_next_bit_of_param(
const Parameter *,
bool same_alias)
const override;
384 const Parameter *get_extended_param(uint32_t extension,
const Parameter *)
const override;
387 void dbprint(std::ostream &out)
const override {
388 out <<
"MeterColor: " << _meter_name << _range;
390 bool equiv_value(
const Parameter *,
bool check_cond =
true)
const override;
391 bool is_padding()
const {
return _meter_name ==
"$padding"; }
393 bool is_subset_of(
const Parameter *ad)
const override;
394 bool can_merge(
const Parameter *ad)
const override;
416 int size()
const override {
return _range.
size(); }
417 bool from_p4_program()
const override {
return true; }
418 cstring name()
const override {
return _alu_user; }
419 bool only_one_overlap_solution()
const override {
return true; }
420 const Parameter *split(
int lo,
int hi)
const override;
421 bool is_next_bit_of_param(
const Parameter *,
bool)
const override;
422 const Parameter *get_extended_param(uint32_t extension,
const Parameter *)
const override;
425 void dbprint(std::ostream &out)
const override { out <<
"MeterALU: " << _alu_user << _range; }
426 bool equiv_value(
const Parameter *,
bool check_cond =
true)
const override;
445 friend std::ostream &operator<<(std::ostream &out,
const ALUParameter &p) {
446 return out <<
"ALU Param { " << p.param <<
", phv bits : 0x" << p.phv_bits
447 <<
", rotate_right_shift : " << p.right_shift <<
" } ";
451enum ALUOPConstraint_t { ISOLATED, BITMASKED_SET, DEPOSIT_FIELD, BYTE_ROTATE_MERGE };
452std::ostream &operator<<(std::ostream &out, ALUOPConstraint_t c);
464 : action_name(an), param(p), container(cont), phv_bits(pb) {}
469using ParameterPositions = std::map<int, const Parameter *>;
496 bool _right_shift_set =
false;
500 ALUOPConstraint_t _constraint;
513 _params.push_back(ap);
514 _phv_bits.setrange(ap.phv_bits.
lo, ap.phv_bits.
size());
518 _mask_params.push_back(ap);
519 _mask_bits.setrange(ap.phv_bits.
lo, ap.phv_bits.
size());
522 bool contains_only_one_overlap_solution()
const {
523 for (
auto param : _params) {
524 if (param.param->only_one_overlap_solution())
return true;
529 bitvec phv_bits()
const {
return _phv_bits; }
531 bitvec mask_bits()
const {
return _mask_bits; }
532 bitvec slot_bits()
const {
533 BUG_CHECK(_right_shift_set,
"Unsafe call of slot bits in action format");
535 return _phv_bits.rotate_right_copy(0, _right_shift, _container.size());
537 return _phv_bits >> _right_shift;
540 bool valid()
const {
return static_cast<bool>(_container); }
541 size_t size()
const {
542 return valid() ? _container.size() :
static_cast<size_t>(PHV::Size::b32);
544 bool is_constrained(ALUOPConstraint_t cons)
const {
return _constraint == cons; }
545 size_t index()
const {
546 BUG_CHECK(valid(),
"Cannot call index on an invalid ALU operation");
547 return ceil_log2(size()) - 3;
549 ALUOPConstraint_t constraint()
const {
return _constraint; }
552 : _right_shift(0), _container(cont), _constraint(cons) {}
556 cstring alias()
const {
return _alias; }
557 cstring mask_alias()
const {
return _mask_alias; }
558 cstring action_name()
const {
return _action_name; }
559 void set_alias(
cstring a) { _alias = a; }
560 void set_mask_alias(
cstring ma) { _mask_alias = ma; }
561 void set_action_name(
cstring an) { _action_name = an; }
564 ParameterPositions parameter_positions()
const;
565 std::string parameter_positions_to_string()
const;
566 cstring wrapped_constant()
const;
571 template <
typename T>
573 for (
auto param : _params) {
574 if (param.param->is<T>())
return true;
578 int hw_right_shift()
const;
582 bool right_shift_set()
const {
return _right_shift_set; }
584 friend std::ostream &operator<<(std::ostream &out,
const ALUOperation &op) {
585 Log::TempIndent indent;
586 out <<
"ALU Operation { " << indent << Log::endl;
587 out <<
"params:" << indent;
588 for (
auto &p : op._params) out << Log::endl << p;
589 out << indent.pop_back() << Log::endl;
590 out <<
"phv bits: " << op._phv_bits <<
", right_shift : " << op._right_shift
591 <<
", right_shift_set: " << op._right_shift_set <<
", container: " << op._container
592 <<
", op constraint: " << op._constraint << Log::endl;
593 if (op._alias) out <<
"alias: " << op._alias << Log::endl;
594 if (op._mask_alias) out <<
"mask alias: " << op._mask_alias << Log::endl;
595 if (op._mask_params.size() > 0) {
596 out <<
"mask params: " << Log::indent;
597 for (
auto &p : op._mask_params) out << Log::endl << p;
598 out << Log::unindent << Log::endl;
600 out <<
"mask bits: " << op._mask_bits <<
", action name: " << op._action_name;
604 friend std::ostream &operator<<(std::ostream &out,
const ALUOperation *op) {
608 void dbprint_multiline()
const {}
617 friend std::ostream &operator<<(std::ostream &out,
const SharedParameter &op) {
618 out <<
"Param: " << *op.param <<
"A :" << op.a_start_bit <<
" B:" << op.b_start_bit;
632 bits_iter_t bits_begin;
633 bits_iter_t bits_end;
638 : bits_begin(bb), bits_end(be) {}
640 int size()
const {
return bits_end - bits_begin; }
641 void rotate(
int bit_rotation);
656 LocalPacking split(
int first_bit,
int sz)
const;
669 int rotational_granularity = -1;
676 int right_shift)
const;
678 int right_shift)
const;
682 bool is_rotational()
const {
return rotational_granularity > 0; }
683 bool can_rotate(
int bit_width,
int init_bit,
int final_bit)
const;
686 int get_granularity()
const {
return rotational_granularity; }
689 return recursive_constraints;
697 : rotational_granularity(rg), recursive_constraints(pc) {}
698 friend std::ostream &operator<<(std::ostream &out,
const PackingConstraint &pc) {
699 out <<
"Packing Constraint {" <<
" Rotational Granularity: " << pc.rotational_granularity
700 <<
" Recursive Constraint (size): " << pc.recursive_constraints.size() <<
" } ";
705enum SlotType_t { BYTE, HALF, FULL, SLOT_TYPES, DOUBLE_FULL = SLOT_TYPES, SECT_TYPES = 4 };
706std::ostream &operator<<(std::ostream &, SlotType_t);
707size_t slot_type_to_bits(SlotType_t type);
708SlotType_t bits_to_slot_type(
size_t bits);
710using BusInputs = std::array<bitvec, SLOT_TYPES>;
763 bool is_better_merge_than(
const RamSection *comp)
const;
770 bitvec bits_in_use()
const;
773 const RamSection *can_rotate(
int init_bit,
int final_bit)
const;
780 bool only_one_overlap_solution)
const;
784 bool contains(
const RamSection *ad_small,
int init_bit_pos,
int *final_bit_pos)
const;
786 int *final_bit_pos)
const;
789 size_t size()
const {
return action_data_bits.size(); }
790 size_t index()
const {
return ceil_log2(size()) - 3; }
791 size_t byte_sz()
const {
return size() / 8; }
793 std::string parameter_positions_to_string(
bool from_p4_program)
const;
794 explicit RamSection(
int s) : action_data_bits(s, nullptr) {}
795 RamSection(
int s, PackingConstraint &pc) : action_data_bits(s, nullptr), pack_info(pc) {}
796 void add_param(
int bit,
const Parameter *);
797 void add_alu_req(
const ALUOperation *rv) {
alu_requirements.push_back(rv); }
799 std::string get_action_data_bits_str()
const {
800 std::stringstream rv;
802 std::vector<std::pair<cstring, le_bitrange>> adb_params;
803 for (
auto *adb_param : action_data_bits) {
804 if (!adb_param)
continue;
805 if (
auto *arg_param = adb_param->to<Argument>()) {
806 if (adb_params.size() != 0) {
807 auto &last_param = adb_params.back();
808 if (last_param.first == adb_param->name()) {
809 last_param.second |= arg_param->param_field();
813 adb_params.push_back(std::make_pair(adb_param->name(), arg_param->param_field()));
816 rv <<
"Action Data : " << size() <<
"'b{";
817 for (
auto &a : adb_params) rv <<
" " << a.first <<
" : " << a.second;
822 friend std::ostream &operator<<(std::ostream &out,
const RamSection &rs) {
823 Log::TempIndent indent;
825 out <<
"Ram Section {" << indent << Log::endl;
826 out << rs.get_action_data_bits_str() << Log::endl;
827 out <<
"Pack Info: " << indent << rs.pack_info << indent.pop_back() << Log::endl;
828 out <<
"Alu Req: " << indent << rs.alu_requirements;
832 void dbprint_multiline()
const {}
839enum Location_t { ACTION_DATA_TABLE, IMMEDIATE, AD_LOCATIONS, METER_ALU = 2, ALL_LOCATIONS = 3 };
840std::ostream &operator<<(std::ostream &, Location_t);
848 int byte_offset = -1;
850 size_t total_slots_of_type(SlotType_t slot_type)
const;
853 out <<
"Ram Section Position { " << *rsp.section <<
", byte_offset: " << rsp.byte_offset
857 void dbprint_multiline()
const {}
872 : action_name(an), all_inputs(ai) {}
875 size_t bits_required()
const;
882 bool move_min_max_bit_req);
887 out <<
"Single Action Position { name: " << sap.action_name
888 <<
", all_inputs: " << Log::TempIndent() << sap.all_inputs <<
" } ";
918 : alu_op(ao), loc(l), start_byte(sb) {}
920 friend std::ostream &operator<<(std::ostream &out,
const ALUPosition &pos) {
921 out <<
"ALU Position" << Log::indent << Log::endl
922 <<
"op: " << *pos.alu_op << Log::endl
923 <<
"loc: " << pos.loc << Log::endl
924 <<
"start_byte: " << pos.start_byte << Log::unindent;
939 BusInputs *all_action_inputs;
944 void clear_inputs() {
946 alloc_inputs.clear();
948 void build_orig_inputs() {
950 orig_inputs.insert(orig_inputs.end(), positions->all_inputs.begin(),
951 positions->all_inputs.end());
954 void set_positions() {
955 BUG_CHECK(orig_inputs.empty() && alloc_inputs.size() == positions->all_inputs.size(),
956 "Cannot set the positions of the action as not all have been assigned positions");
957 positions->all_inputs.clear();
958 positions->all_inputs.insert(positions->all_inputs.end(), alloc_inputs.begin(),
961 cstring action_name()
const {
return positions->action_name; }
964 : positions(sap), all_action_inputs(aai) {
970using ModCondMap = std::map<cstring, safe_vector<bitvec>>;
974 static constexpr int IMMEDIATE_BITS = 32;
975 static constexpr int ACTION_RAM_BYTES = 16;
976 static constexpr int METER_COLOR_SIZE = 8;
977 static constexpr int METER_COLOR_START_BIT = IMMEDIATE_BITS - METER_COLOR_SIZE;
980 std::map<cstring, safe_vector<ALUPosition>> alu_positions;
985 std::array<int, AD_LOCATIONS> bytes_per_loc = {{0, 0}};
994 std::map<cstring, ModCondMap> mod_cond_values;
1001 int immediate_bits()
const {
return immediate_mask.max().index() + 1; }
1010 cstring get_format_name(SlotType_t slot_type, Location_t loc,
int byte_offset,
1015 alu_positions.clear();
1019 mod_cond_values.clear();
1020 locked_in_all_actions_alu_positions.clear();
1023 bool if_action_has_action_data(
cstring action_name)
const;
1024 bool if_action_has_action_data_table(
cstring action_name)
const;
1028 template <
typename T>
1029 bool is_byte_offset(
int byte_offset)
const {
1031 bool is_template =
false;
1032 for (
auto &alu_position : locked_in_all_actions_alu_positions) {
1033 if (alu_position.start_byte !=
static_cast<unsigned>(byte_offset))
continue;
1034 auto param_positions = alu_position.alu_op->parameter_positions();
1035 BUG_CHECK(!param_positions.empty(),
"An ALU operation somehow has no parameters");
1036 for (
auto ¶m_pos : param_positions) {
1037 bool template_param = param_pos.second->is<T>();
1040 is_template = template_param;
1042 BUG_CHECK(is_template == template_param,
1043 "A special parameter, i.e. "
1044 "HashDist, shares its packing with a different speciality");
1050 const RamSection *build_locked_in_sect()
const;
1054 for (
auto &act : alu_positions)
1055 for (
auto &pos : act.second) rv.push_back(&pos);
1058 friend std::ostream &operator<<(std::ostream &out,
const Use &use);
1063 const IR::MAU::Table *tbl;
1067 int calc_max_size = 0;
1068 std::map<cstring, RamSec_vec_t> init_ram_sections;
1070 std::array<int, AD_LOCATIONS> bytes_per_loc = {{0, 0}};
1075 RamSec_vec_t locked_in_all_actions_sects;
1076 BusInputs locked_in_all_actions_input_bitvecs;
1077 AllActionPositions locked_in_all_actions_inputs;
1080 le_bitrange container_bits,
const IR::MAU::ConditionalArg *ca);
1081 void create_constant(ALUOperation &alu,
const IR::Expression *read,
le_bitrange container_bits,
1082 int &constant_alias_index,
const IR::MAU::ConditionalArg *ca);
1089 void create_random_padding(ALUOperation &alu,
le_bitrange padding_bits);
1094 void create_mask_constant(ALUOperation &alu,
bitvec value,
le_bitrange container_bits,
1095 int &constant_alias_index);
1097 bool fix_bitwise_overwrite(ALUOperation &alu,
1099 const size_t container_size,
const bitvec &total_write_bits,
1100 int &constant_alias_index,
int &alias_required_reads);
1102 void create_alu_ops_for_action(ActionAnalysis::ContainerActionsMap &ca_map,
1104 bool analyze_actions(FormatType_t format_type);
1106 void initial_possible_condenses(PossibleCondenses &condenses,
const RamSec_vec_t &ram_sects);
1107 void incremental_possible_condenses(PossibleCondenses &condense,
const RamSec_vec_t &ram_sects);
1109 bitvec bytes_in_use(BusInputs &all_inputs)
const {
1110 return all_inputs[BYTE] | all_inputs[HALF] | all_inputs[FULL];
1112 bool is_better_condense(RamSec_vec_t &ram_sects,
const RamSection *best,
size_t best_skip1,
1113 size_t best_skip2,
const RamSection *comp,
size_t comp_skip1,
1115 void condense_action(
cstring action_name, RamSec_vec_t &ram_sects);
1116 void shrink_possible_condenses(PossibleCondenses &pc, RamSec_vec_t &ram_sects,
1117 const RamSection *ad,
size_t i_pos,
size_t j_pos);
1118 void set_ram_sect_byte(SingleActionAllocation &single_action_alloc,
1119 bitvec &allocated_slots_in_action, RamSectionPosition &ram_sect,
1121 bitvec adt_iteration(SlotType_t slot_type,
int &iteration);
1122 void alloc_adt_slots_of_size(SlotType_t slot_size, SingleActionAllocation &single_action_alloc,
1123 int max_bytes_required);
1124 void alloc_immed_slots_of_size(SlotType_t size, SingleActionAllocation &single_action_alloc,
1125 int max_bytes_required);
1126 void verify_placement(SingleActionAllocation &single_action_alloc);
1128 void determine_single_action_input(SingleActionAllocation &single_action_alloc,
1129 int max_bytes_required);
1130 bool determine_next_immediate_bytes(
bool immediate_forced);
1131 bool determine_bytes_per_loc(
bool &initialized, IR::MAU::Table::ImmediateControl_t imm_ctrl);
1133 void assign_action_data_table_bytes(AllActionPositions &all_bus_inputs,
1134 BusInputs &total_inputs);
1135 void assign_immediate_bytes(AllActionPositions &all_bus_inputs, BusInputs &total_inputs,
1136 int max_bytes_needed);
1137 void assign_RamSections_to_bytes();
1139 const ALUOperation *finalize_locked_shift_alu_operation(
const RamSection *ram_sect,
1140 const ALUOperation *init_ad_alu,
1142 const ALUOperation *finalize_alu_operation(
const RamSection *ram_sect,
1143 const ALUOperation *init_ad_alu,
int right_shift,
1144 int section_byte_offset,
int *rot_alias_idx);
1145 void build_single_ram_sect(RamSectionPosition &ram_sect, Location_t loc,
1147 int *rot_alias_idx);
1148 void build_locked_in_format(Use &use);
1149 void build_potential_format(
bool immediate_forced);
1153 void allocate_format(IR::MAU::Table::ImmediateControl_t imm_ctrl, FormatType_t format_type);
1155 : phv(p), tbl(t), red_info(ri), att_info(sai) {}
Definition action_format.h:485
bool has_param() const
Definition action_format.h:572
bitvec static_entry_of_constants() const
Definition action_format.cpp:1124
const RamSection * create_meter_alu_RamSection() const
Definition action_format.cpp:1229
bitvec static_entry_of_arg(const Argument *arg, bitvec value) const
Definition action_format.cpp:1091
const RamSection * create_RamSection(bool shift_to_lsb) const
Definition action_format.cpp:944
const RamSection * create_meter_color_RamSection() const
Definition action_format.cpp:1178
bitvec phv_bytes() const
Definition action_format.cpp:931
const ALUOperation * add_right_shift(int right_shift, int *rot_alias_idx) const
Definition action_format.cpp:1029
Definition action_format.h:160
const Parameter * overlap(const Parameter *ad, bool guaranteed_one_overlap, le_bitrange *my_overlap, le_bitrange *ad_overlap) const override
Definition action_format.cpp:77
Definition action_format.h:216
const Parameter * get_extended_param(uint32_t extension, const Parameter *ad) const override
Definition action_format.cpp:145
const Parameter * overlap(const Parameter *ad, bool only_one_overlap_solution, le_bitrange *my_overlap, le_bitrange *ad_overlap) const override
Definition action_format.cpp:173
bool is_next_bit_of_param(const Parameter *ad, bool same_alias) const override
Definition action_format.cpp:131
Definition action_format.h:247
const Parameter * overlap(const Parameter *ad, bool only_one_overlap_solution, le_bitrange *my_overlap, le_bitrange *ad_overlap) const override
Definition action_format.cpp:229
const Parameter * overlap(const Parameter *ad, bool only_one_overlap_solution, le_bitrange *my_overlap, le_bitrange *ad_overlap) const override
Definition action_format.cpp:585
Definition action_format.h:372
Definition action_format.h:666
bool can_rotate(int bit_width, int init_bit, int final_bit) const
Definition action_format.cpp:628
PackingConstraint merge(const PackingConstraint &pc, const LocalPacking &lp, const LocalPacking &pc_lp) const
Definition action_format.cpp:797
int bit_rotation_position(int bit_width, int init_bit, int final_bit, int init_bit_comp) const
Definition action_format.cpp:852
void rotate(RotationInfo &ri, int init_bit, int final_bit)
Definition action_format.cpp:755
bool can_rotate_in_range(LocalPacking &lp, le_bitrange open_range, int &final_bit) const
Definition action_format.cpp:716
Definition action_format.h:53
ModConditionally_t _cond_type
Definition action_format.h:88
Definition action_format.h:757
ParameterPositions parameter_positions(bool same_alias=false) const
Definition action_format.cpp:1294
void gather_shared_params(const RamSection *ad, safe_vector< SharedParameter > &shared_params, bool only_one_overlap_solution) const
Definition action_format.cpp:1345
safe_vector< le_bitrange > open_holes() const
Definition action_format.cpp:1375
safe_vector< const ALUOperation * > alu_requirements
Definition action_format.h:768
bool is_data_subset_of(const RamSection *ad) const
Definition action_format.cpp:1595
BusInputs bus_inputs() const
Definition action_format.cpp:1706
const RamSection * rotate_in_range(le_bitrange range) const
Definition action_format.cpp:1439
bool contains(const RamSection *ad_small, int init_bit_pos, int *final_bit_pos) const
Definition action_format.cpp:1610
const RamSection * condense(const RamSection *) const
Definition action_format.cpp:1514
bool contains_any_rotation_from_0(const RamSection *ad_small, int init_bit_pos, int *final_bit_pos) const
Definition action_format.cpp:1639
const RamSection * no_overlap_merge(const RamSection *ad) const
Definition action_format.cpp:1454
const RamSection * expand_to_size(size_t expand_size) const
Definition action_format.cpp:1263
Definition action_format.h:275
bool rand_nums_overlap_into(const RandomNumber *rn) const
Definition action_format.cpp:368
const Parameter * overlap(const Parameter *ad, bool only_one_overlap_solution, le_bitrange *my_overlap, le_bitrange *ad_overlap) const override
Definition action_format.cpp:335
Definition action_format.h:340
Definition stringify.h:33
Definition safe_vector.h:27
Definition phv_fields.h:1095
Definition attached_info.h:235
Definition action_format.cpp:30
Definition attached_output.cpp:24
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
Definition action_analysis.h:65
Definition action_analysis.h:346
Definition action_format.h:430
safe_vector< le_bitrange > slot_bits_brs(PHV::Container cont) const
Definition action_format.cpp:906
Definition action_format.h:908
Definition action_format.h:645
bitvec bits_in_use
Definition action_format.h:649
int bit_width
Definition action_format.h:647
Definition action_format.h:846
Definition action_format.h:630
Definition action_format.h:611
Definition action_format.h:937
Definition action_format.h:867
std::array< bool, SECT_TYPES > can_be_immed_msb(int bits_to_move) const
Definition action_format.cpp:1863
safe_vector< RamSectionPosition > best_inputs_to_move(int bits_to_move)
Definition action_format.cpp:1953
std::array< int, SECT_TYPES > sections_of_size() const
Definition action_format.cpp:1794
size_t total_slots_of_type(SlotType_t slot_type) const
Definition action_format.cpp:1761
void move_other_sections_to_immed(int bits_to_move, SlotType_t minmax_sz, safe_vector< RamSectionPosition > &immed_vec)
Definition action_format.cpp:1897
size_t adt_bits_required() const
Definition action_format.cpp:1781
std::array< int, SECT_TYPES > minmax_bit_req() const
Definition action_format.cpp:1810
std::array< int, SECT_TYPES > min_bit_of_contiguous_sect() const
Definition action_format.cpp:1823
Definition action_format.h:454
int lo
Definition lib/bitrange.h:694
ssize_t size() const
Definition lib/bitrange.h:539
bool contains(int index) const
Definition lib/bitrange.h:594
Definition ixbar_expr.h:209
Definition reduction_or.h:47