-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflit.cc
More file actions
70 lines (63 loc) · 1.19 KB
/
flit.cc
File metadata and controls
70 lines (63 loc) · 1.19 KB
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
#include "flit.h"
ostream& operator<<(ostream& os, const flit_template & ft)
{
os<<ft.flit_id_<<"::"<<static_cast<long> (ft.type_)<<":";
long j = ft.sor_addr_.size();
for(long i = 0 ; i <j; i++) {
os << ft.sor_addr_[i]<<" ";
}
for(long i = 0 ; i <j; i++) {
os << ft.des_addr_[i]<<" ";
} os<<endl;
return os;
}
flit_template::flit_template():
flit_id_(),
type_(HEADER_),
sor_addr_(),
des_addr_(),
start_time_(),
finish_time_(),
data_()
{
}
flit_template::flit_template(long a, flit_type b, add_type & c,
add_type & d, time_type e, const Data_type & f):
flit_id_(a),
type_(b),
sor_addr_(c),
des_addr_(d),
start_time_(e),
data_(f)
{
}
flit_template::flit_template(const flit_template & a):
flit_id_(a.flit_id()),
type_(a.type()),
sor_addr_(a.sor_addr()),
des_addr_(a.des_addr()),
start_time_(a.start_time()),
finish_time_(a.finish_time()),
data_(a.data())
{
}
//changed at 2020-5-9
bool isHeader(flit_type ft)
{
return ft==HEADER_||ft==SINGLE;
}
bool isTail(flit_type ft)
{
return ft==TAIL_||ft==SINGLE;
}
//changed at 2020-5-23
ostream&operator<<(ostream&os,const add_type&address)
{
bool b=true;
for(auto&x:address){
if(b)b=false;
else os<<' ';
os<<x;
}
return os;
}