check transfer  0.1
Check data transfer for SDAccell OpenCL application
check_cnt.cl
Go to the documentation of this file.
1 
2 
3 static bool check_data64( ulong data_i, ulong expect );
4 
5 
6 __kernel
7 __attribute__ ((reqd_work_group_size(1,1,1)))
8 void check_cnt(__global ulong8 * __restrict input0,
9  __global uint16 * __restrict pStatus,
10  const ulong8 expect,
11  const uint size
12  )
13 {
14 
15 
16  ulong ii;
17  uint flagError=0;
18  uint blockRd;
19  uint blockOk;
20  uint blockError;
21 
22 
23  ulong8 temp0, temp1;
24 
25  uint16 checkStatus;
26 
27  bool flag0;
28  bool flag1;
29  bool flag2;
30  bool flag3;
31  bool flag4;
32  bool flag5;
33  bool flag6;
34  bool flag7;
35 
36  bool word_error;
37  uint cnt_error=0;
38 
39  checkStatus = *pStatus;
40 
41  blockRd = checkStatus.s1;
42  blockOk = checkStatus.s2;
43  blockError = checkStatus.s3;
44  //printf( "krnl - %.4x %d %d %d \n", checkStatus.s0, blockRd, blockOk, blockError );
45 
46 
47  temp1 = expect;
48 
49 // printf( "krnl: input0=%p\n", input0 );
50 // printf( "krnl: pStatus=%p\n", pStatus);
51 // printf( "krnl: size=%d\n", size);
52 //
53 // //for( int ii=0; ii<8; ii++ )
54 // printf( "krnl: expect(%X)= %lX\n", 0, temp1.s0 );
55 // printf( "krnl: expect(%X)= %lX\n", 1, temp1.s1 );
56 // printf( "krnl: expect(%X)= %lX\n", 2, temp1.s2 );
57 // printf( "krnl: expect(%X)= %lX\n", 3, temp1.s3 );
58 // printf( "krnl: expect(%X)= %lX\n", 4, temp1.s4 );
59 // printf( "krnl: expect(%X)= %lX\n", 5, temp1.s5 );
60 // printf( "krnl: expect(%X)= %lX\n", 6, temp1.s6 );
61 // printf( "krnl: expect(%X)= %lX\n", 7, temp1.s7 );
62 
63 
64  __attribute__((xcl_pipeline_loop))
65 
66  for (ii=0; ii<size; ii++)
67  {
68 
69  word_error=0;
70  temp0 = input0[ii];
71 
72  flag0 = check_data64( temp0.s0, temp1.s0 );
73  flag1 = check_data64( temp0.s1, temp1.s1 );
74  flag2 = check_data64( temp0.s2, temp1.s2 );
75  flag3 = check_data64( temp0.s3, temp1.s3 );
76  flag4 = check_data64( temp0.s4, temp1.s4 );
77  flag5 = check_data64( temp0.s5, temp1.s5 );
78  flag6 = check_data64( temp0.s6, temp1.s6 );
79  flag7 = check_data64( temp0.s7, temp1.s7 );
80 
81  if( flag0 || flag1 || flag2 || flag3 || flag4 || flag5 || flag6 || flag7 )
82  {
83  flagError=1;
84  word_error=1;
85  cnt_error++;
86 
87  }
88 
89 
90 // if( word_error && cnt_error<4 )
91 // {
92 // printf( "0: %.4X %.4X %.4X %.4X %.4X %.4X %.4X %.4X ii=%d\n",
93 // temp0.s0,
94 // temp0.s1,
95 // temp0.s2,
96 // temp0.s3,
97 // temp0.s4,
98 // temp0.s5,
99 // temp0.s6,
100 // temp0.s7,
101 // ii
102 // );
103 //
104 // printf( "1: %.4X %.4X %.4X %.4X %.4X %.4X %.4X %.4X %d\n\n",
105 // temp1.s0,
106 // temp1.s1,
107 // temp1.s2,
108 // temp1.s3,
109 // temp1.s4,
110 // temp1.s5,
111 // temp1.s6,
112 // temp1.s7,
113 // word_error
114 //
115 // );
116 // }
117 
118  temp1.s0 +=8;
119  temp1.s1 +=8;
120  temp1.s2 +=8;
121  temp1.s3 +=8;
122  temp1.s4 +=8;
123  temp1.s5 +=8;
124  temp1.s6 +=8;
125  temp1.s7 +=8;
126 
127  }
128 
129  if( flagError )
130  blockError++;
131  else
132  blockOk++;
133 
134  blockRd++;
135  checkStatus.s0 = 0xAA55;
136  checkStatus.s1 = blockRd;
137  checkStatus.s2 = blockOk;
138  checkStatus.s3 = blockError;
139 
140  *pStatus = checkStatus;
141 
142  //printf( "krnl - %.4x %d %d %d - Ok\n", checkStatus.s0, blockRd, blockOk, blockError );
143 }
144 
145 
146 
147 static bool check_data64( ulong data_i, ulong expect )
148 {
149  bool ret;
150 
151  if( data_i==expect )
152  ret=0;
153  else
154  ret=1;
155 
156  return ret;
157 }