P4C
The P4 Compiler
Loading...
Searching...
No Matches
pna/shared_table_stepper.h
1/*
2 * SPDX-FileCopyrightText: 2023 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_PNA_SHARED_TABLE_STEPPER_H_
8#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_PNA_SHARED_TABLE_STEPPER_H_
9
10#include <vector>
11
12#include "ir/ir.h"
13
14#include "backends/p4tools/modules/testgen/core/small_step/table_stepper.h"
15#include "backends/p4tools/modules/testgen/lib/execution_state.h"
16#include "backends/p4tools/modules/testgen/lib/test_spec.h"
17#include "backends/p4tools/modules/testgen/targets/pna/shared_expr_stepper.h"
18#include "backends/p4tools/modules/testgen/targets/pna/test_spec.h"
19
21
22class SharedPnaTableStepper : public TableStepper {
23 protected:
26
29
32 void evalTableActionProfile(const std::vector<const IR::ActionListElement *> &tableActionList);
33
36 void evalTableActionSelector(const std::vector<const IR::ActionListElement *> &tableActionList);
37
44 enum class TableImplementation { standard, selector, profile, constant, skip };
45
50
53
55 std::vector<const IR::Expression *> actionSelectorKeys;
56
58 bool addProfileToState = false;
59
61 TableImplementation implementaton = TableImplementation::standard;
63
64 const IR::Expression *computeTargetMatchType(const TableUtils::KeyProperties &keyProperties,
65 TableMatchMap *matches,
66 const IR::Expression *hitCondition) override;
67
69 const std::vector<const IR::ActionListElement *> &tableActionList) override;
70
71 void evalTargetTable(
72 const std::vector<const IR::ActionListElement *> &tableActionList) override;
73
74 public:
75 explicit SharedPnaTableStepper(SharedPnaExprStepper *stepper, const IR::P4Table *table);
76};
77
78} // namespace P4::P4Tools::P4Testgen::Pna
79
80#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_PNA_SHARED_TABLE_STEPPER_H_ */
Definition targets/pna/test_spec.h:100
Definition targets/pna/test_spec.h:134
Definition pna/shared_expr_stepper.h:19
void evalTableActionProfile(const std::vector< const IR::ActionListElement * > &tableActionList)
Definition pna/shared_table_stepper.cpp:91
bool checkForActionSelector()
Check whether the table has an action selector implementation.
Definition pna/shared_table_stepper.cpp:299
const IR::Expression * computeTargetMatchType(const TableUtils::KeyProperties &keyProperties, TableMatchMap *matches, const IR::Expression *hitCondition) override
Definition pna/shared_table_stepper.cpp:41
void checkTargetProperties(const std::vector< const IR::ActionListElement * > &tableActionList) override
Definition pna/shared_table_stepper.cpp:342
const PnaDpdkActionProfile * actionProfile
The table has an action profile associated with it.
Definition pna/shared_table_stepper.h:49
std::vector< const IR::Expression * > actionSelectorKeys
The selector keys that are part of the selector hash that is calculated.
Definition pna/shared_table_stepper.h:55
void evalTableActionSelector(const std::vector< const IR::ActionListElement * > &tableActionList)
Definition pna/shared_table_stepper.cpp:168
TableImplementation implementaton
The type of the table implementation.
Definition pna/shared_table_stepper.h:61
bool checkForActionProfile()
Check whether the table has an action profile implementation.
Definition pna/shared_table_stepper.cpp:257
TableImplementation
Definition pna/shared_table_stepper.h:44
void evalTargetTable(const std::vector< const IR::ActionListElement * > &tableActionList) override
Definition pna/shared_table_stepper.cpp:372
const PnaDpdkActionSelector * actionSelector
The table has an action selector associated with it.
Definition pna/shared_table_stepper.h:52
bool addProfileToState
The current execution state does not have this profile added to it yet.
Definition pna/shared_table_stepper.h:58
Shared PNA table properties.
Definition pna/shared_table_stepper.h:47
const IR::P4Table * table
The table for this particular stepper.
Definition core/small_step/table_stepper.h:32
ExprStepper * stepper
Reference to the calling expression stepper.
Definition core/small_step/table_stepper.h:29
Inja.
Definition pna/backend/metadata/metadata.cpp:28
KeyProperties define properties of table keys that are useful for execution.
Definition table_utils.h:16