P4C
The P4 Compiler
Loading...
Searching...
No Matches
targets/bmv2/program_info.h
1#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_PROGRAM_INFO_H_
2#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_PROGRAM_INFO_H_
3
4#include <cstddef>
5
6#include "control-plane/p4RuntimeSerializer.h"
7#include "ir/ir.h"
8#include "lib/cstring.h"
9
10#include "backends/p4tools/modules/testgen/core/program_info.h"
11#include "backends/p4tools/modules/testgen/targets/bmv2/compiler_result.h"
12
14
16 private:
20
22 const std::map<int, int> declIdToGress;
23
25 static const IR::Type_Bits PARSER_ERR_BITS;
26
29 std::vector<Continuation::Command> processDeclaration(const IR::Type_Declaration *typeDecl,
30 size_t blockIdx) const;
31
32 public:
35 std::map<int, int> declIdToGress);
36
38 int getGress(const IR::Type_Declaration *) const;
39
41 [[nodiscard]] P4::P4RuntimeAPI getP4RuntimeAPI() const;
42
44 const IR::P4Table *getTableofDirectExtern(const IR::IDeclaration *directExternDecl) const;
45
47 [[nodiscard]] const ArchSpec &getArchSpec() const override;
48
51 const;
52
55 [[nodiscard]] const IR::PathExpression *getBlockParam(cstring blockLabel,
56 size_t paramIndex) const;
57
58 [[nodiscard]] const IR::StateVariable &getTargetInputPortVar() const override;
59
61 static const IR::Expression *getPortConstraint(
62 const IR::StateVariable &portVar,
63 const std::vector<std::pair<int, int>> &permittedPortRanges);
64
65 [[nodiscard]] const IR::StateVariable &getTargetOutputPortVar() const override;
66
67 [[nodiscard]] const IR::Expression *dropIsActive() const override;
68
69 [[nodiscard]] const IR::Type_Bits *getParserErrorType() const override;
70
71 [[nodiscard]] const BMv2V1ModelCompilerResult &getCompilerResult() const override;
72
78 static const IR::Member *getParserParamVar(const IR::P4Parser *parser, const IR::Type *type,
79 size_t paramIndex, cstring paramLabel);
80
82 static const ArchSpec ARCH_SPEC;
83
84 DECLARE_TYPEINFO(Bmv2V1ModelProgramInfo, ProgramInfo);
85};
86
87} // namespace P4::P4Tools::P4Testgen::Bmv2
88
89#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_PROGRAM_INFO_H_ */
The Declaration interface, representing objects with names.
Definition declaration.h:26
Specifies a canonical representation of the target pipeline as documented in P4 code.
Definition p4tools/common/lib/arch_spec.h:13
Extends the CompilerResult with information specific to the V1Model running on BMv2.
Definition modules/testgen/targets/bmv2/compiler_result.h:16
Definition targets/bmv2/program_info.h:15
static const IR::Expression * getPortConstraint(const IR::StateVariable &portVar, const std::vector< std::pair< int, int > > &permittedPortRanges)
int getGress(const IR::Type_Declaration *) const
Definition targets/bmv2/program_info.cpp:103
Bmv2V1ModelProgramInfo(const BMv2V1ModelCompilerResult &compilerResult, ordered_map< cstring, const IR::Type_Declaration * > inputBlocks, std::map< int, int > declIdToGress)
Definition targets/bmv2/program_info.cpp:35
const IR::P4Table * getTableofDirectExtern(const IR::IDeclaration *directExternDecl) const
Definition targets/bmv2/program_info.cpp:85
const IR::Expression * dropIsActive() const override
Definition targets/bmv2/program_info.cpp:197
const BMv2V1ModelCompilerResult & getCompilerResult() const override
Definition targets/bmv2/program_info.cpp:228
static const ArchSpec ARCH_SPEC
Definition targets/bmv2/program_info.h:82
const IR::StateVariable & getTargetInputPortVar() const override
Definition targets/bmv2/program_info.cpp:185
const ordered_map< cstring, const IR::Type_Declaration * > * getProgrammableBlocks() const
Definition targets/bmv2/program_info.cpp:99
const ArchSpec & getArchSpec() const override
Definition targets/bmv2/program_info.cpp:96
static const IR::Member * getParserParamVar(const IR::P4Parser *parser, const IR::Type *type, size_t paramIndex, cstring paramLabel)
Definition targets/bmv2/program_info.cpp:236
P4::P4RuntimeAPI getP4RuntimeAPI() const
Definition targets/bmv2/program_info.cpp:232
const IR::StateVariable & getTargetOutputPortVar() const override
Definition targets/bmv2/program_info.cpp:191
const IR::PathExpression * getBlockParam(cstring blockLabel, size_t paramIndex) const
Definition targets/bmv2/program_info.cpp:205
Stores target-specific information about a P4 program.
Definition core/program_info.h:21
Definition cstring.h:85
Definition ordered_map.h:32
Inja.
Definition targets/bmv2/cmd_stepper.cpp:33
Definition p4RuntimeSerializer.h:57