P4C
The P4 Compiler
Loading...
Searching...
No Matches
parde_phv_constraints.h
1
19
#ifndef BF_P4C_PHV_PARDE_PHV_CONSTRAINTS_H_
20
#define BF_P4C_PHV_PARDE_PHV_CONSTRAINTS_H_
21
22
#include "backends/tofino/bf-p4c/mau/mau_visitor.h"
23
#include "backends/tofino/bf-p4c/phv/phv_fields.h"
24
#include "backends/tofino/bf-p4c/phv/pragma/pa_container_size.h"
25
#include "ir/ir.h"
26
43
class
PardePhvConstraints
:
public
Inspector
{
44
private
:
45
static
constexpr
int
MAX_CONSTANT_WINDOW = 3;
46
48
unsigned
DIGEST_BYTES_THRESHOLD;
49
50
PhvInfo
&phv;
51
PragmaContainerSize
&sizePragmas;
52
53
profile_t
init_apply(
const
IR::Node
*root)
override
;
54
bool
preorder(
const
IR::BFN::Digest *digest)
override
;
55
56
public
:
57
explicit
PardePhvConstraints
(
PhvInfo
&p,
PragmaContainerSize
&pa) : phv(p), sizePragmas(pa) {
58
// Set the threshold for setting restrictions of unused bits in digest fields to 90% of the
59
// maximum.
60
DIGEST_BYTES_THRESHOLD = Device::maxDigestSizeInBytes() * 9 / 10;
61
}
62
};
63
64
class
TofinoParserConstantExtract
:
public
Inspector
{
65
private
:
66
PhvInfo
&phv;
67
68
ordered_map<const IR::BFN::ParserState *, ordered_set<PHV::Field *>
> stateToPOVMap;
69
70
profile_t
init_apply(
const
IR::Node
*root)
override
;
71
bool
preorder(
const
IR::BFN::Extract *extract)
override
;
72
void
end_apply()
override
;
73
74
public
:
75
explicit
TofinoParserConstantExtract
(
PhvInfo
&p) : phv(p) {}
76
};
77
78
#endif
/* BF_P4C_PHV_PARDE_PHV_CONSTRAINTS_H_ */
P4::IR::Node
Definition
node.h:94
P4::Inspector
Definition
visitor.h:400
P4::Visitor::profile_t
Definition
visitor.h:78
P4::ordered_map
Definition
ordered_map.h:32
PardePhvConstraints
Definition
parde_phv_constraints.h:43
PhvInfo
Definition
phv_fields.h:1095
PragmaContainerSize
Definition
pa_container_size.h:39
TofinoParserConstantExtract
Definition
parde_phv_constraints.h:64
backends
tofino
bf-p4c
phv
parde_phv_constraints.h
Generated by
1.12.0