19#ifndef BACKENDS_TOFINO_BF_P4C_PARDE_CLOT_CLOT_H_
20#define BACKENDS_TOFINO_BF_P4C_PARDE_CLOT_CLOT_H_
26#include "backends/tofino/bf-p4c/ir/gress.h"
27#include "backends/tofino/bf-p4c/lib/cmp.h"
28#include "lib/exceptions.h"
29#include "lib/ordered_map.h"
66 BUG_CHECK(
gress != GHOST,
"Cannot assign CLOTs to ghost gress.");
70 BUG_CHECK(
gress != GHOST,
"Cannot assign CLOTs to ghost gress.");
96 const IR::BFN::FieldLVal *pov_bit =
nullptr;
98 std::optional<unsigned> stack_depth = std::nullopt;
100 std::optional<unsigned> stack_inc = std::nullopt;
102 unsigned length_in_bytes(
cstring parser_state)
const;
131 void set_slices(
cstring parser_state,
const std::vector<const PHV::FieldSlice *> &slices);
152 std::map<cstring, std::vector<const PHV::FieldSlice *>> parser_state_to_slices_;
154 std::map<const PHV::FieldSlice *, cstring> slice_to_parser_state_;
161 std::set<const PHV::Field *> phv_fields_;
164 std::set<const PHV::Field *> checksum_fields_;
170 return parser_state_to_slices_;
175 return fields_to_slices_;
179 const std::set<const PHV::Field *> &
checksum_fields()
const {
return checksum_fields_; }
181 std::map<const PHV::Field *, unsigned> checksum_field_to_checksum_id;
186std::ostream &operator<<(std::ostream &out,
const Clot &clot);
187std::ostream &operator<<(std::ostream &out,
const Clot *clot);
bool is_phv_field(const PHV::Field *field) const
Definition parde/clot/clot.cpp:125
const std::map< cstring, std::vector< const PHV::FieldSlice * > > & parser_state_to_slices() const
Definition clot.h:169
std::optional< unsigned > csum_unit
Indicates the checksum engine (if any) that will deposit in this CLOT.
Definition clot.h:128
gress_t gress
The gress to which this CLOT is assigned.
Definition clot.h:94
void toJSON(JSONGenerator &json) const
JSON serialization/deserialization.
Definition parde/clot/clot.cpp:196
Clot()
JSON deserialization constructor.
Definition clot.h:63
bool is_checksum_field(const PHV::Field *field) const
Definition parde/clot/clot.cpp:127
unsigned byte_offset(cstring parser_state, const PHV::FieldSlice *slice) const
Definition parde/clot/clot.cpp:121
bool operator==(const Clot &clot) const
Equality based on gress and tag.
Definition clot.h:78
const ordered_map< const PHV::Field *, const PHV::FieldSlice * > & fields_to_slices() const
Returns all fields that have slices in this CLOT, mapped to their corresponding slice.
Definition clot.h:174
static std::map< gress_t, int > tag_count
Definition clot.h:183
bool has_slice(const PHV::FieldSlice *slice) const
Definition parde/clot/clot.cpp:131
const std::set< const PHV::Field * > & checksum_fields() const
Returns all fields that need to be replaced by a checksum when deparsed.
Definition clot.h:179
unsigned bit_offset(cstring parser_state, const PHV::FieldSlice *slice) const
Definition parde/clot/clot.cpp:108
unsigned tag
Identifies the hardware CLOT associated with this object.
Definition clot.h:91
bool operator<(const Clot &clot) const
Lexicographic ordering according to (gress, tag).
Definition clot.h:81
bool is_first_field_in_clot(const PHV::Field *field) const
Definition parde/clot/clot.cpp:137
Definition clot_info.h:41
Definition json_generator.h:36
Definition json_loader.h:38
Definition ordered_map.h:32
Definition phv_fields.h:154
Definition phv_fields.h:898
Definition phv_fields.h:1095
Definition allocate_clot.cpp:40
The namespace encapsulating Barefoot/Intel-specific stuff.
Definition add_t2na_meta.cpp:21
The namespace encapsulating IR node classes.
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
The namespace encapsulating PHV-related stuff.
Definition gateway.h:32