P4C
The P4 Compiler
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
InputXbar Class Reference

Classes

class  all_iter
 
struct  Group
 
struct  GroupSet
 
struct  HashGrp
 
struct  HashTable
 
struct  Input
 
struct  TcamUseCache
 

Public Member Functions

all_iter begin () const
 
bitvec bytemask ()
 
all_iter end () const
 
virtual unsigned exact_physical_ids () const
 
const Inputfind (Phv::Slice sl, Group grp, Group *found=nullptr) const
 
std::vector< const Input * > find_all (Phv::Slice sl, Group grp) const
 
const Inputfind_exact (Phv::Slice sl, int group) const
 
int find_gateway_offset (const MatchSource *ms, int offset) const
 
virtual std::vector< const Input * > find_hash_inputs (Phv::Slice sl, HashTable ht) const
 
int find_match_offset (const MatchSource *ms, int offset=-1) const
 
virtual int find_offset (const MatchSource *, Group grp, int offset) const
 
std::string get_field_name (int bit)
 
Phv::Ref get_group_bit (Group grp, unsigned bit) const
 
HashGrpget_hash_group (unsigned group=-1)
 
HashGrpget_hash_group_from_hash_table (int hash_table)
 
const std::map< int, HashCol > & get_hash_table (HashTable id)
 
const std::map< int, HashCol > & get_hash_table (unsigned id=0)
 
std::map< HashTable, std::map< int, HashCol > > & get_hash_tables ()
 
virtual Phv::Ref get_hashtable_bit (HashTable id, unsigned bit) const
 
Phv::Ref get_hashtable_bit (unsigned id, unsigned bit) const
 
unsigned get_seed_bit (unsigned group, unsigned bit) const
 
virtual int global_bit_position_adjust (HashTable ht) const
 
virtual bitvec global_column0_extract (HashTable ht, const hash_column_t matrix[PARITY_GROUPS_DYN][HASH_MATRIX_WIDTH_DYN]) const
 
std::vector< const HashCol * > hash_column (int col, int grp=-1) const
 
int hash_group () const
 
bitvec hash_group_bituse (int grp=-1) const
 
virtual Group hashtable_input_group (HashTable ht) const
 
bool have_exact () const
 
bool have_ternary () const
 
bool is_p4_param_bit_in_hash (std::string p4_param_name, unsigned bit)
 
bool log_hashes (std::ofstream &out) const
 
int match_group ()
 
void pass1 ()
 
virtual void pass2 ()
 
virtual void setup_match_key_cfg (const MatchSource *)
 
int tcam_byte_group (int n)
 
unsigned tcam_width ()
 
int tcam_word_group (int n)
 
template<class REGS>
void write_galois_matrix (REGS &regs, HashTable id, const std::map< int, HashCol > &mat)
 
template<>
void write_galois_matrix (Target::JBay::mau_regs &regs, HashTable id, const std::map< int, HashCol > &mat)
 
template<>
void write_galois_matrix (Target::JBay::mau_regs &regs, HashTable id, const std::map< int, HashCol > &mat)
 
template<>
void write_galois_matrix (Target::Tofino::mau_regs &regs, HashTable id, const std::map< int, HashCol > &mat)
 
template<>
void write_galois_matrix (Target::Tofino::mau_regs &regs, HashTable id, const std::map< int, HashCol > &mat)
 
template<class REGS>
void write_regs (REGS &regs)
 
template<class REGS>
void write_xmu_regs (REGS &regs)
 

Static Public Member Functions

static std::unique_ptr< InputXbarcreate (Table *table, bool tern, const value_t &key, const VECTOR(pair_t) &data)
 
static std::unique_ptr< InputXbarcreate (Table *table, const value_t *key=nullptr)
 

Public Attributes

const int lineno
 
int random_seed = -1
 

Protected Member Functions

 InputXbar (const InputXbar &)=delete
 
 InputXbar (Table *table, int lineno)
 
void add_use (unsigned &byte_use, std::vector< Input > &a)
 
bool can_merge (HashGrp &a, HashGrp &b)
 
virtual void check_input (Group group, Input &input, TcamUseCache &tcam_use)
 
bool copy_existing_hash (HashTable ht, std::pair< const int, HashCol > &col)
 
void gen_hash_column (std::pair< const int, HashCol > &col, std::pair< const HashTable, std::map< int, HashCol > > &hash)
 
virtual int group_max_index (Group::type_t t) const
 
virtual Group group_name (bool ternary, const value_t &value) const
 
virtual int group_size (Group::type_t t) const
 
const char * group_type (Group::type_t t) const
 
uint64_t hash_columns_used (HashTable hash)
 
uint64_t hash_columns_used (unsigned id)
 
virtual int hash_num_columns (HashTable ht) const
 
void input (Table *table, bool ternary, const VECTOR(pair_t) &data)
 
void parse_group (Table *t, Group gr, const value_t &value)
 
virtual bool parse_hash (Table *t, const pair_t &kv)
 
void parse_hash_group (HashGrp &hash_group, const value_t &value)
 
void parse_hash_table (Table *t, HashTable ht, const value_t &value)
 
virtual bool parse_unit (Table *t, const pair_t &kv)
 
void setup_hash (std::map< int, HashCol > &, HashTable ht, gress_t, int stage, value_t &, int lineno, int lo, int hi)
 
int tcam_input_use (int out_byte, int phv_byte, int phv_size)
 
void tcam_update_use (TcamUseCache &use)
 

Static Protected Member Functions

static bool conflict (const HashGrp &a, const HashGrp &b)
 
static bool conflict (const std::map< int, HashCol > &, const std::map< int, HashCol > &, int *=0)
 
static bool conflict (const std::vector< Input > &a, const std::vector< Input > &b)
 

Protected Attributes

ordered_map< Group, std::vector< Input > > groups
 
std::map< unsigned, HashGrphash_groups
 
std::map< HashTable, unsigned > hash_table_parity
 
std::map< HashTable, std::map< int, HashCol > > hash_tables
 
Tabletable
 

Class Documentation

◆ InputXbar::HashGrp

struct InputXbar::HashGrp
Class Members
int lineno = -1
uint64_t seed = 0
bool seed_parity = false
unsigned tables = 0

◆ InputXbar::TcamUseCache

struct InputXbar::TcamUseCache
Class Members
set< InputXbar * > ixbars_added
map< int, pair< const Input &, int > > tcam_use

Member Function Documentation

◆ find_hash_inputs()

std::vector< const InputXbar::Input * > InputXbar::find_hash_inputs ( Phv::Slice sl,
HashTable ht ) const
virtual

InputXbar::find_hash_inputs: find all of the ixbar inputs that feed a particular phv slice to a hash table

Parameters
slthe PHV container slice we're interested in
hash_tablewhich hash table we want the input for (-1 for all hash tables)

◆ write_galois_matrix() [1/4]

template<>
void InputXbar::write_galois_matrix ( Target::JBay::mau_regs & regs,
HashTable id,
const std::map< int, HashCol > & mat )

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

◆ write_galois_matrix() [2/4]

template<>
void InputXbar::write_galois_matrix ( Target::JBay::mau_regs & regs,
HashTable id,
const std::map< int, HashCol > & mat )

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

◆ write_galois_matrix() [3/4]

template<>
void InputXbar::write_galois_matrix ( Target::Tofino::mau_regs & regs,
HashTable id,
const std::map< int, HashCol > & mat )

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

◆ write_galois_matrix() [4/4]

template<>
void InputXbar::write_galois_matrix ( Target::Tofino::mau_regs & regs,
HashTable id,
const std::map< int, HashCol > & mat )

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