a2901_test.cpp revision 12855:588919e0e4aa
1/*****************************************************************************
2
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements.  See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License.  You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied.  See the License for the specific language governing
16  permissions and limitations under the License.
17
18 *****************************************************************************/
19
20/*****************************************************************************
21
22  a2901_test.cpp --
23
24  Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
25
26 *****************************************************************************/
27
28/*****************************************************************************
29
30  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
31  changes you are making here.
32
33      Name, Affiliation, Date:
34  Description of Modification:
35
36 *****************************************************************************/
37
38#include "a2901_test.h"
39
40void
41a2901_test::entry()
42{
43      switch (vec_cnt++) {
44      case 0:
45	I.    write(0x7);
46	D.    write(  0);
47	C0.   write(  0);
48	OEbar.write(  0);
49	break;
50      case 1:
51	I.    write(0x46);
52	D.    write(   0);
53	C0.   write(   0);
54	OEbar.write(   0);
55	break;
56      case 2:
57	if (Y.read() != 0x0) fprintf(stderr,"Y != 4'b0000 (%0d)\n", (int)Y.read());
58	if (C4.read() != 0x0) fprintf(stderr,"C4 != 1'b0\n");
59	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
60	if (Pbar.read() != 0x1) fprintf(stderr,"Pbar != 1'b1\n");
61	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
62	if (F3.read() != 0x0) fprintf(stderr,"F3 != 1'b0\n");
63	if (F30.read() != 0x1) fprintf(stderr,"F30 != 1'b1 (%0d)\n", (int)F30.read());
64
65	I.write(0x7);
66	D.write(0x0);
67	C0.write(0x0);
68	OEbar.write(0x0);
69
70	break;
71      case 3:
72	I.write(0x46);
73	D.write(0x0);
74	C0.write(0x1);
75	OEbar.write(0x0);
76	break;
77      case 4:
78	if (Y.read() != 0x1) fprintf(stderr,"Y != 4'b0001\n");
79	if (C4.read() != 0x0) fprintf(stderr,"C4 != 1'b0\n");
80	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
81	if (Pbar.read() != 0x1) fprintf(stderr,"Pbar != 1'b1\n");
82	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
83	if (F3.read() != 0x0) fprintf(stderr,"F3 != 1'b0\n");
84	if (F30.read() != 0x0) fprintf(stderr,"F30 != 1'b0\n");
85
86	I.write(0x7);
87	D.write(0xf);					// N("4'b1111")
88	C0.write(0x0);
89	OEbar.write(0x0);
90
91	break;
92      case 5:
93	I.write(0x46);
94	D.write(0x0);
95	C0.write(0x0);
96	OEbar.write(0x0);
97
98	break;
99      case 6:
100	if (Y.read() != 0xf) fprintf(stderr,"Y != 4'b1111\n");
101	if (C4.read() != 0x0) fprintf(stderr,"C4 != 1'b0\n");
102	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
103	if (Pbar.read() != 0x0) fprintf(stderr,"Pbar != 1'b0\n");
104	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
105	if (F3.read() != 0x1) fprintf(stderr,"F3 != 1'b1\n");
106	if (F30.read() != 0x0) fprintf(stderr,"F30 != 1'b0\n");
107
108	I.write(0x7);
109	D.write(0xf);
110	C0.write(0x0);
111	OEbar.write(0x0);
112
113	break;
114      case 7:
115	I.write(0x46);
116	D.write(0x0);
117	C0.write(0x1);
118	OEbar.write(0x0);
119	break;
120      case 8:
121	if (Y.read() != 0x0) fprintf(stderr,"Y != 4'b0000\n");
122	if (C4.read() != 0x1) fprintf(stderr,"C4 != 1'b1\n");
123	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
124	if (Pbar.read() != 0x0) fprintf(stderr,"Pbar != 1'b0\n");
125	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
126	if (F3.read() != 0x0) fprintf(stderr,"F3 != 1'b0\n");
127	if (F30.read() != 0x1) fprintf(stderr,"F30 != 1'b1\n");
128
129	I.write(0x7);
130	D.write(0xf);
131	C0.write(0x0);
132	OEbar.write(0x0);
133	break;
134      case 9:
135	I.write(0x46);
136	D.write(0xf);
137	C0.write(0x0);
138	OEbar.write(0x0);
139	break;
140      case 10:
141	if (Y.read() != 0xe) fprintf(stderr,"Y != 4'b1110\n");
142	if (C4.read() != 0x1) fprintf(stderr,"C4 != 1'b1\n");
143	if (Gbar.read() != 0x0) fprintf(stderr,"Gbar != 1'b0\n");
144	if (Pbar.read() != 0x0) fprintf(stderr,"Pbar != 1'b0\n");
145	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
146	if (F3.read() != 0x1) fprintf(stderr,"F3 != 1'b1\n");
147	if (F30.read() != 0x0) fprintf(stderr,"F30 != 1'b0\n");
148
149	I.write(0x7);
150	D.write(0xf);
151	C0.write(0x0);
152	OEbar.write(0x0);
153	break;
154      case 11:
155	I.write(0x46);
156	D.write(0xf);
157	C0.write(0x1);
158	OEbar.write(0x0);
159	break;
160      case 12:
161	if (Y.read() != 0xf) fprintf(stderr,"Y != 4'b1111\n");
162	if (C4.read() != 0x1) fprintf(stderr,"C4 != 1'b1\n");
163	if (Gbar.read() != 0x0) fprintf(stderr,"Gbar != 1'b0\n");
164	if (Pbar.read() != 0x0) fprintf(stderr,"Pbar != 1'b0\n");
165	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
166	if (F3.read() != 0x1) fprintf(stderr,"F3 != 1'b1\n");
167	if (F30.read() != 0x0) fprintf(stderr,"F30 != 1'b0\n");
168
169	I .write( 0x7);
170	D .write( 0x0);
171	C0 .write( 0x0);
172	OEbar .write( 0x0);
173	break;
174      case 13:
175	I .write( 0x46);
176	D .write( 0xf);
177	C0 .write( 0x0);
178	OEbar .write( 0x0);
179	break;
180      case 14:
181	if (Y.read() != 0xf) fprintf(stderr,"Y != 4'b1111\n");
182	if (C4.read() != 0x0) fprintf(stderr,"C4 != 1'b0\n");
183	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
184	if (Pbar.read() != 0x0) fprintf(stderr,"Pbar != 1'b0\n");
185	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
186	if (F3.read() != 0x1) fprintf(stderr,"F3 != 1'b1\n");
187	if (F30.read() != 0x0) fprintf(stderr,"F30 != 1'b0\n");
188
189	I .write( 0x7);
190	D .write( 0x0);
191	C0 .write( 0x0);
192	OEbar .write( 0x0);
193	break;
194      case 15:
195	I .write( 0x46);
196	D .write( 0xf);
197	C0 .write( 0x1);
198	OEbar .write( 0x0);
199	break;
200      case 16:
201	if (Y.read() != 0x0) fprintf(stderr,"Y != 4'b0000\n");
202	if (C4.read() != 0x1) fprintf(stderr,"C4 != 1'b1\n");
203	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
204	if (Pbar.read() != 0x0) fprintf(stderr,"Pbar != 1'b0\n");
205	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
206	if (F3.read() != 0x0) fprintf(stderr,"F3 != 1'b0\n");
207	if (F30.read() != 0x1) fprintf(stderr,"F30 != 1'b1\n");
208
209	I .write( 0x7);
210	D .write( 0x1);
211	C0 .write( 0x0);
212	OEbar .write( 0x0);
213	break;
214      case 17:
215	I .write( 0x6);
216	D .write( 0x1);
217	C0 .write( 0x0);
218	OEbar .write( 0x0);
219	break;
220      case 18:
221	if (Y.read() != 0x2) fprintf(stderr,"Y != 4'b0010\n");
222	if (C4.read() != 0x0) fprintf(stderr,"C4 != 1'b0\n");
223	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
224	if (Pbar.read() != 0x1) fprintf(stderr,"Pbar != 1'b1\n");
225	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
226	if (F3.read() != 0x0) fprintf(stderr,"F3 != 1'b0\n");
227	if (F30.read() != 0x0) fprintf(stderr,"F30 != 1'b0\n");
228
229	I .write( 0x7);
230	D .write( 0x2);					// N("4'b0010")
231	C0 .write( 0x0);
232	OEbar .write( 0x0);
233	break;
234      case 19:
235	I .write( 0x46);
236	D .write( 0x2);
237	C0 .write( 0x0);
238	OEbar .write( 0x0);
239	break;
240      case 20:
241	if (Y.read() != 0x4) fprintf(stderr,"Y != 4'b0100\n");
242	if (C4.read() != 0x0) fprintf(stderr,"C4 != 1'b0\n");
243	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
244	if (Pbar.read() != 0x1) fprintf(stderr,"Pbar != 1'b1\n");
245	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
246	if (F3.read() != 0x0) fprintf(stderr,"F3 != 1'b0\n");
247	if (F30.read() != 0x0) fprintf(stderr,"F30 != 1'b0\n");
248
249	I .write( 0x7);
250	D .write( 0x4);
251	C0 .write( 0x0);
252	OEbar .write( 0x0);
253
254	break;
255      case 21:
256	I .write( 0x46);
257	D .write( 0x4);
258	C0 .write( 0x0);
259	OEbar .write( 0x0);
260	break;
261      case 22:
262	if (Y.read() != 0x8) fprintf(stderr,"Y != 4'b1000\n");
263	if (C4.read()!= 0x0) fprintf(stderr,"C4 != 1'b0\n");
264	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
265	if (Pbar.read() != 0x1) fprintf(stderr,"Pbar != 1'b1\n");
266	if (OVR.read() != 0x1) fprintf(stderr,"OVR != 1'b1\n");
267	if (F3.read() != 0x1) fprintf(stderr,"F3 != 1'b1\n");
268	if (F30.read() != 0x0) fprintf(stderr,"F30 != 1'b0\n");
269
270	I .write( 0x7);
271	D .write( 0x8);					// N("4'b1000")
272	C0 .write( 0x0);
273	OEbar .write( 0x0);
274	break;
275      case 23:
276	I .write( 0x46);
277	D .write( 0x8);
278	C0 .write( 0x0);
279	OEbar .write( 0x0);
280
281	break;
282      case 24:
283	if (Y.read() != 0x0) fprintf(stderr,"Y != 4'b0000\n");
284	if (C4.read() != 0x1) fprintf(stderr,"C4 != 1'b1\n");
285	if (Gbar.read() != 0x0) fprintf(stderr,"Gbar != 1'b0\n");
286	if (Pbar.read() != 0x1) fprintf(stderr,"Pbar != 1'b1\n");
287	if (OVR.read() != 0x1) fprintf(stderr,"OVR != 1'b1\n");
288	if (F3.read() != 0x0) fprintf(stderr,"F3 != 1'b0\n");
289	if (F30.read() != 0x1) fprintf(stderr,"F30 != 1'b1\n");
290
291	// ******** SUBTRACTION S - R ********
292	I .write( 0x7);
293	D .write( 0x0);
294	C0 .write( 0x0);
295	OEbar .write( 0x0);
296	break;
297      case 25:
298	I .write( 0x4e);					// N("9'b001001110")
299	D .write( 0x0);
300	C0 .write( 0x0);
301	OEbar .write( 0x0);
302
303	break;
304      case 26:
305	if (Y.read() != 0xf) fprintf(stderr,"Y != 4'b1111\n");
306	if (C4.read() != 0x0) fprintf(stderr,"C4 != 1'b0\n");
307	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
308	if (Pbar.read() != 0x0) fprintf(stderr,"Pbar != 1'b0\n");
309	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
310	if (F3.read() != 0x1) fprintf(stderr,"F3 != 1'b1\n");
311	if (F30.read() != 0x0) fprintf(stderr,"F30 != 1'b0\n");
312
313	I .write( 0x7);
314	D .write( 0x0);
315	C0 .write( 0x0);
316	OEbar .write( 0x0);
317	break;
318      case 27:
319	I .write( 0x4e);
320	D .write( 0x0);
321	C0 .write( 0x1);
322	OEbar .write( 0x0);
323	break;
324      case 28:
325	if (Y.read() != 0x0) fprintf(stderr,"Y != 4'b0000\n");
326	if (C4.read() != 0x1) fprintf(stderr,"C4 != 1'b1\n");
327	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
328	if (Pbar.read() != 0x0) fprintf(stderr,"Pbar != 1'b0\n");
329	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
330	if (F3.read() != 0x0) fprintf(stderr,"F3 != 1'b0\n");
331	if (F30.read() != 0x1) fprintf(stderr,"F30 != 1'b1\n");
332
333	I .write( 0x7);
334	D .write( 0x0);
335	C0 .write( 0x0);
336	OEbar .write( 0x0);
337	break;
338      case 29:
339	I .write( 0x4e);
340	D .write( 0xf);
341	C0 .write( 0x0);
342	OEbar .write( 0x0);
343	break;
344      case 30:
345	if (Y.read() != 0x0) fprintf(stderr,"Y != 4'b0000\n");
346	if (C4.read() != 0x0) fprintf(stderr,"C4 != 1'b0\n");
347	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
348	if (Pbar.read() != 0x1) fprintf(stderr,"Pbar != 1'b1\n");
349	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
350	if (F3.read() != 0x0) fprintf(stderr,"F3 != 1'b0\n");
351	if (F30.read() != 0x1) fprintf(stderr,"F30 != 1'b1\n");
352
353	I .write( 0x7);
354	D .write( 0x0);
355	C0 .write( 0x0);
356	OEbar .write( 0x0);
357	break;
358      case 31:
359	I .write( 0x4e);
360	D .write( 0xf);
361	C0 .write( 0x1);
362	OEbar .write( 0x0);
363
364	break;
365      case 32:
366	if (Y.read() != 0x1) fprintf(stderr,"Y != 4'b0001\n");
367	if (C4.read() != 0x0) fprintf(stderr,"C4 != 1'b0\n");
368	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
369	if (Pbar.read() != 0x1) fprintf(stderr,"Pbar != 1'b1\n");
370	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
371	if (F3.read() != 0x0) fprintf(stderr,"F3 != 1'b0\n");
372	if (F30.read() != 0x0) fprintf(stderr,"F30 != 1'b0\n");
373
374	I .write( 0x7);
375	D .write( 0xf);
376	C0 .write( 0x0);
377	OEbar .write( 0x0);
378
379	break;
380      case 33:
381	I .write( 0x4e);
382	D .write( 0xf);
383	C0 .write( 0x0);
384	OEbar .write( 0x0);
385
386	break;
387      case 34:
388	if (Y.read() != 0xf) fprintf(stderr,"Y != 4'b1111\n");
389	if (C4.read() != 0x0) fprintf(stderr,"C4 != 1'b0\n");
390	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
391	if (Pbar.read() != 0x0) fprintf(stderr,"Pbar != 1'b0\n");
392	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
393	if (F3.read() != 0x1) fprintf(stderr,"F3 != 1'b1\n");
394	if (F30.read() != 0x0) fprintf(stderr,"F30 != 1'b0\n");
395
396	I .write( 0x7);
397	D .write( 0xf);
398	C0 .write( 0x0);
399	OEbar .write( 0x0);
400	break;
401      case 35:
402	I .write( 0x4e);
403	D .write( 0xf);
404	C0 .write( 0x1);
405	OEbar .write( 0x0);
406
407	break;
408      case 36:
409	if (Y.read() != 0x0) fprintf(stderr,"Y != 4'b0000\n");
410	if (C4.read() != 0x1) fprintf(stderr,"C4 != 1'b1\n");
411	if (Gbar.read() != 0x1) fprintf(stderr,"Gbar != 1'b1\n");
412	if (Pbar.read() != 0x0) fprintf(stderr,"Pbar != 1'b0\n");
413	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
414	if (F3.read() != 0x0) fprintf(stderr,"F3 != 1'b0\n");
415	if (F30.read() != 0x1) fprintf(stderr,"F30 != 1'b1\n");
416
417	I .write( 0x7);
418	D .write( 0xf);
419	C0 .write( 0x0);
420	OEbar .write( 0x0);
421
422	break;
423      case 37:
424	I .write( 0x4e);
425	D .write( 0x0);
426	C0 .write( 0x0);
427	OEbar .write( 0x0);
428
429	break;
430      case 38:
431	if (Y.read() != 0xe) fprintf(stderr,"Y != 4'b1110\n");
432	if (C4.read() != 0x1) fprintf(stderr,"C4 != 1'b1\n");
433	if (Gbar.read() != 0x0) fprintf(stderr,"Gbar != 1'b0\n");
434	if (Pbar.read() != 0x0) fprintf(stderr,"Pbar != 1'b0\n");
435	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
436	if (F3.read() != 0x1) fprintf(stderr,"F3 != 1'b1\n");
437	if (F30.read() != 0x0) fprintf(stderr,"F30 != 1'b0\n");
438
439	I .write( 0x7);
440	D .write( 0xf);
441	C0 .write( 0x0);
442	OEbar .write( 0x0);
443	break;
444      case 39:
445	I .write( 0x4e);
446	D .write( 0x0);
447	C0 .write( 0x1);
448	OEbar .write( 0x0);
449	break;
450      case 40:
451	if (Y.read() != 0xf) fprintf(stderr,"Y != 4'b1111\n");
452	if (C4.read() != 0x1) fprintf(stderr,"C4 != 1'b1\n");
453	if (Gbar.read() != 0x0) fprintf(stderr,"Gbar != 1'b0\n");
454	if (Pbar.read() != 0x0) fprintf(stderr,"Pbar != 1'b0\n");
455	if (OVR.read() != 0x0) fprintf(stderr,"OVR != 1'b0\n");
456	if (F3.read() != 0x1) fprintf(stderr,"F3 != 1'b1\n");
457	if (F30.read() != 0x0) fprintf(stderr,"F30 != 1'b0\n");
458
459	I .write( 0x7);
460	D .write( 0x0); // 0x1;
461	C0 .write( 0x0);
462	OEbar .write( 0x0);
463
464	if (++loop < 100000)
465	  vec_cnt = 0;
466	else {
467          printf ("loops = %d\n", loop);
468	  sc_stop();
469        }
470	break;
471      }
472}
473