标签:class alt ef6 system line data .data ast length
1 #ifndef _DATASTRUCS_H__ 2 #define _DATASTRUCS_H__ 3 4 #include <systemc.h> 5 #include "GlobalParams.h" 6 7 ................省略内容 8 9 #endif
1 // Coord -- XY coordinates type of the Tile inside the Mesh 2 class Coord { 3 public: 4 int x; // X coordinate 5 int y; // Y coordinate 6 //操作符重载,调用方式if(c1 == c2) 7 //括号中的const表示参数coord对象不会被修改,最后的const表明调用函数对象不会被修改 8 inline bool operator ==(const Coord & coord) const { 9 return (coord.x == x && coord.y == y); 10 }};
1 // FlitType -- Flit type enumeration 2 enum FlitType { 3 FLIT_TYPE_HEAD, FLIT_TYPE_BODY, FLIT_TYPE_TAIL 4 };
payload可以是flit,也可以是credit
1 // Payload -- Payload definition 2 struct Payload { 3 //sc_uint为无符号整数类型 4 sc_uint<32> data; // Bus for the data to be exchanged 5 6 inline bool operator ==(const Payload & payload) const { 7 return (payload.data == data); 8 }};
1 // Packet -- Packet definition 2 struct Packet { 3 int src_id; 4 int dst_id; 5 double timestamp; // SC timestamp at packet generation 6 int size; 7 int flit_left; // Number of remaining flits inside the packet 8 bool use_low_voltage_path; 9 10 // Constructors 11 Packet() { } 12 13 Packet(const int s, const int d, const double ts, const int sz) { 14 make(s, d, ts, sz); 15 } 16 //初始化packet 17 void make(const int s, const int d, const double ts, const int sz) { 18 src_id = s; 19 dst_id = d; 20 timestamp = ts; 21 size = sz; 22 flit_left = sz; 23 use_low_voltage_path = false; 24 } 25 };
1 // Flit -- Flit definition 2 struct Flit { 3 int src_id; 4 int dst_id; 5 FlitType flit_type; // The flit type (FLIT_TYPE_HEAD, FLIT_TYPE_BODY, FLIT_TYPE_TAIL) 6 int sequence_no; // The sequence number of the flit inside the packet 7 int sequence_length; 8 Payload payload; // Optional payload 9 double timestamp; // Unix timestamp at packet generation 10 int hop_no; // Current number of hops from source to destination 11 bool use_low_voltage_path; 12 //操作符重载 13 inline bool operator ==(const Flit & flit) const { 14 return (flit.src_id == src_id && flit.dst_id == dst_id 15 && flit.flit_type == flit_type 16 && flit.sequence_no == sequence_no 17 && flit.sequence_length == sequence_length 18 && flit.payload == payload && flit.timestamp == timestamp 19 && flit.hop_no == hop_no 20 && flit.use_low_voltage_path == use_low_voltage_path); 21 }};
1 // RouteData -- data required to perform routing 2 struct RouteData { 3 int current_id; 4 int src_id; 5 int dst_id; 6 int dir_in; // direction from which the packet comes from 7 };
1 struct ChannelStatus { 2 int free_slots; // occupied buffer slots 3 bool available; // 4 5 inline bool operator ==(const ChannelStatus & bs) const { 6 return (free_slots == bs.free_slots && available == bs.available); 7 }; 8 };
标签:class alt ef6 system line data .data ast length
原文地址:https://www.cnblogs.com/cpsmile/p/9704184.html