19#ifndef BACKENDS_TOFINO_BF_P4C_PARDE_PARDE_SPEC_H_
20#define BACKENDS_TOFINO_BF_P4C_PARDE_PARDE_SPEC_H_
25#include "backends/tofino/bf-p4c/bf-p4c-options.h"
26#include "backends/tofino/bf-p4c/ir/bitrange.h"
27#include "backends/tofino/bf-p4c/parde/match_register.h"
392 size_t byteResubmitTagSize()
const {
return 1; }
431 virtual bool byteScratchRegisterRangeValid(
nw_byterange range)
const = 0;
470 virtual unsigned numDeparserConstantBytes()
const = 0;
473 virtual unsigned numDeparserChecksumUnits()
const = 0;
476 virtual unsigned numDeparserInvertChecksumUnits()
const = 0;
479 virtual unsigned deparserChunkSize()
const = 0;
482 virtual unsigned deparserChunkGroupSize()
const = 0;
485 virtual unsigned numDeparserChunkGroups()
const = 0;
488 virtual unsigned numClotsPerDeparserGroup()
const = 0;
509 static const std::map<unsigned, unsigned>
extractorSpec = {{8, 4}, {16, 4}, {32, 4}};
514 static std::vector<MatchRegister> spec;
527 BUG(
"Scratch registers not available in Tofino. Register: %1%", reg.name);
531 bool byteScratchRegisterRangeValid(
nw_byterange)
const override {
return false; }
544 unsigned bitMinClotPos(gress_t)
const override { BUG(
"No CLOTs in Tofino"); }
547 size_t minParseDepth(gress_t gress)
const override {
return gress == EGRESS ? 65 : 0; }
549 size_t maxParseDepth(gress_t gress)
const override {
return gress == EGRESS ? 160 : SIZE_MAX; }
553 unsigned numDeparserConstantBytes()
const override {
return 0; }
554 unsigned numDeparserChecksumUnits()
const override {
return 6; }
555 unsigned numDeparserInvertChecksumUnits()
const override {
return 0; }
556 unsigned deparserChunkSize()
const {
return 0; }
557 unsigned deparserChunkGroupSize()
const {
return 0; }
558 unsigned numDeparserChunkGroups()
const {
return 0; }
559 unsigned numClotsPerDeparserGroup()
const {
return 0; }
561 double clkFreq()
const override {
return 1.22; }
565 static std::vector<std::string> vldVecFields;
570 static std::unordered_set<std::string> vldVecSet;
581 static const std::map<unsigned, unsigned>
extractorSpec = {{16, 20}};
586 static std::vector<MatchRegister> spec;
597 static std::vector<MatchRegister> spec;
610 if (reg.name ==
"save_byte0")
612 else if (reg.name ==
"save_byte1")
614 else if (reg.name ==
"save_byte2")
616 else if (reg.name ==
"save_byte3")
619 BUG(
"Invalid scratch register %1%", reg.name);
623 bool byteScratchRegisterRangeValid(
nw_byterange range)
const override {
624 return (range.
lo >= 60) && (range.
hi <= 63);
635 return BackendOptions().tof2lab44_workaround ? 56 : 64;
647 unsigned numDeparserConstantBytes()
const override {
return 8; }
648 unsigned numDeparserChecksumUnits()
const override {
return 8; }
649 unsigned numDeparserInvertChecksumUnits()
const override {
return 4; }
650 unsigned deparserChunkSize()
const {
return 8; }
651 unsigned deparserChunkGroupSize()
const {
return 8; }
652 unsigned numDeparserChunkGroups()
const {
return 16; }
653 unsigned numClotsPerDeparserGroup()
const {
return 4; }
656 double clkFreq()
const override {
return 1.35; }
660 static std::vector<std::string> vldVecFields;
665 static std::unordered_set<std::string> vldVecSet;
672 unsigned numDeparserInvertChecksumUnits()
const override {
return 0; }
Definition parde_spec.h:670
Definition parde_spec.h:575
unsigned lineRate() const override
Max line rate per-port (Gbps)
Definition parde_spec.h:657
unsigned byteInterClotGap() const override
The minimum number of bytes required between consecutive CLOTs.
Definition parde_spec.h:640
const std::map< unsigned, unsigned > & extractorSpec() const override
Definition parde_spec.h:580
int numParsers() const override
Total parsers supported ingress/egress.
Definition parde_spec.h:628
unsigned maxClotsPerState() const override
The maximum number of CLOTs that can be generated in each parser state.
Definition parde_spec.h:631
const std::vector< MatchRegister > scratchRegisters() const override
Specifies the available scracth registers.
Definition parde_spec.h:596
const std::vector< MatchRegister > matchRegisters() const override
Specifies the available match registers.
Definition parde_spec.h:585
unsigned maxClotsLivePerGress() const override
The maximum number of CLOTs that can be live for each packet in each gress.
Definition parde_spec.h:639
const std::unordered_set< std::string > & mdpValidVecFieldsSet() const override
Unused.
Definition parde_spec.h:664
double clkFreq() const override
Clock frequency.
Definition parde_spec.h:656
unsigned bitMinClotPos(gress_t gress) const override
The minimum offset a CLOT can have, in bits.
Definition parde_spec.h:641
unsigned bitMaxClotPos() const override
The maximum offset+length a CLOT can have, in bits.
Definition parde_spec.h:644
int numTcamRows() const override
Total TCAM Rows supported ingress/egress.
Definition parde_spec.h:629
size_t byteIngressPrePacketPaddingSize() const override
Definition parde_spec.h:578
unsigned numClotsPerGress() const override
The number of CLOTs available for allocation in each gress.
Definition parde_spec.h:638
unsigned byteMaxClotSize() const override
The maximum number of bytes a CLOT can hold.
Definition parde_spec.h:634
const std::vector< std::string > & mdpValidVecFields() const override
Unused.
Definition parde_spec.h:659
size_t bytePhase0Size() const override
Definition parde_spec.h:577
bool parserAllExtractorsSupportSingleByte() const override
Do all extractors support single-byte extracts?
Definition parde_spec.h:645
Definition match_register.h:31
Definition parde_spec.h:378
virtual unsigned byteInterClotGap() const =0
The minimum number of bytes required between consecutive CLOTs.
virtual unsigned bitMaxClotPos() const =0
The maximum offset+length a CLOT can have, in bits.
virtual int numParsers() const =0
Total parsers supported ingress/egress.
virtual int numTcamRows() const =0
Total TCAM Rows supported ingress/egress.
virtual unsigned maxClotsLivePerGress() const =0
The maximum number of CLOTs that can be live for each packet in each gress.
virtual unsigned lineRate() const =0
Max line rate per-port (Gbps)
size_t byteIngressIntrinsicMetadataSize() const
Definition parde_spec.h:382
size_t bitResubmitTagSize() const
Definition parde_spec.h:391
virtual size_t maxParseDepth(gress_t) const
The maximum parse depth for the given gress.
Definition parde_spec.h:464
virtual const std::unordered_set< std::string > & mdpValidVecFieldsSet() const =0
Unused.
virtual size_t minParseDepth(gress_t) const
The minimum parse depth for the given gress.
Definition parde_spec.h:461
virtual unsigned numClotsPerGress() const =0
The number of CLOTs available for allocation in each gress.
virtual const std::vector< MatchRegister > scratchRegisters() const =0
Specifies the available scracth registers.
virtual const std::vector< std::string > & mdpValidVecFields() const =0
Unused.
int byteInputBufferSize() const
The size of input buffer, in bytes.
Definition parde_spec.h:410
virtual unsigned maxClotsPerState() const =0
The maximum number of CLOTs that can be generated in each parser state.
virtual unsigned bitMinClotPos(gress_t) const =0
The minimum offset a CLOT can have, in bits.
size_t bitResubmitSize() const
Definition parde_spec.h:395
virtual unsigned byteMaxClotSize() const =0
The maximum number of bytes a CLOT can hold.
virtual const std::vector< MatchRegister > matchRegisters() const =0
Specifies the available match registers.
virtual const std::map< unsigned, unsigned > & extractorSpec() const =0
virtual size_t bytePhase0Size() const =0
virtual size_t byteIngressPrePacketPaddingSize() const =0
nw_byterange byteInputBufferMetadataRange() const
Definition parde_spec.h:414
virtual double clkFreq() const =0
Clock frequency.
virtual bool parserAllExtractorsSupportSingleByte() const =0
Do all extractors support single-byte extracts?
size_t byteTotalIngressMetadataSize() const
Definition parde_spec.h:404
Definition parde_spec.h:503
const std::vector< MatchRegister > matchRegisters() const override
Specifies the available match registers.
Definition parde_spec.h:513
bool parserAllExtractorsSupportSingleByte() const override
Do all extractors support single-byte extracts?
Definition parde_spec.h:551
unsigned lineRate() const override
Max line rate per-port (Gbps)
Definition parde_spec.h:562
unsigned maxClotsLivePerGress() const override
The maximum number of CLOTs that can be live for each packet in each gress.
Definition parde_spec.h:540
unsigned maxClotsPerState() const override
The maximum number of CLOTs that can be generated in each parser state.
Definition parde_spec.h:536
const std::vector< std::string > & mdpValidVecFields() const override
Unused.
Definition parde_spec.h:564
size_t bytePhase0Size() const override
Definition parde_spec.h:505
unsigned byteMaxClotSize() const override
The maximum number of bytes a CLOT can hold.
Definition parde_spec.h:537
unsigned numClotsPerGress() const override
The number of CLOTs available for allocation in each gress.
Definition parde_spec.h:538
unsigned byteInterClotGap() const override
The minimum number of bytes required between consecutive CLOTs.
Definition parde_spec.h:542
size_t byteIngressPrePacketPaddingSize() const override
Definition parde_spec.h:506
const std::map< unsigned, unsigned > & extractorSpec() const override
Definition parde_spec.h:508
size_t minParseDepth(gress_t gress) const override
The minimum parse depth for the given gress.
Definition parde_spec.h:547
double clkFreq() const override
Clock frequency.
Definition parde_spec.h:561
size_t maxParseDepth(gress_t gress) const override
The maximum parse depth for the given gress.
Definition parde_spec.h:549
const std::vector< MatchRegister > scratchRegisters() const override
Specifies the available scracth registers.
Definition parde_spec.h:523
const std::unordered_set< std::string > & mdpValidVecFieldsSet() const override
Unused.
Definition parde_spec.h:569
unsigned bitMinClotPos(gress_t) const override
The minimum offset a CLOT can have, in bits.
Definition parde_spec.h:544
unsigned bitMaxClotPos() const override
The maximum offset+length a CLOT can have, in bits.
Definition parde_spec.h:545
int numParsers() const override
Total parsers supported ingress/egress.
Definition parde_spec.h:533
int numTcamRows() const override
Total TCAM Rows supported ingress/egress.
Definition parde_spec.h:534
Definition lib/bitrange.h:158
Definition lib/bitrange.h:513
int lo
Definition lib/bitrange.h:694
int hi
Definition lib/bitrange.h:700