P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::P4Tools::P4Testgen::Pna::SharedPnaTableStepper Class Reference
Inheritance diagram for P4::P4Tools::P4Testgen::Pna::SharedPnaTableStepper:
[legend]

Classes

struct  SharedPnaProperties
 Shared PNA table properties. More...
 

Public Member Functions

 SharedPnaTableStepper (SharedPnaExprStepper *stepper, const IR::P4Table *table)
 
- Public Member Functions inherited from P4::P4Tools::P4Testgen::TableStepper
 TableStepper (ExprStepper *stepper, const IR::P4Table *table)
 
bool eval ()
 

Protected Types

enum class  TableImplementation {
  standard , selector , profile , constant ,
  skip
}
 

Protected Member Functions

bool checkForActionProfile ()
 Check whether the table has an action profile implementation.
 
bool checkForActionSelector ()
 Check whether the table has an action selector implementation.
 
void checkTargetProperties (const std::vector< const IR::ActionListElement * > &tableActionList) override
 
const IR::Expression * computeTargetMatchType (const TableUtils::KeyProperties &keyProperties, TableMatchMap *matches, const IR::Expression *hitCondition) override
 
void evalTableActionProfile (const std::vector< const IR::ActionListElement * > &tableActionList)
 
void evalTableActionSelector (const std::vector< const IR::ActionListElement * > &tableActionList)
 
void evalTargetTable (const std::vector< const IR::ActionListElement * > &tableActionList) override
 
- Protected Member Functions inherited from P4::P4Tools::P4Testgen::TableStepper
void addDefaultAction (std::optional< const IR::Expression * > tableMissCondition)
 tableMissCondition is true.
 
std::vector< const IR::ActionListElement * > buildTableActionList ()
 Helper function that collects the list of actions contained in the table.
 
const IR::Expression * computeHit (TableMatchMap *matches)
 
void evalTableCall ()
 
const IR::Expression * evalTableConstEntries ()
 
void evalTableControlEntries (const std::vector< const IR::ActionListElement * > &tableActionList)
 
void evalTaintedTable ()
 
const ExecutionStategetExecutionState ()
 
const ProgramInfogetProgramInfo ()
 
ExprStepper::Result getResult ()
 
bool resolveTableKeys ()
 
void setTableDefaultEntries (const std::vector< const IR::ActionListElement * > &tableActionList)
 

Protected Attributes

struct P4::P4Tools::P4Testgen::Pna::SharedPnaTableStepper::SharedPnaProperties SharedPnaProperties
 
- Protected Attributes inherited from P4::P4Tools::P4Testgen::TableStepper
TableUtils::TableProperties properties
 Basic table properties that are set when initializing the TableStepper.
 
ExprStepperstepper
 Reference to the calling expression stepper.
 
const IR::P4Table * table
 The table for this particular stepper.
 

Additional Inherited Members

- Static Public Member Functions inherited from P4::P4Tools::P4Testgen::TableStepper
static const IR::StateVariable & getTableActionVar (const IR::P4Table *table)
 
static const IR::StateVariable & getTableHitVar (const IR::P4Table *table)
 
static const IR::StateVariable & getTableResultVar (const IR::P4Table *table)
 
static const IR::StateVariable & getTableStateVariable (const IR::Type *type, const IR::P4Table *table, cstring name, std::optional< int > idx1_opt=std::nullopt, std::optional< int > idx2_opt=std::nullopt)
 
- Static Protected Member Functions inherited from P4::P4Tools::P4Testgen::TableStepper
static const IR::StringLiteral * getTableActionString (const IR::MethodCallExpression *actionCall)
 

Class Documentation

◆ P4::P4Tools::P4Testgen::Pna::SharedPnaTableStepper::SharedPnaProperties

struct P4::P4Tools::P4Testgen::Pna::SharedPnaTableStepper::SharedPnaProperties

Shared PNA table properties.

Class Members
const PnaDpdkActionProfile * actionProfile = nullptr The table has an action profile associated with it.
const PnaDpdkActionSelector * actionSelector = nullptr The table has an action selector associated with it.
vector< const Expression * > actionSelectorKeys The selector keys that are part of the selector hash that is calculated.
bool addProfileToState = false The current execution state does not have this profile added to it yet.
TableImplementation implementaton = TableImplementation::standard The type of the table implementation.

Member Enumeration Documentation

◆ TableImplementation

Specifies the type of the table implementation: standard: standard implementation - use normal control plane entries. selector: ActionSelector implementation - also uses an action profile. profile: ACtionProfile implementation - normal entries are not valid constant: The table is constant - no control entries are possible. skip: Skip the implementation and just use the default entry (no entry at all).

Member Function Documentation

◆ checkTargetProperties()

void P4::P4Tools::P4Testgen::Pna::SharedPnaTableStepper::checkTargetProperties ( const std::vector< const IR::ActionListElement * > & tableActionList)
overrideprotectedvirtual

Collects properties that may be set per table. Target back end may have different semantics for table execution that need to be collect before evaluation the table.

Reimplemented from P4::P4Tools::P4Testgen::TableStepper.

◆ computeTargetMatchType()

const IR::Expression * P4::P4Tools::P4Testgen::Pna::SharedPnaTableStepper::computeTargetMatchType ( const TableUtils::KeyProperties & keyProperties,
TableMatchMap * matches,
const IR::Expression * hitCondition )
overrideprotectedvirtual

This function allows target back ends to add their own match types. For example, some back ends implement the "optional" match type, which either hits as exact match or does not match at all. The table stepper first checks these custom match types. If these do not match it steps through the default implementation. If it does not match either, a P4C_UNIMPLEMENTED is thrown.

Reimplemented from P4::P4Tools::P4Testgen::TableStepper.

◆ evalTableActionProfile()

void P4::P4Tools::P4Testgen::Pna::SharedPnaTableStepper::evalTableActionProfile ( const std::vector< const IR::ActionListElement * > & tableActionList)
protected

If the table has an action profile implementation, evaluate the match-action list accordingly. Entries will use indices to refer to actions instead of their labels.

◆ evalTableActionSelector()

void P4::P4Tools::P4Testgen::Pna::SharedPnaTableStepper::evalTableActionSelector ( const std::vector< const IR::ActionListElement * > & tableActionList)
protected

If the table has an action selector implementation, evaluate the match-action list accordingly. Entries will use indices to refer to actions instead of their labels.

◆ evalTargetTable()

void P4::P4Tools::P4Testgen::Pna::SharedPnaTableStepper::evalTargetTable ( const std::vector< const IR::ActionListElement * > & tableActionList)
overrideprotectedvirtual

This function allows target back ends to implement their own interpretation of table execution. How a table is evaluated is target-specific.

Reimplemented from P4::P4Tools::P4Testgen::TableStepper.