P4C
The P4 Compiler
Loading...
Searching...
No Matches
compute_lowered_deparser_ir.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_COMPUTE_LOWERED_DEPARSER_IR_H_
20#define BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_COMPUTE_LOWERED_DEPARSER_IR_H_
21
22#include "backends/tofino/bf-p4c/parde/allocate_parser_checksum.h"
23#include "backends/tofino/bf-p4c/parde/clot/clot_info.h"
24#include "backends/tofino/bf-p4c/parde/parde_visitor.h"
25
26namespace Parde::Lowered {
27
35 ComputeLoweredDeparserIR(const PhvInfo &phv, const ClotInfo &clotInfo)
36 : phv(phv),
37 clotInfo(clotInfo),
38 nextChecksumUnit(0),
39 lastSharedUnit(0),
40 nested_unit(0),
41 normal_unit(4) {
42 igLoweredDeparser = new IR::BFN::LoweredDeparser(INGRESS);
43 egLoweredDeparser = new IR::BFN::LoweredDeparser(EGRESS);
44 }
45
47 IR::BFN::LoweredDeparser *igLoweredDeparser;
48 IR::BFN::LoweredDeparser *egLoweredDeparser;
49 // Contains checksum unit number for each checksum destination in each gress
50 std::map<gress_t, std::map<const IR::BFN::EmitChecksum *, unsigned>> checksumInfo;
51
52 private:
57 IR::Vector<IR::BFN::FieldLVal> removeDeparserZeroFields(
58 IR::Vector<IR::BFN::FieldLVal> checksumFields);
59
61 std::pair<IR::BFN::PartialChecksumUnitConfig *, std::vector<IR::BFN::ChecksumClotInput *>>
62 getPartialUnit(const IR::BFN::EmitChecksum *emitChecksum, gress_t gress);
63
66 IR::BFN::FullChecksumUnitConfig *lowerChecksum(const IR::BFN::EmitChecksum *emitChecksum,
67 gress_t gress);
68
77 unsigned int getChecksumUnit(bool nested);
78
82 bool preorder(const IR::BFN::Deparser *deparser) override;
83
84 const PhvInfo &phv;
85 const ClotInfo &clotInfo;
86 unsigned nextChecksumUnit;
87 unsigned lastSharedUnit;
88 unsigned nested_unit;
89 unsigned normal_unit;
90};
91
92} // namespace Parde::Lowered
93
94#endif /* BACKENDS_TOFINO_BF_P4C_PARDE_LOWERED_COMPUTE_LOWERED_DEPARSER_IR_H_ */
Definition clot_info.h:41
Definition vector.h:59
Definition phv_fields.h:1095
IR::BFN::LoweredDeparser * igLoweredDeparser
The lowered deparser IR generated by this pass.
Definition compute_lowered_deparser_ir.h:47
Generates lowered deparser IR with container references.
Definition compute_lowered_deparser_ir.h:34
Definition parde_visitor.h:117
Definition lower_parser.cpp:72