P4C
The P4 Compiler
Loading...
Searching...
No Matches
targets/bmv2/table_stepper.h
1#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_TABLE_STEPPER_H_
2#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_TABLE_STEPPER_H_
3
4#include <vector>
5
6#include "ir/ir.h"
7
8#include "backends/p4tools/modules/testgen/core/small_step/table_stepper.h"
9#include "backends/p4tools/modules/testgen/lib/execution_state.h"
10#include "backends/p4tools/modules/testgen/lib/test_spec.h"
11#include "backends/p4tools/modules/testgen/targets/bmv2/expr_stepper.h"
12#include "backends/p4tools/modules/testgen/targets/bmv2/test_spec.h"
13
15
17 private:
24 enum class TableImplementation { standard, selector, profile, constant, skip };
25
27 struct Bmv2V1ModelProperties {
29 const Bmv2V1ModelActionProfile *actionProfile = nullptr;
30
32 const Bmv2V1ModelActionSelector *actionSelector = nullptr;
33
35 std::vector<const IR::Expression *> actionSelectorKeys;
36
38 bool addProfileToState = false;
39
41 TableImplementation implementaton = TableImplementation::standard;
42 } bmv2V1ModelProperties;
43
45 bool checkForActionProfile();
46
48 bool checkForActionSelector();
49
52 void evalTableActionProfile(const std::vector<const IR::ActionListElement *> &tableActionList);
53
56 void evalTableActionSelector(const std::vector<const IR::ActionListElement *> &tableActionList);
57
58 protected:
59 const IR::Expression *computeTargetMatchType(const TableUtils::KeyProperties &keyProperties,
60 TableMatchMap *matches,
61 const IR::Expression *hitCondition) override;
62
64 const std::vector<const IR::ActionListElement *> &tableActionList) override;
65
66 void evalTargetTable(
67 const std::vector<const IR::ActionListElement *> &tableActionList) override;
68
69 public:
70 explicit Bmv2V1ModelTableStepper(Bmv2V1ModelExprStepper *stepper, const IR::P4Table *table);
71};
72
73} // namespace P4::P4Tools::P4Testgen::Bmv2
74
75#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_TABLE_STEPPER_H_ */
Definition targets/bmv2/test_spec.h:147
Definition targets/bmv2/test_spec.h:181
Definition targets/bmv2/expr_stepper.h:17
Definition targets/bmv2/table_stepper.h:16
void evalTargetTable(const std::vector< const IR::ActionListElement * > &tableActionList) override
Definition targets/bmv2/table_stepper.cpp:387
void checkTargetProperties(const std::vector< const IR::ActionListElement * > &tableActionList) override
Definition targets/bmv2/table_stepper.cpp:357
const IR::Expression * computeTargetMatchType(const TableUtils::KeyProperties &keyProperties, TableMatchMap *matches, const IR::Expression *hitCondition) override
Definition targets/bmv2/table_stepper.cpp:39
Implements small-step operational semantics for tables.
Definition core/small_step/table_stepper.h:20
const IR::P4Table * table
The table for this particular stepper.
Definition core/small_step/table_stepper.h:26
ExprStepper * stepper
Reference to the calling expression stepper.
Definition core/small_step/table_stepper.h:23
Inja.
Definition targets/bmv2/cmd_stepper.cpp:33
KeyProperties define properties of table keys that are useful for execution.
Definition table_utils.h:10