P4C
The P4 Compiler
|
#include <action_format.h>
Public Member Functions | |
ALUOperation (PHV::Container cont, ALUOPConstraint_t cons) | |
cstring | action_name () const |
void | add_mask_param (ALUParameter &ap) |
void | add_param (ALUParameter &ap) |
const ALUOperation * | add_right_shift (int right_shift, int *rot_alias_idx) const |
cstring | alias () const |
ALUOPConstraint_t | constraint () const |
PHV::Container | container () const |
bool | contains_only_one_overlap_solution () const |
const RamSection * | create_meter_alu_RamSection () const |
const RamSection * | create_meter_color_RamSection () const |
const RamSection * | create_RamSection (bool shift_to_lsb) const |
void | dbprint_multiline () const |
const ALUParameter * | find_param_alloc (UniqueLocationKey &key) const |
template<typename T > | |
bool | has_param () const |
int | hw_right_shift () const |
size_t | index () const |
bool | is_constrained (ALUOPConstraint_t cons) const |
bool | is_right_shift_from_hw () const |
cstring | mask_alias () const |
bitvec | mask_bits () const |
ParameterPositions | parameter_positions () const |
std::string | parameter_positions_to_string () const |
bitvec | phv_bits () const |
bitvec | phv_bytes () const |
bool | right_shift_set () const |
void | set_action_name (cstring an) |
void | set_alias (cstring a) |
void | set_mask_alias (cstring ma) |
size_t | size () const |
bitvec | slot_bits () const |
bitvec | static_entry_of_arg (const Argument *arg, bitvec value) const |
bitvec | static_entry_of_constants () const |
bool | valid () const |
cstring | wrapped_constant () const |
Friends | |
std::ostream & | operator<< (std::ostream &out, const ALUOperation &op) |
std::ostream & | operator<< (std::ostream &out, const ALUOperation *op) |
This class is the representation of the src1 of a single ALU operation when the src1 comes from the Action Data Bus. Essentially a single PHV instruction could be represented as, (somewhat): PHV Container number(phv_bits) = function(ADB SLOT number(slot_bits))
This class represents the data contained within slot-hi to slot-lo. What is known at Action Format allocation are both which container the data is headed to and which bits of the container are used.
The purpose of the allocation is to both figure out the slot_bits ( which is just the PHV bits barrel_shifted right by a certain amount), as well as a potential RAM location to store this Action Data.
const ALUOperation * ActionData::ALUOperation::add_right_shift | ( | int | right_shift, |
int * | rot_alias_idx ) const |
In the case where a parameter is rotated around the slot_size, as is the case in a deposit-field instruction, an alias is necessary for this rotation to be printed out correctly in assembly (as this is converted to a deposit-field with a wrapped slice).
If the ALUOperation does not yet have an alias, then one is created. Potentially multiple can be created per action, requiring an index to be tracked
const RamSection * ActionData::ALUOperation::create_meter_alu_RamSection | ( | ) | const |
Specifically for creating Meter ALU Ram Sections.
The Meter ALU output is always locked in position, as it is not programmable from the control plane where the bits are used. If the parameter is from Meter(lo..hi), the position on the home row action bus will be (lo..hi), as this is written directly from the ALU user.
Thus lo..hi must fit within a single adb slot, which is currently verified by action_analysis. For the ALUPosition object, the start byte is also already known as well as it comes from the lo / 8 of the action data bus.
const RamSection * ActionData::ALUOperation::create_meter_color_RamSection | ( | ) | const |
Meter Color is always output to bits 24..31 of immediate. There are multiple implications of this hardware limitation for this algorithm.
const RamSection * ActionData::ALUOperation::create_RamSection | ( | bool | shift_to_lsb | ) | const |
This function creates from a RamSection with it's isolated ALU information. This is the initial state from which the RamSections can be condensed and determined where they are in RAM.
|
inline |
- See also
- comments on create_meter_color_RamSection
bitvec ActionData::ALUOperation::phv_bytes | ( | ) | const |
compute a byte mask for bytes that are present in the phv_bits
Given an Argument, and its corresponding static value, calculate the action data RAM value of this ALUOperation that correspond to that argument.
bitvec ActionData::ALUOperation::static_entry_of_constants | ( | ) | const |
Given an ALUOperation, return the action data RAM value of all of the constants saved on the RAM.