8 #ifndef LIBNEXUS_RV_MSG_TYPES_H
9 #define LIBNEXUS_RV_MSG_TYPES_H
17 #define NEXUS_RV_BITS_TCODE 6
19 #define NEXUS_RV_BITS_ETYPE 4
21 #define NEXUS_RV_BITS_RCODE 4
23 #define NEXUS_RV_BITS_EVCODE 4
25 #define NEXUS_RV_BITS_CDF 2
27 #define NEXUS_RV_BITS_ADDR_SYNC 4
29 #define NEXUS_RV_BITS_ADDR_BTYPE 2
31 #define NEXUS_RV_BITS_OWNERSHIP_FMT 2
33 #define NEXUS_RV_BITS_OWNERSHIP_PRV 2
35 #define NEXUS_RV_BITS_OWNERSHIP_V 1
37 #define NEXUS_RV_BITS_CKSRC 4
39 #define NEXUS_RV_BITS_CKDF 2
44 NEXUSRV_TCODE_Ownership = 2,
45 NEXUSRV_TCODE_DirectBranch = 3,
46 NEXUSRV_TCODE_IndirectBranch = 4,
47 NEXUSRV_TCODE_Error = 8,
48 NEXUSRV_TCODE_DataAcquisition = 7,
49 NEXUSRV_TCODE_ProgTraceSync = 9,
50 NEXUSRV_TCODE_DirectBranchSync = 11,
51 NEXUSRV_TCODE_IndirectBranchSync = 12,
52 NEXUSRV_TCODE_ResourceFull = 27,
53 NEXUSRV_TCODE_IndirectBranchHist = 28,
54 NEXUSRV_TCODE_IndirectBranchHistSync = 29,
55 NEXUSRV_TCODE_RepeatBranch = 30,
56 NEXUSRV_TCODE_ICT = 34,
57 NEXUSRV_TCODE_ProgTraceCorrelation = 33,
58 NEXUSRV_TCODE_VendorStart = 56,
59 NEXUSRV_TCODE_VendorLast = 62,
60 NEXUSRV_TCODE_Idle = 63,
63 static inline const char* nexusrv_tcode_str(
enum nexusrv_tcodes tcode) {
65 case NEXUSRV_TCODE_Ownership:
67 case NEXUSRV_TCODE_DirectBranch:
68 return "DirectBranch";
69 case NEXUSRV_TCODE_IndirectBranch:
70 return "IndirectBranch";
71 case NEXUSRV_TCODE_Error:
73 case NEXUSRV_TCODE_DataAcquisition:
74 return "DataAcquisition";
75 case NEXUSRV_TCODE_ProgTraceSync:
76 return "ProgTraceSync";
77 case NEXUSRV_TCODE_DirectBranchSync:
78 return "DirectBranchSync";
79 case NEXUSRV_TCODE_IndirectBranchSync:
80 return "IndirectBranchSync";
81 case NEXUSRV_TCODE_ResourceFull:
82 return "ResourceFull";
83 case NEXUSRV_TCODE_IndirectBranchHist:
84 return "IndirectBranchHist";
85 case NEXUSRV_TCODE_IndirectBranchHistSync:
86 return "IndirectBranchHistSync";
87 case NEXUSRV_TCODE_RepeatBranch:
88 return "RepeatBranch";
89 case NEXUSRV_TCODE_ICT:
91 case NEXUSRV_TCODE_ProgTraceCorrelation:
92 return "ProgTraceCorrelation";
93 case NEXUSRV_TCODE_Idle:
154 static inline bool nexusrv_msg_known(
const nexusrv_msg *msg) {
155 switch (msg->
tcode) {
156 case NEXUSRV_TCODE_Idle:
157 case NEXUSRV_TCODE_ResourceFull:
158 case NEXUSRV_TCODE_DirectBranch:
159 case NEXUSRV_TCODE_DirectBranchSync:
160 case NEXUSRV_TCODE_IndirectBranch:
161 case NEXUSRV_TCODE_IndirectBranchSync:
162 case NEXUSRV_TCODE_IndirectBranchHist:
163 case NEXUSRV_TCODE_IndirectBranchHistSync:
164 case NEXUSRV_TCODE_RepeatBranch:
165 case NEXUSRV_TCODE_Error:
166 case NEXUSRV_TCODE_DataAcquisition:
167 case NEXUSRV_TCODE_Ownership:
168 case NEXUSRV_TCODE_ProgTraceSync:
170 case NEXUSRV_TCODE_ProgTraceCorrelation:
172 case NEXUSRV_TCODE_ICT:
173 return msg->
cksrc < 2;
179 static inline bool nexusrv_msg_idle(
const nexusrv_msg *msg) {
180 return msg->
tcode == NEXUSRV_TCODE_Idle;
183 static inline bool nexusrv_msg_has_src(
const nexusrv_msg *msg) {
184 return !nexusrv_msg_idle(msg);
187 static inline bool nexusrv_msg_is_branch(
const nexusrv_msg *msg) {
188 switch (msg->
tcode) {
189 case NEXUSRV_TCODE_DirectBranch:
190 case NEXUSRV_TCODE_DirectBranchSync:
191 case NEXUSRV_TCODE_IndirectBranch:
192 case NEXUSRV_TCODE_IndirectBranchSync:
193 case NEXUSRV_TCODE_IndirectBranchHist:
194 case NEXUSRV_TCODE_IndirectBranchHistSync:
201 static inline bool nexusrv_msg_is_indir_branch(
const nexusrv_msg *msg) {
202 switch (msg->
tcode) {
203 case NEXUSRV_TCODE_IndirectBranch:
204 case NEXUSRV_TCODE_IndirectBranchSync:
205 case NEXUSRV_TCODE_IndirectBranchHist:
206 case NEXUSRV_TCODE_IndirectBranchHistSync:
213 static inline bool nexusrv_msg_is_res(
const nexusrv_msg *msg) {
214 return msg->
tcode == NEXUSRV_TCODE_ResourceFull;
217 static inline bool nexusrv_msg_is_sync(
const nexusrv_msg *msg) {
218 switch (msg->
tcode) {
219 case NEXUSRV_TCODE_DirectBranchSync:
220 case NEXUSRV_TCODE_IndirectBranchSync:
221 case NEXUSRV_TCODE_IndirectBranchHistSync:
222 case NEXUSRV_TCODE_ProgTraceSync:
229 static inline bool nexusrv_msg_is_error(
const nexusrv_msg *msg) {
230 return msg->
tcode == NEXUSRV_TCODE_Error;
233 static inline bool nexusrv_msg_is_stop(
const nexusrv_msg *msg) {
234 return msg->
tcode == NEXUSRV_TCODE_ProgTraceCorrelation;
237 static inline bool nexusrv_msg_is_data_acq(
const nexusrv_msg *msg) {
238 return msg->
tcode == NEXUSRV_TCODE_DataAcquisition;
241 static inline bool nexusrv_msg_has_icnt(
const nexusrv_msg *msg) {
242 switch (msg->
tcode) {
243 case NEXUSRV_TCODE_ResourceFull:
245 case NEXUSRV_TCODE_DirectBranch:
246 case NEXUSRV_TCODE_DirectBranchSync:
247 case NEXUSRV_TCODE_IndirectBranch:
248 case NEXUSRV_TCODE_IndirectBranchSync:
249 case NEXUSRV_TCODE_IndirectBranchHist:
250 case NEXUSRV_TCODE_IndirectBranchHistSync:
251 case NEXUSRV_TCODE_ProgTraceSync:
252 case NEXUSRV_TCODE_ProgTraceCorrelation:
259 static inline bool nexusrv_msg_has_xaddr(
const nexusrv_msg *msg) {
260 switch (msg->
tcode) {
261 case NEXUSRV_TCODE_IndirectBranch:
262 case NEXUSRV_TCODE_IndirectBranchSync:
263 case NEXUSRV_TCODE_IndirectBranchHist:
264 case NEXUSRV_TCODE_IndirectBranchHistSync:
265 case NEXUSRV_TCODE_DirectBranchSync:
266 case NEXUSRV_TCODE_ProgTraceSync:
273 static inline bool nexusrv_msg_has_hist(
const nexusrv_msg *msg) {
274 switch (msg->
tcode) {
275 case NEXUSRV_TCODE_ResourceFull:
277 case NEXUSRV_TCODE_ProgTraceCorrelation:
278 return msg->
cdf == 1;
279 case NEXUSRV_TCODE_IndirectBranchHist:
280 case NEXUSRV_TCODE_IndirectBranchHistSync:
287 static inline bool nexusrv_msg_known_rescode(uint8_t rescode) {
291 static inline unsigned nexusrv_msg_hist_bits(uint32_t hist) {
294 return sizeof(long) * 8 - 1 - __builtin_clzl(hist);
struct nexusrv_msg nexusrv_msg
Decoded NexusRV Message.
nexusrv_tcodes
TCODE enumeration.
Definition: msg-types.h:43
Decoded NexusRV Message.
Definition: msg-types.h:102
uint8_t tcode
Definition: msg-types.h:105
uint32_t error_code
Definition: msg-types.h:136
uint32_t icnt
Definition: msg-types.h:135
uint64_t context
Definition: msg-types.h:148
uint8_t branch_type
Definition: msg-types.h:109
uint8_t ownership_priv
Definition: msg-types.h:123
uint8_t ownership_fmt
Definition: msg-types.h:122
uint8_t ownership_v
Definition: msg-types.h:124
uint64_t ckdata0
Definition: msg-types.h:144
uint32_t hrepeat
Definition: msg-types.h:142
uint8_t idtag
Definition: msg-types.h:127
uint16_t src
Definition: msg-types.h:104
uint64_t dqdata
Definition: msg-types.h:149
uint8_t res_code
Definition: msg-types.h:115
uint8_t sync_type
Definition: msg-types.h:108
uint8_t cdf
Definition: msg-types.h:119
uint64_t xaddr
Definition: msg-types.h:147
uint32_t res_data
Definition: msg-types.h:137
uint8_t stop_code
Definition: msg-types.h:118
uint32_t hist
Definition: msg-types.h:141
uint64_t timestamp
Definition: msg-types.h:103
uint64_t ckdata1
Definition: msg-types.h:150
uint8_t ckdf
Definition: msg-types.h:131
uint8_t error_type
Definition: msg-types.h:112
uint8_t cksrc
Definition: msg-types.h:130