66 static constexpr int OUTPUTS = 32;
67 static constexpr int ADB_BYTES = 128;
68 static constexpr int PAIRED_OFFSET = 16;
69 static constexpr int BYTES_PER_RAM = 16;
70 static constexpr int ADB_STARTS[ActionData::SLOT_TYPES] = {0, 32, 96};
71 static constexpr int IMMED_DIVIDES[ActionData::SLOT_TYPES] = {16, 64, 128};
72 static constexpr int IMMED_SECT = 4;
73 static constexpr int CSR_RANGE = 16;
74 static constexpr int CSR_SECTION[ActionData::SLOT_TYPES] = {4, 3, 2};
75 static constexpr int RANDOM_NUMBER_GENERATORS = 2;
82 bitvec cont_in_use[ActionData::SLOT_TYPES];
84 bitvec rng_in_use[RANDOM_NUMBER_GENERATORS];
87 std::set<cstring> atcam_updates;
89 bool reserved_immed[3] = {
false,
false,
false};
93 ActionData::SlotType_t type;
95 explicit ADB_CSR(ActionData::SlotType_t t) : type(t) {
96 reserved.resize(ActionDataBus::CSR_SECTION[type],
false);
99 bool operator==(
const ADB_CSR &adb_csr)
const {
100 if (reserved != adb_csr.reserved)
return false;
101 if (type != adb_csr.type)
return false;
111 void clear()
override {
112 ::ActionDataBus::Use::clear();
115 Use *clone()
const override {
return new Use(*
this); }
116 bool emit_adb_asm(std::ostream &,
const IR::MAU::Table *,
bitvec source)
const override;
117 bool empty()
const override { return ::ActionDataBus::Use::empty() && rng_locs.empty(); }
118 int rng_unit()
const override;
127 if (unit != rng.unit)
return false;
128 if (bytes != rng.bytes)
return false;
134 bool operator==(
const Use &use)
const {
135 if (rng_locs != use.rng_locs)
return false;
140 void clear()
override;
143 bool operator!=(
ActionDataBus &adb) {
return !(*
this == adb); }
147 int byte_to_output(
int byte, ActionData::SlotType_t type);
148 int output_to_byte(
int output, ActionData::SlotType_t type);
149 int find_byte_sz(ActionData::SlotType_t type);
150 int csr_index(
int start_byte, ActionData::SlotType_t type);
151 bool is_csr_reserved(
int start_byte,
bitvec adjacent,
int byte_offset,
152 ActionData::Location_t source);
153 bool is_adf_csr_reserved(
int start_byte,
bitvec adjacent,
int byte_offset);
154 bool is_immed_csr_reserved(
int start_byte);
156 void reserve_csr(
int start_byte,
bitvec adjacent,
int byte_offset,
157 ActionData::Location_t source);
158 void reserve_adf_csr(
int start_byte,
bitvec adjacent,
int byte_offset);
159 void reserve_immed_csr(
int start_byte);
160 bitvec combined(
const ActionData::BusInputs bv)
const;
162 void initialize_action_ixbar();
164 bool find_location(
bitvec combined_adjacent,
int diff, ActionData::SlotType_t init_type,
165 loc_alg_t loc_alg, ActionData::Location_t source,
int byte_offset,
167 bool find_location(
bitvec combined_adjacent,
int diff,
int initial_adb_byte,
int final_adb_byte,
168 bool reset, ActionData::SlotType_t type, ActionData::Location_t source,
169 int byte_offset,
int &start_byte);
171 void analyze_full_share(Use &use, ActionData::BusInputs layouts, FullShare &full_share,
172 int init_byte_offset,
int add_byte_offset,
173 ActionData::Location_t source);
174 void analyze_full_shares(Use &use, ActionData::BusInputs layouts,
bitvec full_bitmasked,
175 FullShare full_shares[4],
int init_byte_offset,
176 ActionData::Location_t source);
177 void reserve_space(Use &use, ActionData::SlotType_t type,
bitvec adjacent,
178 bitvec combined_adjacent,
int start_byte,
int byte_offset,
179 ActionData::Location_t source,
cstring name);
180 bool fit_adf_section(Use &use,
bitvec adjacent,
bitvec combined_adjacent,
181 ActionData::SlotType_t type,
loc_alg_t loc_alg,
int init_byte_offset,
182 int sec_begin,
int size,
cstring name, ActionData::Location_t source);
183 bool alloc_bytes(Use &use,
bitvec layout,
bitvec combined_layout,
int init_byte_offset,
184 cstring name, ActionData::Location_t source);
185 bool alloc_halves(Use &use,
bitvec layout,
bitvec combined_layout,
int init_byte_offset,
186 cstring name, ActionData::Location_t source);
187 bool alloc_fulls(Use &use, ActionData::BusInputs layouts,
bitvec full_bitmasked,
188 int init_byte_offset,
cstring name, ActionData::Location_t source);
189 bool alloc_full_sect(Use &use, FullShare full_shares[4],
bitvec combined_layout,
int begin,
191 ActionData::Location_t source);
192 bool alloc_ad_table(
const ActionData::BusInputs total_layouts,
194 bool alloc_meter_output(ActionData::BusInputs total_layouts, Use &use,
cstring name);
196 bitvec paired_immediate(
bitvec layout, ActionData::SlotType_t type);
197 bool fit_immed_sect(Use &use,
bitvec layout,
bitvec combined_layout,
199 bool alloc_unshared_immed(Use &use, ActionData::SlotType_t,
bitvec layout,
201 bool alloc_shared_immed(Use &use, ActionData::BusInputs layouts,
cstring name);
202 bool alloc_immediate(
const ActionData::BusInputs total_layouts, Use &use,
cstring name);
210 void update(
cstring name, const ::ActionDataBus::Use &alloc)
override;
211 void update(
cstring name,
const Use::ReservedSpace &rs)
override;
212 void update(
cstring name,
const Use::RandomNumberGenerator &rng);
213 void update(
const IR::MAU::Table *tbl)
override;