P4C
The P4 Compiler
Loading...
Searching...
No Matches
hash_dist.h
1
17
18#ifndef BACKENDS_TOFINO_BF_ASM_HASH_DIST_H_
19#define BACKENDS_TOFINO_BF_ASM_HASH_DIST_H_
20
21#include <vector>
22
23#include "asm-types.h"
24
25class Stage;
26class Table;
27
28/* config for a hash distribution unit in match central.
29 * FIXME -- need to abstract this away rather than have it be explicit
30 * FIXME -- in the asm code */
31
32struct HashDistribution {
33 // FIXME -- need less 'raw' data for this */
34 Table *tbl = 0;
35 int lineno = -1;
36 int hash_group = -1, id = -1;
37 int shift = 0, mask = 0, expand = -1;
38 bool meter_pre_color = false;
39 int meter_mask_index = 0;
40 enum {
41 IMMEDIATE_HIGH = 1 << 0,
42 IMMEDIATE_LOW = 1 << 1,
43 METER_ADDRESS = 1 << 2,
44 STATISTICS_ADDRESS = 1 << 3,
45 ACTION_DATA_ADDRESS = 1 << 4,
46 HASHMOD_DIVIDEND = 1 << 5
47 };
48 unsigned xbar_use = 0;
49 enum delay_type_t { SELECTOR = 0, OTHER = 1 };
50 delay_type_t delay_type = SELECTOR;
51 bool non_linear = false;
52 HashDistribution(int id, value_t &data, unsigned u = 0);
53 static void parse(std::vector<HashDistribution> &out, const value_t &v, unsigned u = 0);
54 bool compatible(HashDistribution *a);
55 void pass1(Table *tbl, delay_type_t dt, bool nl);
56 void pass2(Table *tbl);
57 template <class REGS>
58 void write_regs(REGS &regs, Table *);
59};
60
61#endif /* BACKENDS_TOFINO_BF_ASM_HASH_DIST_H_ */
Definition stage.h:123
Definition tables.h:98
Definition asm-types.h:114