P4C
The P4 Compiler
Loading...
Searching...
No Matches
hash_utils.h
1/*******************************************************************************
2 * Copyright (C) 2024 Intel Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing,
11 * software distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions
14 * and limitations under the License.
15 *
16 *
17 * SPDX-License-Identifier: Apache-2.0
18 ******************************************************************************/
19
20#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_TOFINO_HASH_UTILS_H_
21#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_TOFINO_HASH_UTILS_H_
22
23#include <vector>
24
25#include "backends/tofino/bf-utils/dynamic_hash/dynamic_hash.h"
26#include "ir/ir.h"
27// Need to include this last.
28#include "backends/tofino//bf-p4c/mau/hash_function.h"
29
30namespace P4::P4Tools::P4Testgen::Tofino {
31
37 private:
46 static hash_seed_t computeHash(IR::MAU::HashFunction &hashFunction,
47 const IR::ListExpression *hashList, const IR::Type *hashType,
48 const std::vector<bool> *symmetricList);
49
50 public:
60 static const IR::Constant *substituteCustomHash(const IR::Declaration_Instance *polyInstance,
61 const IR::ListExpression *hashList,
62 const IR::Type *hashType,
63 const std::vector<bool> *symmetricList);
73 static const IR::Constant *substituteOtherHash(const IR::Expression *hashAlgoExpr,
74 const IR::ListExpression *hashList,
75 const IR::Type *hashType,
76 const std::vector<bool> *symmetricList);
77};
78
79} // namespace P4::P4Tools::P4Testgen::Tofino
80
81#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_TOFINO_HASH_UTILS_H_ */
static const IR::Constant * substituteCustomHash(const IR::Declaration_Instance *polyInstance, const IR::ListExpression *hashList, const IR::Type *hashType, const std::vector< bool > *symmetricList)
Definition hash_utils.cpp:77
static const IR::Constant * substituteOtherHash(const IR::Expression *hashAlgoExpr, const IR::ListExpression *hashList, const IR::Type *hashType, const std::vector< bool > *symmetricList)
Definition hash_utils.cpp:96
Definition hash_function.h:28