19#ifndef BACKENDS_TOFINO_BF_P4C_SPECS_PARDE_SPEC_H_
20#define BACKENDS_TOFINO_BF_P4C_SPECS_PARDE_SPEC_H_
23#include <unordered_set>
26#include "backends/tofino/bf-p4c/ir/bitrange.h"
27#include "backends/tofino/bf-p4c/specs/gress.h"
28#include "backends/tofino/bf-p4c/specs/match_register_spec.h"
393 size_t byteResubmitTagSize()
const {
return 1; }
432 virtual bool byteScratchRegisterRangeValid(
nw_byterange range)
const = 0;
471 virtual unsigned numDeparserConstantBytes()
const = 0;
474 virtual unsigned numDeparserChecksumUnits()
const = 0;
477 virtual unsigned numDeparserInvertChecksumUnits()
const = 0;
480 virtual unsigned deparserChunkSize()
const = 0;
483 virtual unsigned deparserChunkGroupSize()
const = 0;
486 virtual unsigned numDeparserChunkGroups()
const = 0;
489 virtual unsigned numClotsPerDeparserGroup()
const = 0;
510 static const std::map<unsigned, unsigned>
extractorSpec = {{8, 4}, {16, 4}, {32, 4}};
515 static std::vector<MatchRegisterSpec> spec;
529 BUG(
"Scratch registers not available in Tofino. Register: %1%", reg.name);
533 bool byteScratchRegisterRangeValid(
nw_byterange)
const override {
return false; }
546 unsigned bitMinClotPos(gress_t)
const override { BUG(
"No CLOTs in Tofino"); }
549 size_t minParseDepth(gress_t gress)
const override {
return gress == EGRESS ? 65 : 0; }
551 size_t maxParseDepth(gress_t gress)
const override {
return gress == EGRESS ? 160 : SIZE_MAX; }
555 unsigned numDeparserConstantBytes()
const override {
return 0; }
556 unsigned numDeparserChecksumUnits()
const override {
return 6; }
557 unsigned numDeparserInvertChecksumUnits()
const override {
return 0; }
558 unsigned deparserChunkSize()
const override {
return 0; }
559 unsigned deparserChunkGroupSize()
const override {
return 0; }
560 unsigned numDeparserChunkGroups()
const override {
return 0; }
561 unsigned numClotsPerDeparserGroup()
const override {
return 0; }
563 double clkFreq()
const override {
return 1.22; }
567 static std::vector<std::string> vldVecFields;
572 static std::unordered_set<std::string> vldVecSet;
578 bool tof2lab44_workaround_;
581 explicit JBayPardeSpec(
bool tof2lab44_workaround)
582 : tof2lab44_workaround_(tof2lab44_workaround) {}
587 static const std::map<unsigned, unsigned>
extractorSpec = {{16, 20}};
592 static std::vector<MatchRegisterSpec> spec;
603 static std::vector<MatchRegisterSpec> spec;
616 if (reg.name ==
"save_byte0")
618 else if (reg.name ==
"save_byte1")
620 else if (reg.name ==
"save_byte2")
622 else if (reg.name ==
"save_byte3")
625 BUG(
"Invalid scratch register %1%", reg.name);
629 bool byteScratchRegisterRangeValid(
nw_byterange range)
const override {
630 return (range.
lo >= 60) && (range.
hi <= 63);
651 unsigned numDeparserConstantBytes()
const override {
return 8; }
652 unsigned numDeparserChecksumUnits()
const override {
return 8; }
653 unsigned numDeparserInvertChecksumUnits()
const override {
return 4; }
654 unsigned deparserChunkSize()
const override {
return 8; }
655 unsigned deparserChunkGroupSize()
const override {
return 8; }
656 unsigned numDeparserChunkGroups()
const override {
return 16; }
657 unsigned numClotsPerDeparserGroup()
const override {
return 4; }
660 double clkFreq()
const override {
return 1.35; }
664 static std::vector<std::string> vldVecFields;
669 static std::unordered_set<std::string> vldVecSet;
674class JBayA0PardeSpec :
public JBayPardeSpec {
676 explicit JBayA0PardeSpec(
bool tof2lab44_workaround) : JBayPardeSpec(tof2lab44_workaround) {}
678 unsigned numDeparserInvertChecksumUnits()
const override {
return 0; }
unsigned lineRate() const override
Max line rate per-port (Gbps)
Definition parde_spec.h:661
unsigned byteInterClotGap() const override
The minimum number of bytes required between consecutive CLOTs.
Definition parde_spec.h:644
const std::map< unsigned, unsigned > & extractorSpec() const override
Definition parde_spec.h:586
int numParsers() const override
Total parsers supported ingress/egress.
Definition parde_spec.h:634
unsigned maxClotsPerState() const override
The maximum number of CLOTs that can be generated in each parser state.
Definition parde_spec.h:637
const std::vector< MatchRegisterSpec > matchRegisters() const override
Specifies the available match registers.
Definition parde_spec.h:591
unsigned maxClotsLivePerGress() const override
The maximum number of CLOTs that can be live for each packet in each gress.
Definition parde_spec.h:643
const std::unordered_set< std::string > & mdpValidVecFieldsSet() const override
Unused.
Definition parde_spec.h:668
double clkFreq() const override
Clock frequency.
Definition parde_spec.h:660
unsigned bitMinClotPos(gress_t gress) const override
The minimum offset a CLOT can have, in bits.
Definition parde_spec.h:645
unsigned bitMaxClotPos() const override
The maximum offset+length a CLOT can have, in bits.
Definition parde_spec.h:648
int numTcamRows() const override
Total TCAM Rows supported ingress/egress.
Definition parde_spec.h:635
size_t byteIngressPrePacketPaddingSize() const override
Definition parde_spec.h:584
const std::vector< MatchRegisterSpec > scratchRegisters() const override
Specifies the available scracth registers.
Definition parde_spec.h:602
unsigned numClotsPerGress() const override
The number of CLOTs available for allocation in each gress.
Definition parde_spec.h:642
unsigned byteMaxClotSize() const override
The maximum number of bytes a CLOT can hold.
Definition parde_spec.h:640
const std::vector< std::string > & mdpValidVecFields() const override
Unused.
Definition parde_spec.h:663
size_t bytePhase0Size() const override
Definition parde_spec.h:583
bool parserAllExtractorsSupportSingleByte() const override
Do all extractors support single-byte extracts?
Definition parde_spec.h:649
Definition match_register_spec.h:28
Definition parde_spec.h:379
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 const std::vector< MatchRegisterSpec > scratchRegisters() const =0
Specifies the available scracth registers.
virtual unsigned lineRate() const =0
Max line rate per-port (Gbps)
size_t byteIngressIntrinsicMetadataSize() const
Definition parde_spec.h:383
size_t bitResubmitTagSize() const
Definition parde_spec.h:392
virtual size_t maxParseDepth(gress_t) const
The maximum parse depth for the given gress.
Definition parde_spec.h:465
virtual const std::unordered_set< std::string > & mdpValidVecFieldsSet() const =0
Unused.
virtual const std::vector< MatchRegisterSpec > matchRegisters() const =0
Specifies the available match registers.
virtual size_t minParseDepth(gress_t) const
The minimum parse depth for the given gress.
Definition parde_spec.h:462
virtual unsigned numClotsPerGress() const =0
The number of CLOTs available for allocation in each gress.
virtual const std::vector< std::string > & mdpValidVecFields() const =0
Unused.
int byteInputBufferSize() const
The size of input buffer, in bytes.
Definition parde_spec.h:411
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:396
virtual unsigned byteMaxClotSize() const =0
The maximum number of bytes a CLOT can hold.
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:415
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:405
Definition parde_spec.h:504
bool parserAllExtractorsSupportSingleByte() const override
Do all extractors support single-byte extracts?
Definition parde_spec.h:553
unsigned lineRate() const override
Max line rate per-port (Gbps)
Definition parde_spec.h:564
unsigned maxClotsLivePerGress() const override
The maximum number of CLOTs that can be live for each packet in each gress.
Definition parde_spec.h:542
unsigned maxClotsPerState() const override
The maximum number of CLOTs that can be generated in each parser state.
Definition parde_spec.h:538
const std::vector< std::string > & mdpValidVecFields() const override
Unused.
Definition parde_spec.h:566
size_t bytePhase0Size() const override
Definition parde_spec.h:506
unsigned byteMaxClotSize() const override
The maximum number of bytes a CLOT can hold.
Definition parde_spec.h:539
unsigned numClotsPerGress() const override
The number of CLOTs available for allocation in each gress.
Definition parde_spec.h:540
unsigned byteInterClotGap() const override
The minimum number of bytes required between consecutive CLOTs.
Definition parde_spec.h:544
size_t byteIngressPrePacketPaddingSize() const override
Definition parde_spec.h:507
const std::map< unsigned, unsigned > & extractorSpec() const override
Definition parde_spec.h:509
size_t minParseDepth(gress_t gress) const override
The minimum parse depth for the given gress.
Definition parde_spec.h:549
double clkFreq() const override
Clock frequency.
Definition parde_spec.h:563
size_t maxParseDepth(gress_t gress) const override
The maximum parse depth for the given gress.
Definition parde_spec.h:551
const std::unordered_set< std::string > & mdpValidVecFieldsSet() const override
Unused.
Definition parde_spec.h:571
unsigned bitMinClotPos(gress_t) const override
The minimum offset a CLOT can have, in bits.
Definition parde_spec.h:546
const std::vector< MatchRegisterSpec > matchRegisters() const override
Specifies the available match registers.
Definition parde_spec.h:514
unsigned bitMaxClotPos() const override
The maximum offset+length a CLOT can have, in bits.
Definition parde_spec.h:547
int numParsers() const override
Total parsers supported ingress/egress.
Definition parde_spec.h:535
int numTcamRows() const override
Total TCAM Rows supported ingress/egress.
Definition parde_spec.h:536
const std::vector< MatchRegisterSpec > scratchRegisters() const override
Specifies the available scracth registers.
Definition parde_spec.h:525
ClosedRange< RangeUnit::Bit, Endian::Network > nw_bitrange
Convenience typedefs for closed ranges in bits.
Definition lib/bitrange.h:755
ClosedRange< RangeUnit::Byte, Endian::Network > nw_byterange
Convenience typedefs for closed ranges in bytes.
Definition lib/bitrange.h:759
Definition lib/bitrange.h:158
int lo
Definition lib/bitrange.h:694
int hi
Definition lib/bitrange.h:700