P4C
The P4 Compiler
Loading...
Searching...
No Matches
super_cluster_builder.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_TEST_UTILS_SUPER_CLUSTER_BUILDER_H_
20#define BACKENDS_TOFINO_BF_P4C_TEST_UTILS_SUPER_CLUSTER_BUILDER_H_
21
22#include <algorithm>
23#include <cctype>
24#include <iostream>
25#include <istream>
26#include <optional>
27#include <sstream>
28#include <string>
29
30#include "bf-p4c/ir/bitrange.h"
31#include "bf-p4c/phv/allocate_phv.h"
32#include "bf-p4c/phv/utils/utils.h"
33
36 public:
39
43 // The format of the file is as follows:
44 // SUPERCLUSTER Uid: <uid>\n
45 // <slice lists>\n
46 // <rotational clusters>\n
47 //
48 // <uid> ::= <number>
49 // <slice lists> ::= slice lists: <lists of slices>
50 // <lists of slices> ::=
51 // <lists of slices> ::= [ <slices> ]\n<list of slices>
52 // <slices> ::=
53 // <slices> ::= <slice>\n<slices>
54 // <rotational clusters> ::= rotational clusters: { }
55 // <rotational clusters> ::= rotational clusters:\n<list of rotational clusters>
56 // <list of rotational clusters> ::=
57 // <list of rotational clusters> ::= <rotational cluster>\n<list of rotational clusters>
58 // <rotational cluster> ::= [<aligned cluster><aligned cluster continued>]
59 // <aligned cluster continued> ::=
60 // <aligned cluster continued> ::= , <aligned cluster><aligned cluster continued>
61 // <aligned cluster> ::= [<slice><slice continued>]
62 // <slice continued> ::=
63 // <slice continued> ::= , <slice><slice continued>
64 // <slice> ::= <field> <optional field attributes> <field range>
65 // <field> ::= <identifier>'<'<number>'>'
66 // <field range> ::= [<number>:<number>]
67 // For possible optional field attributes see phv/phv_fields.cpp
68 // method std::ostream &operator<<(std::ostream &out, const PHV::FieldSlice& fs)
69 std::optional<PHV::SuperCluster *> build_super_cluster(std::istream &scs);
70
71 private:
80
83
87 std::optional<PHV::SuperCluster *> analyze_super_cluster(std::istream &scs);
91 PHV::SuperCluster::SliceList *analyze_slice_list(std::istream &scs);
95 PHV::RotationalCluster *analyze_rotational_cluster(std::istream &scs);
99 PHV::AlignedCluster *analyze_aligned_cluster(std::string &str);
103 PHV::FieldSlice *analyze_field_slice(std::string &str);
104};
105
106#endif /* BACKENDS_TOFINO_BF_P4C_TEST_UTILS_SUPER_CLUSTER_BUILDER_H_ */
Definition ordered_map.h:32
Definition phv/utils/utils.h:789
Definition phv_fields.h:898
Definition phv/utils/utils.h:939
A helpfull class for building SuperClusters.
Definition super_cluster_builder.h:35
SuperClusterBuilder()
Constructor.
Definition super_cluster_builder.h:38
std::optional< PHV::SuperCluster * > build_super_cluster(std::istream &scs)
Definition super_cluster_builder.cpp:82