-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsdnetProgram.h
75 lines (59 loc) · 1.45 KB
/
sdnetProgram.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* Copyright 2019 Seungbin Song
*/
#ifndef PSDN_SDNET_PROGRAM_H
#define PSDN_SDNET_PROGRAM_H
#include "lib/cstring.h"
#include "ir/ir.h"
namespace PSDN {
namespace SDNet {
class Tuple {
public:
cstring name;
cstring direction;
cstring body;
Tuple() : name(""), direction(""), body("") {}
Tuple(cstring name, cstring direction, cstring body)
: name(name), direction(direction), body(body) {}
cstring emit();
};
class Section {
public:
unsigned number;
cstring name;
cstring structDecl;
std::vector<cstring> mapDecl;
std::vector<cstring> methodUpdate;
cstring methodMove;
int methodIncrement;
Section() : number(0), name(""), structDecl(""),
methodMove(""), methodIncrement(0) {}
cstring emit();
};
class TupleEngine {
public:
cstring name;
cstring externalStructDecl;
std::vector<Tuple*> tuples;
std::vector<Section*> sections;
};
class LookupEngine {
public:
cstring name;
cstring matchType;
unsigned capacity;
unsigned keyWidth;
unsigned valueWidth;
unsigned responseType;
bool external;
Tuple* requestTuple;
Tuple* responseTuple;
cstring emit();
LookupEngine() : name(""), matchType(""), capacity(64),
keyWidth(0), valueWidth(0), responseType(1), external(false) {}
};
cstring addIndent(cstring str, unsigned n = 1);
unsigned getMaxPacketRegion(const IR::Type_ArchBlock* block);
};
}; //namespace PSDN
#endif