P4C
The P4 Compiler
|
Public Member Functions | |
safe_vector< const ALUPosition * > | all_alu_positions () const |
const RamSection * | build_locked_in_sect () const |
void | clear () |
void | determine_immediate_mask () |
void | determine_mod_cond_maps () |
const ALUParameter * | find_locked_in_all_actions_param_alloc (UniqueLocationKey &loc, const ALUPosition **alu_pos_p) const |
const ALUParameter * | find_param_alloc (UniqueLocationKey &loc, const ALUPosition **alu_pos_p) const |
cstring | get_format_name (const ALUPosition &alu_pos, bool bitmasked_set=false, le_bitrange *slot_bits=nullptr, le_bitrange *postpone_range=nullptr) const |
cstring | get_format_name (SlotType_t slot_type, Location_t loc, int byte_offset, le_bitrange *slot_bits=nullptr, le_bitrange *postpone_range=nullptr) const |
bool | if_action_has_action_data (cstring action_name) const |
bool | if_action_has_action_data_table (cstring action_name) const |
int | immediate_bits () const |
template<typename T > | |
bool | is_byte_offset (int byte_offset) const |
Public Attributes | |
std::map< cstring, safe_vector< ALUPosition > > | alu_positions |
std::array< BusInputs, AD_LOCATIONS > | bus_inputs |
std::array< int, AD_LOCATIONS > | bytes_per_loc = {{0, 0}} |
bitvec | full_words_bitmasked |
bitvec | immediate_mask |
safe_vector< ALUPosition > | locked_in_all_actions_alu_positions |
BusInputs | locked_in_all_actions_bus_inputs = {{bitvec(), bitvec(), bitvec()}} |
std::map< cstring, ModCondMap > | mod_cond_values |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Use &use) |
void ActionData::Format::Use::determine_immediate_mask | ( | ) |
Calculate the mask of immediate bits which are to be packed on the table format. The immediate data is represented at bit-granularity.
void ActionData::Format::Use::determine_mod_cond_maps | ( | ) |
A map for coordinating conditional parameters to their associated position in the JSON The key is a the name of the condition, the value is two bitvecs, one in action_data_table, one in immediate, in which the bits are controlled by that condition
const ALUParameter * ActionData::Format::Use::find_locked_in_all_actions_param_alloc | ( | UniqueLocationKey & | key, |
const ALUPosition ** | alu_pos_p ) const |
Because the parameters are shared across all actions, the ALUOperations are stored across all actions. Each ALUOperation in all of these are also marked with the action_name as well, though in other lookups, the parameter can be looked up as a per action
const ALUParameter * ActionData::Format::Use::find_param_alloc | ( | UniqueLocationKey & | key, |
const ALUPosition ** | alu_pos_p ) const |
During the Instruction Adjustment phase of ActionAnalysis, in order to determine how to rename both constants and action data, as well as verify that the alignment is correct, an action parameter must be found within the action format.
This is done with a four part key:
This function returns the ALUParameter object, as well as the correspding ALUPosition object
cstring ActionData::Format::Use::get_format_name | ( | SlotType_t | slot_type, |
Location_t | loc, | ||
int | byte_offset, | ||
le_bitrange * | slot_bits = nullptr, | ||
le_bitrange * | postpone_range = nullptr ) const |
The purpose of this function is to have a standardized name of the location of parameters across multiple needs for it in the assembly output.
Specifically, in this example, parameters can be located with 3/4 coordinates:
1. SlotType_t slot_type - whether the alu op is a byte, half, or full word 2. Location_t loc - if the byte is in Action Data or Immediate 3. int byte_offset - the starting bit of that ALU operation in that location 4. optional bit_range to specify bit portions of the range.
Realistically, all of these are stored in the ALUPosition structure, though through asm_output, specifically during action data bus generation, the ALUPosition structure is not always available, so this function can be called.
The standardization is currently the following:
In addition, there are two parameters, for bit level granularity.
std::array<BusInputs, AD_LOCATIONS> ActionData::Format::Use::bus_inputs |
A bitvec per each SlotType / Location representing the use of each SlotType on input. Could be calculated directly from alu_positions
bitvec ActionData::Format::Use::full_words_bitmasked |
Which FULL words are to be used in a bitmasked-set, as those have to be contiguous on the action data bus words. Could be calculated directly from alu_positions
bitvec ActionData::Format::Use::immediate_mask |
A contiguous bits of action data in match overhead. Could be calculated directly from alu_positions