P4C
The P4 Compiler
Loading...
Searching...
No Matches
targets/bmv2/concolic.h
1#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_CONCOLIC_H_
2#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_CONCOLIC_H_
3
4#include <cstddef>
5#include <functional>
6#include <vector>
7
8#include "backends/p4tools/common/lib/model.h"
9#include "ir/ir.h"
10#include "lib/big_int_util.h"
11
12#include "backends/p4tools/modules/testgen/lib/concolic.h"
13
15
16enum class Bmv2HashAlgorithm {
17 crc32,
18 crc32_custom,
19 crc16,
20 crc16_custom,
21 random,
23 csum16,
24 xor16
25};
26
27std::ostream &operator<<(std::ostream &os, Bmv2HashAlgorithm algo);
28
29class Bmv2Concolic : public Concolic {
30 private:
32 static constexpr int CHUNK_SIZE = 8;
33
35 static const ConcolicMethodImpls::ImplList BMV2_CONCOLIC_METHOD_IMPLS;
36
39 static big_int computeChecksum(const std::vector<const IR::Expression *> &exprList,
40 const Model &finalModel, Bmv2HashAlgorithm algo,
41 Model::ExpressionMap *resolvedExpressions);
42
47 static const IR::Expression *setAndComputePayload(
48 const Model &finalModel, ConcolicVariableMap *resolvedConcolicVariables, int payloadSize);
49
50 public:
52 static const ConcolicMethodImpls::ImplList *getBmv2ConcolicMethodImpls();
53};
54
55} // namespace P4::P4Tools::P4Testgen::Bmv2
56
57#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_CONCOLIC_H_ */
Definition backends/p4tools/common/lib/model.h:18
Definition targets/bmv2/concolic.h:29
static const ConcolicMethodImpls::ImplList * getBmv2ConcolicMethodImpls()
Definition targets/bmv2/concolic.cpp:273
Definition lib/concolic.h:86
uint64_t identity(const uint8_t *buf, size_t len)
Identity hash – the first (up to) 64bits of the values (i.e. indexes 0 to 7).
Definition nethash.cpp:242
uint32_t crc32(const uint8_t *buf, size_t len)
Definition nethash.cpp:166
uint16_t csum16(const uint8_t *buf, size_t len)
16-bit ones' complement checksum (used in IP, TCP, UDP, ...).
Definition nethash.cpp:178
uint16_t xor16(const uint8_t *buf, size_t len)
A 16-bit xor of the values.
Definition nethash.cpp:222
uint16_t crc16(const uint8_t *buf, size_t len)
CRC-16 used in BMv2 (parameters: bit-reflection, polynomial 0x8005, init = 0 and xor_out = 0).
Definition nethash.cpp:158
Inja.
Definition targets/bmv2/cmd_stepper.cpp:33