82struct InstructionMemory {
83 static constexpr int NOOP_ROW = 0;
84 static constexpr int NOOP_COLOR = 0;
88 explicit InstructionMemory(
const IMemSpec &s) : spec(s) {}
90 InstructionMemory(
const InstructionMemory &) =
delete;
91 InstructionMemory &operator=(
const InstructionMemory &) =
delete;
94 virtual ~InstructionMemory() =
default;
96 std::set<cstring> atcam_updates;
112 struct VLIW_Instruction {
113 bitvec non_noop_instructions;
119 unsigned gen_addr()
const {
120 return color | row << Device::imemSpec().color_bits();
122 VLIW_Instruction(
bitvec nni,
int r,
int c)
123 : non_noop_instructions(nni), row(r), color(c) {}
125 bool operator==(
const VLIW_Instruction &v)
const {
126 return (non_noop_instructions == v.non_noop_instructions) && \
128 (color == v.color) && \
129 (mem_code == v.mem_code);
132 friend std::ostream & operator<<(std::ostream &out,
const VLIW_Instruction &i);
134 std::map<cstring, VLIW_Instruction> all_instrs;
139 void merge(
const Use &alloc);
141 bool operator==(
const Use &u)
const {
142 return all_instrs == u.all_instrs;
145 bool operator!=(
const Use &u)
const {
146 return all_instrs != u.all_instrs;
149 friend std::ostream & operator<<(std::ostream &out,
const Use &u);
152 std::map<const IR::MAU::ActionData *, const Use *> shared_action_profiles;
155 virtual BFN::Alloc2Dbase<cstring> &imem_use(gress_t gress) = 0;
156 const BFN::Alloc2Dbase<cstring> &imem_use(gress_t gress)
const {
157 return const_cast<InstructionMemory *
>(
this)->imem_use(gress); }
158 virtual BFN::Alloc2Dbase<bitvec> &imem_slot_inuse(gress_t gress) = 0;
159 const BFN::Alloc2Dbase<bitvec> &imem_slot_inuse(gress_t gress)
const {
160 return const_cast<InstructionMemory *
>(
this)->imem_slot_inuse(gress); }
162 bool is_noop_slot(
int row,
int color);
163 bool find_row_and_color(bitvec current_bv, gress_t gress,
int &row,
int &color,
164 bool &first_noop,
bool has_unalloc_temp =
false);
165 bool shared_instr(
const IR::MAU::Table *tbl,
Use &alloc,
bool gw_linked);
166 bool alloc_always_run_instr(
const IR::MAU::Table *tbl,
Use &alloc, bitvec current_bv);
169 bool allocate_imem(
const IR::MAU::Table *tbl,
Use &alloc, PhvInfo &phv,
bool gw_linked,
170 ActionData::FormatType_t format_type, SplitAttachedInfo &sai);
171 void update_always_run(
const Use &alloc, gress_t gress);
172 void update(cstring name,
const Use &alloc, gress_t gress);
173 void update(cstring name,
const TableResourceAlloc *alloc, gress_t gress);
174 void update(cstring name,
const TableResourceAlloc *alloc,
const IR::MAU::Table *tbl);
175 void update(
const IR::MAU::Table *tbl);
177 static InstructionMemory *create();
GenerateVLIWInstructions(PhvInfo &p, ActionData::FormatType_t ft, SplitAttachedInfo &sai, const IR::MAU::Table *tbl)
Definition instruction_memory.cpp:29
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24