P4C
The P4 Compiler
|
Classes | |
struct | hash_matrix_reqs |
struct | HashDistAllocPostExpand |
struct | HashDistIRUse |
struct | HashDistUse |
struct | Use |
Public Types | |
using | byte_type_t = ::IXBar::byte_type_t |
using | HashDistDest_t = ::IXBar::HashDistDest_t |
Public Types inherited from IXBar | |
enum | byte_speciality_t { NONE , ATCAM_DOUBLE , ATCAM_INDEX , RANGE_LO , RANGE_HI , BYTE_SPECIALITIES } |
enum | byte_type_t { NO_BYTE_TYPE , ATCAM , PARTITION_INDEX , RANGE } |
enum | HashDistDest_t { HD_IMMED_LO , HD_IMMED_HI , HD_STATS_ADR , HD_METER_ADR , HD_ACTIONDATA_ADR , HD_PRECOLOR , HD_HASHMOD , HD_DESTS } |
enum | parity_status_t { PARITY_NONE , PARITY_ENABLED , PARITY_DISABLED } |
Public Member Functions | |
bool | find_alloc (safe_vector< IXBar::Use::Byte > &alloc_use, bool ternary, safe_vector< IXBar::Use::Byte * > &alloced, hash_matrix_reqs &hm_reqs, unsigned byte_mask=~0U) |
BFN::Alloc1D< std::pair< PHV::Container, int >, BYTE_GROUPS > & | get_byte_group_use () |
BFN::Alloc2Dbase< std::pair< PHV::Container, int > > & | get_exact_use () |
BFN::Alloc2Dbase< std::pair< PHV::Container, int > > & | get_ternary_use () |
unsigned | toIXBarOutputByte (bool ternary, int group, int byte) |
Public Member Functions inherited from IXBar | |
virtual void | update (cstring name, const Use &alloc)=0 |
Public Member Functions inherited from P4::IHasDbPrint | |
void | print () const |
Static Public Member Functions | |
static int | get_hash_single_bits () |
static int | get_meter_alu_hash_bits () |
static Use & | getUse (autoclone_ptr<::IXBar::Use > &ac) |
static const Use & | getUse (const autoclone_ptr<::IXBar::Use > &ac) |
static constexpr le_bitrange | INDEX_BIT_RANGE (int group) |
static constexpr int | INDEX_RANGE_SUBGROUP (le_bitrange r) |
Static Public Member Functions inherited from IXBar | |
static IXBar * | create () |
static HashDistDest_t | dest_location (const IR::Node *node, bool precolor=false) |
static std::string | hash_dist_name (HashDistDest_t dest) |
Static Public Attributes | |
static constexpr auto | ATCAM = ::IXBar::ATCAM |
static constexpr int | BYTE_GROUPS = StageUse::MAX_TERNARY_GROUPS/2 |
static constexpr int | EXACT_BYTES_PER_GROUP = 16 |
static constexpr int | EXACT_GROUPS = 8 |
static constexpr int | FAIR_MODE_HASH_BITS = 14 |
static constexpr int | GATEWAY_SEARCH_BYTES = 4 |
static constexpr int | HASH_DIST_BITS = 16 |
static constexpr int | HASH_DIST_EXPAND_BITS = 7 |
static constexpr int | HASH_DIST_MAX_MASK_BITS = HASH_DIST_BITS + HASH_DIST_EXPAND_BITS |
static constexpr int | HASH_DIST_SLICES = 3 |
static constexpr int | HASH_DIST_UNITS = 2 |
static constexpr int | HASH_GROUPS = 8 |
static constexpr int | HASH_INDEX_GROUPS = 4 |
static constexpr int | HASH_MATRIX_SIZE = RAM_SELECT_BIT_START + HASH_SINGLE_BITS |
static constexpr int | HASH_PARITY_BIT = 51 |
static constexpr int | HASH_SINGLE_BITS = 12 |
static constexpr int | HASH_TABLES = 16 |
static constexpr auto | HD_ACTIONDATA_ADR = ::IXBar::HD_ACTIONDATA_ADR |
static constexpr auto | HD_DESTS = ::IXBar::HD_DESTS |
static constexpr auto | HD_HASHMOD = ::IXBar::HD_HASHMOD |
static constexpr auto | HD_IMMED_HI = ::IXBar::HD_IMMED_HI |
static constexpr auto | HD_IMMED_LO = ::IXBar::HD_IMMED_LO |
static constexpr auto | HD_METER_ADR = ::IXBar::HD_METER_ADR |
static constexpr auto | HD_PRECOLOR = ::IXBar::HD_PRECOLOR |
static constexpr auto | HD_STATS_ADR = ::IXBar::HD_STATS_ADR |
static constexpr int | LPF_INPUT_BYTES = 4 |
static constexpr int | MAX_HASH_BITS = 52 |
static constexpr int | METER_ALU_HASH_BITS = 52 |
static constexpr int | METER_ALU_HASH_PARITY_BYTE_START = 48 |
static constexpr int | METER_PRECOLOR_SIZE = 2 |
static constexpr auto | NO_BYTE_TYPE = ::IXBar::NO_BYTE_TYPE |
static constexpr auto | PARTITION_INDEX = ::IXBar::PARTITION_INDEX |
static constexpr int | RAM_LINE_SELECT_BITS = 10 |
static constexpr int | RAM_SELECT_BIT_START = 40 |
static constexpr auto | RANGE = ::IXBar::RANGE |
static constexpr int | REPEATING_CONSTRAINT_SECT = 4 |
static constexpr int | RESILIENT_MODE_HASH_BITS = 51 |
static constexpr le_bitrange | SELECT_BIT_RANGE |
static constexpr int | TERNARY_BYTES_PER_BIG_GROUP = 11 |
static constexpr int | TERNARY_BYTES_PER_GROUP = 5 |
static constexpr int | TERNARY_GROUPS = StageUse::MAX_TERNARY_GROUPS |
static constexpr int | TOFINO_METER_ALU_BYTE_OFFSET = 8 |
Static Public Attributes inherited from IXBar | |
static constexpr int | LAMB_LINE_SELECT_BITS = 6 |
static constexpr int | RAM_LINE_SELECT_BITS = 10 |
Friends | |
class | IXBarRealign |
Additional Inherited Members | |
Public Attributes inherited from IXBar | |
cstring | failure_reason |
Protected Types inherited from IXBar | |
typedef std::map< Use::Byte, safe_vector< FieldInfo > > | ContByteConversion |
Protected Member Functions inherited from IXBar | |
void | create_alloc (ContByteConversion &map_alloc, IXBar::Use &alloc) |
void | create_alloc (ContByteConversion &map_alloc, safe_vector< Use::Byte > &bytes) |
Static Protected Member Functions inherited from IXBar | |
template<class T , int S> | |
static void | add_names (const BFN::Alloc1D< T, S > &n, std::map< cstring, char > &names) |
template<class T , int R, int C> | |
static void | add_names (const BFN::Alloc2D< T, R, C > &n, std::map< cstring, char > &names) |
static void | add_names (const std::pair< PHV::Container, int > &c, std::map< cstring, char > &names) |
template<class T > | |
static void | add_names (const T &n, std::map< cstring, char > &names) |
static void | add_names (cstring n, std::map< cstring, char > &names) |
static void | add_names (PHV::Container c, std::map< cstring, char > &names) |
static void | add_use (ContByteConversion &map_alloc, const PHV::Field *field, const PhvInfo &phv, const IR::MAU::Table *ctxt, std::optional< cstring > aliasSourceName, const le_bitrange *bits=nullptr, int flags=0, byte_type_t byte_type=NO_BYTE_TYPE, unsigned extra_align=0, int range_index=0, int pragma_forced_ixbar_group=-1) |
static void | sort_names (std::map< cstring, char > &names) |
template<class T > | |
static void | write_group (std::ostream &out, const T &grp, std::map< cstring, char > &fields) |
static void | write_one (std::ostream &out, const std::pair< cstring, int > &f, std::map< cstring, char > &fields) |
static void | write_one (std::ostream &out, const std::pair< PHV::Container, int > &f, std::map< cstring, char > &fields) |
static void | write_one (std::ostream &out, cstring n, std::map< cstring, char > &names) |
static void | write_one (std::ostream &out, PHV::Container f, std::map< cstring, char > &fields) |
Protected Attributes inherited from IXBar | |
ordered_map< const IR::MAU::AttachedMemory *, const IXBar::Use & > | allocated_attached |
bool Tofino::IXBar::find_alloc | ( | safe_vector< IXBar::Use::Byte > & | alloc_use, |
bool | ternary, | ||
safe_vector< IXBar::Use::Byte * > & | alloced, | ||
hash_matrix_reqs & | hm_reqs, | ||
unsigned | byte_mask = ~0U ) |
The algorithm for the allocation of bytes from the table to the input xbar, both for the TCAM and SRAM xbar. The input xbar is defined in section 6.1.8 Match Input Xbar of the uArch.
The input xbar for SRAM is 128 bytes, divided into 8 sections of 16 bytes (128 bits). As defined in section 6.2.3 Exact Match Row Vertical/Horizontal (VH) Xbars, any of the 8 sections can go to any search bus within the match array. However, a search bus can only input one of input xbar groups. Thus to minimize the width of the match, the algorithm must minimize the number of input xbar groups needed. Keep in mind that a search bus is 128 bits as well, so that only one search bus is need for an entire input xbar group.
The input xbar for TCAM is 66 bytes, divided into 6 groups of 11 bytes. These groups of 11 bytes can be thought of as a group of 5 bytes, a mid byte and a final group of 5 bytes. The reason for this odd structure is described in section 6.3.5 TCAM Matching Setup. Each TCAM is 44 bits. The lower 40 bits of the TCAM can pull from any 5 byte group, and the upper 4 bits can pull from any nibble of a midbyte.
An input xbar groups has the capability to be shared between multiple tables. Say for instance two separate ternary tables include a 40 bit field, and were to be placed in the same stage. If that 40 bit field occupied a single TCAM input xbar group, then two separate TCAMs, one for each table can pull from the same input xbar groups.
The algorithm works as follows:
ARGUMENTS: alloc_use vector of Byte objects that need to be allocated on the ixbar ternary true for ternary ixbar, false for exact alloced output – the Byte objects that were successfully allocated, as we want to fill out the values after we know the bytes don't break any hash constraints hm_reqs how much space, if any is required to be reserved on the hash matrix byte_mask which bytes in ixbar groups to use – default mask of ~0 means use any bytes
|
staticconstexpr |
Copyright (C) 2024 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0