OpenCores
URL https://opencores.org/ocsvn/z3/z3/trunk

Subversion Repositories z3

[/] [z3/] [trunk/] [benchmark/] [benchmark.inf] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 charcole
[Ackermann
2
m n;
3
if (m==0)
4
        return n+1;
5
else if (n==0)
6
        return Ackermann(m-1,1);
7
else
8
        return Ackermann(m-1,Ackermann(m,n-1));
9
];
10
 
11
[AckermannBench
12
result i;
13
        @print "Ackermann Benchmark^";
14
        @print "Start^";
15
        @show_status;
16
        result=Ackermann(3,6);
17
        @print "End^";
18
        @show_status;
19
        @print "Result=";
20
        @print_num result;
21
        @new_line;
22
        @print "Start10^";
23
        @show_status;
24
        result=Ackermann(3,6);
25
        result=Ackermann(3,6);
26
        result=Ackermann(3,6);
27
        result=Ackermann(3,6);
28
        result=Ackermann(3,6);
29
        result=Ackermann(3,6);
30
        result=Ackermann(3,6);
31
        result=Ackermann(3,6);
32
        result=Ackermann(3,6);
33
        @print "End^^";
34
        @show_status;
35
];
36
 
37
Constant SIZE=8192;
38
 
39
Array flags -> SIZE+1;
40
 
41
[Sieve
42
iter count i prime k;
43
        @print "Sieve of Eratosthenes Benchmark^";
44
        @print "Start10^";
45
        @show_status;
46
        for (iter = 1: iter <= 10: iter++)
47
    {
48
      count = 0;
49
      for (i = 0: i <= SIZE: i++)
50
        i->flags = 1;
51
 
52
      for (i = 0: i <= SIZE: i++)
53
        {
54
          if (i->flags)
55
            {
56
              prime = i + i + 3;
57
              k = i + prime;
58
 
59
              while (k <= SIZE)
60
                {
61
                  k->flags = 0;
62
                  k = k + prime;
63
                }
64
 
65
              count++;
66
            }
67
        }
68
    }
69
        @print "End^";
70
        @show_status;
71
        @print "Count=";
72
        @print_num count;
73
        @new_line;
74
        @print "Start100^";
75
        @show_status;
76
        for (iter = 1: iter <= 100: iter++)
77
    {
78
      count = 0;
79
      for (i = 0: i <= SIZE: i++)
80
        i->flags = 1;
81
 
82
      for (i = 0: i <= SIZE: i++)
83
        {
84
          if (i->flags)
85
            {
86
              prime = i + i + 3;
87
              k = i + prime;
88
 
89
              while (k <= SIZE)
90
                {
91
                  k->flags = 0;
92
                  k = k + prime;
93
                }
94
 
95
              count++;
96
            }
97
        }
98
    }
99
        @print "End^^";
100
        @show_status;
101
];
102
 
103
[Mandelbrot
104
x y xtemp ytemp x0 y0 x00 y00 i;
105
@print "Start Mandelbrot 16-bit^";
106
@show_status;
107
y0=60;
108
do
109
{
110
        x0=-120;
111
        y00=y0*40;
112
        do
113
        {
114
                xtemp=0;
115
                ytemp=0;
116
                x=0;
117
                y=0;
118
                i=0;
119
                x00=x0*20;
120
                do
121
                {
122
                        xtemp=xtemp-ytemp+y00;
123
                        y=(x*y+x00)/32;
124
                        if (y>=2*64 || y<=-2*64)
125
                        {
126
                                i++;
127
                                break;
128
                        }
129
                        x=xtemp/64;
130
                        if (x>=2*64 || x<=-2*64)
131
                        {
132
                                i++;
133
                                break;
134
                        }
135
                        xtemp=x*x;
136
                        ytemp=y*y;
137
                        i++;
138
                } until ( xtemp + ytemp >= 64*64*4 || i>=32);
139
                i=1-->(i+MandelbrotPalette);
140
                x0++;
141
        } until (x0>=120);
142
        y0--;
143
} until (y0==60-230);
144
@print "End Mandelbrot 16-bit^^";
145
@show_status;
146
];
147
 
148
[ Mul32
149
r a b
150
x1 x2 y1 y2 mul;
151
mul=1;
152
a=(a-->0)*16+(a->2)/16;
153
if (a<0)
154
{
155
        mul=-mul;
156
        a=-a;
157
}
158
y1=a/256;
159
x1=a&$ff;
160
b=(b-->0)*16+(b->2)/16;
161
if (b<0)
162
{
163
        mul=-mul;
164
        b=-b;
165
}
166
y2=b/256;
167
x2=b&$ff;
168
r-->0=0;
169
r-->1=x1*x2;
170
r++;
171
r-->0=r-->0+x1*y2+x2*y1;
172
r--;
173
r-->0=mul*(r-->0+y1*y2);
174
];
175
 
176
[ Add32
177
r a b;
178
r-->0=0;
179
r-->1=(a-->1)&$ff+(b-->1)&$ff;
180
r++;
181
a++;
182
b++;
183
r-->0=r-->0+(a-->0)&$ff+(b-->0)&$ff;
184
r--;
185
a--;
186
b--;
187
r-->0=r-->0+a-->0+b-->0;
188
];
189
 
190
[ Neg32
191
r a;
192
r-->1=~a-->1+1;
193
r-->0=~a-->0;
194
if (r-->1==0)
195
        r-->0=r-->0+1;
196
];
197
 
198
[ Mov32
199
r a;
200
r-->1=a-->1;
201
r-->0=a-->0;
202
];
203
 
204
[ Dob32
205
r;
206
r-->0=2*r-->0;
207
if (r-->1<0)
208
        r-->0=r-->0+1;
209
r-->1=2*r-->1;
210
];
211
 
212
[MandelbrotPalette;
213
];
214
 
215
[Mandelbrot32
216
x y xtemp ytemp x0 y0 x00 y00 i t;
217
@print "Start Mandelbrot 32-bit^";
218
@show_status;
219
y0=60;
220
 
221
xtemp=0;
222
ytemp=4;
223
y=8;
224
x=12;
225
t=16;
226
x00=20;
227
y00=24;
228
 
229
do
230
{
231
        x0=-120;
232
        y00-->0=y0*40/16;
233
        y00-->1=0;
234
        do
235
        {
236
                xtemp-->0=0;
237
                xtemp-->1=0;
238
                ytemp-->0=0;
239
                ytemp-->1=0;
240
                y-->0=0;
241
                y-->1=0;
242
                x-->0=0;
243
                x-->1=0;
244
                x00-->0=x0*40/16;
245
                x00-->1=0;
246
 
247
                i=0;
248
                do
249
                {
250
                        Neg32(ytemp, ytemp);
251
                        Add32(t, xtemp, ytemp);
252
                        Neg32(ytemp, ytemp);
253
                        Add32(xtemp, t, y00);
254
                        Mul32(t, x, y);
255
                        Dob32(t);
256
                        Add32(y, t, x00);
257
                        Mov32(x,xtemp);
258
                        Mul32(xtemp,x,x);
259
                        Mul32(ytemp,y,y);
260
                        i++;
261
                        if (y-->0>=$200 || y-->0<=-$200)
262
                                break;
263
                        if (x-->0>=$200 || x-->0<=-$200)
264
                                break;
265
                        Add32(t,xtemp,ytemp);
266
                } until ( t-->0 >= $400 || i>=32);
267
                i=1-->(i+MandelbrotPalette);
268
                x0++;
269
        } until (x0>=120);
270
        y0--;
271
} until (y0==60-230);
272
@print "End Mandelbrot 32-bit^^";
273
@show_status;
274
];
275
 
276
Constant Number_Of_Runs = 10000;
277
 
278
Constant Ident_1 = 0;
279
Constant Ident_2 = 1;
280
Constant Ident_3 = 2;
281
Constant Ident_4 = 3;
282
Constant Ident_5 = 4;
283
 
284
Constant Ptr_Comp=0;
285
Constant Discr=1;
286
Constant Enum_Comp=2;
287
Constant Int_Comp=3;
288
Constant Str_Comp=8;
289
Constant E_Comp_2=2;
290
Constant Str_2_Comp=6;
291
Constant Ch_1_Comp=4;
292
Constant Ch_2_Comp=5;
293
Constant RecSize=Str_Comp+31;
294
 
295
Array String1->   'D' 'H' 'R' 'Y' 'S' 'T' 'O' 'N' 'E' ' ' 'P' 'R' 'O' 'G' 'R' 'A' 'M' ',' ' ' '1' ''' 'S' 'T' ' ' 'S' 'T' 'R' 'I' 'N' 'G' 0;
296
Array String2->   'D' 'H' 'R' 'Y' 'S' 'T' 'O' 'N' 'E' ' ' 'P' 'R' 'O' 'G' 'R' 'A' 'M' ',' ' ' '2' ''' 'N' 'D' ' ' 'S' 'T' 'R' 'I' 'N' 'G' 0;
297
Array String3->   'D' 'H' 'R' 'Y' 'S' 'T' 'O' 'N' 'E' ' ' 'P' 'R' 'O' 'G' 'R' 'A' 'M' ',' ' ' '3' ''' 'R' 'D' ' ' 'S' 'T' 'R' 'I' 'N' 'G' 0;
298
Array SomeString->'D' 'H' 'R' 'Y' 'S' 'T' 'O' 'N' 'E' ' ' 'P' 'R' 'O' 'G' 'R' 'A' 'M' ',' ' ' 'S' 'O' 'M' 'E' ' ' 'S' 'T' 'R' 'I' 'N' 'G' 0;
299
Array Str_1_Loc_Space->31;
300
Array Str_2_Loc_Space->31;
301
Array Arr_1_Glob-->50;
302
Array Arr_2_Glob-->2500;
303
Array Ptr_Glob->RecSize;
304
Array Next_Ptr_Glob->RecSize;
305
Global Int_Glob;
306
Global Bool_Glob;
307
Global Ch_1_Glob;
308
Global Ch_2_Glob;
309
 
310
[strcmp
311
a b c1 c2 i;
312
while (1)
313
{
314
        c1=i->a;
315
        c2=i->b;
316
        if (c1~=c2 || c1*c2==0)
317
                return c1-c2;
318
        i++;
319
}
320
];
321
 
322
[strcpy
323
a b i;
324
while (b->i)
325
{
326
        a->i=b->i;
327
        i++;
328
}
329
a->i=0;
330
];
331
 
332
[memcpy
333
a b i;
334
while (i)
335
{
336
        i--;
337
        a->i=b->i;
338
}
339
];
340
 
341
[PrintString
342
a i;
343
while (a->0)
344
{
345
        i=a->0;
346
        @print_char i;
347
        a++;
348
}
349
];
350
 
351
[Func_1
352
Ch_1_Par_Val Ch_2_Par_Val
353
Ch_1_Loc Ch_2_Loc;
354
 
355
Ch_1_Loc = Ch_1_Par_Val;
356
Ch_2_Loc = Ch_1_Loc;
357
if (Ch_2_Loc ~= Ch_2_Par_Val)
358
        return (Ident_1);
359
else
360
{
361
        Ch_1_Glob = Ch_1_Loc;
362
        return (Ident_2);
363
}
364
];
365
 
366
[Func_2
367
Str_1_Par_Ref Str_2_Par_Ref
368
Int_Loc Ch_Loc;
369
 
370
Int_Loc = 2;
371
while (Int_Loc <= 2)
372
{
373
        if (Func_1 (Str_1_Par_Ref->Int_Loc,
374
                                Str_2_Par_Ref->(Int_Loc+1)) == Ident_1)
375
        {
376
                Ch_Loc = 'A';
377
                Int_Loc ++;
378
        }
379
}
380
if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
381
        Int_Loc = 7;
382
if (Ch_Loc == 'R')
383
        return 1;
384
else
385
{
386
        if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
387
        {
388
                Int_Loc = Int_Loc + 7;
389
                Int_Glob = Int_Loc;
390
                return 1;
391
        }
392
        else
393
                return 0;
394
}
395
];
396
 
397
[Func_3
398
Enum_Par_Val
399
Enum_Loc;
400
 
401
  Enum_Loc = Enum_Par_Val;
402
  if (Enum_Loc == Ident_3)
403
    return 1;
404
  else
405
    return 0;
406
];
407
 
408
[Proc_1
409
Ptr_Val_Par
410
Next_Record;
411
  Next_Record = Ptr_Val_Par-->Ptr_Comp;
412
  memcpy(Ptr_Val_Par-->Ptr_Comp, Ptr_Glob, RecSize);
413
  Ptr_Val_Par-->Int_Comp = 5;
414
  Next_Record-->Int_Comp
415
        = Ptr_Val_Par-->Int_Comp;
416
  Next_Record-->Ptr_Comp = Ptr_Val_Par-->Ptr_Comp;
417
  Proc_3 (Next_Record+2*Ptr_Comp);
418
  if (Next_Record-->Discr == Ident_1)
419
  {
420
    Next_Record-->Int_Comp = 6;
421
    Next_Record-->Enum_Comp=Proc_6 (Ptr_Val_Par-->Enum_Comp);
422
    Next_Record-->Ptr_Comp = Ptr_Glob-->Ptr_Comp;
423
    Next_Record-->Int_Comp=Proc_7 (Next_Record-->Int_Comp, 10);
424
  }
425
  else
426
        memcpy(Ptr_Val_Par, Ptr_Val_Par-->Ptr_Comp, RecSize);
427
];
428
 
429
[Proc_2
430
Int_Par_Ref
431
Int_Loc Enum_Loc;
432
 
433
  Int_Loc = Int_Par_Ref + 10;
434
  do
435
    if (Ch_1_Glob == 'A')
436
    {
437
      Int_Loc --;
438
      Int_Par_Ref = Int_Loc - Int_Glob;
439
      Enum_Loc = Ident_1;
440
    }
441
  until (Enum_Loc == Ident_1);
442
return Int_Par_Ref;
443
];
444
 
445
[Proc_3
446
Ptr_Ref_Par;
447
if (Ptr_Glob)
448
{
449
        Ptr_Ref_Par-->0 = Ptr_Glob-->Ptr_Comp;
450
}
451
Ptr_Glob-->Int_Comp=Proc_7(10, Int_Glob);
452
];
453
 
454
[Proc_4
455
Bool_Loc;
456
Bool_Loc = Ch_1_Glob == 'A';
457
Bool_Glob = Bool_Loc | Bool_Glob;
458
Ch_2_Glob = 'B';
459
];
460
 
461
[Proc_5;
462
Ch_1_Glob = 'A';
463
Bool_Glob = 0;
464
];
465
 
466
[Proc_6
467
Enum_Val_Par
468
Enum_Ref_Par;
469
 
470
Enum_Ref_Par = Enum_Val_Par;
471
if (~~Func_3 (Enum_Val_Par))
472
        Enum_Ref_Par = Ident_4;
473
switch (Enum_Val_Par)
474
{
475
Ident_1:
476
        Enum_Ref_Par = Ident_1;
477
        break;
478
Ident_2:
479
        if (Int_Glob > 100) Enum_Ref_Par = Ident_1;
480
        else Enum_Ref_Par = Ident_4;
481
        break;
482
Ident_3:
483
        Enum_Ref_Par = Ident_2;
484
        break;
485
Ident_4:
486
        break;
487
Ident_5:
488
        Enum_Ref_Par = Ident_3;
489
        break;
490
}
491
return Enum_Ref_Par;
492
];
493
 
494
[Proc_7
495
Int_1_Par_Val Int_2_Par_Val
496
Int_Loc;
497
 
498
Int_Loc = Int_1_Par_Val + 2;
499
return Int_2_Par_Val + Int_Loc;
500
];
501
 
502
[Proc_8
503
Arr_1_Par_Ref Int_1_Par_Val Int_2_Par_Val ! Should take Arr_2_Global as argument but limited to 3 args
504
Int_Index Int_Loc;
505
 
506
Int_Loc = Int_1_Par_Val + 5;
507
Arr_1_Par_Ref-->Int_Loc = Int_2_Par_Val;
508
Arr_1_Par_Ref-->(Int_Loc+1) = Arr_1_Par_Ref-->Int_Loc;
509
Arr_1_Par_Ref-->(Int_Loc+30) = Int_Loc;
510
for (Int_Index = Int_Loc: Int_Index <= Int_Loc+1: Int_Index++)
511
Arr_2_Glob-->(50*Int_Loc+Int_Index) = Int_Loc;
512
Arr_2_Glob-->(50*Int_Loc+Int_Loc-1) = Arr_2_Glob-->(50*Int_Loc+Int_Loc-1)+1;
513
Arr_2_Glob-->(50*(Int_Loc+20)+Int_Loc) = Arr_1_Par_Ref-->Int_Loc;
514
Int_Glob = 5;
515
];
516
 
517
[Dhrystone
518
Run_Index Int_1_Loc Int_2_Loc Int_3_Loc Enum_Loc Ch_Index Str_1_Loc Str_2_Loc temp;
519
 
520
Str_1_Loc=Str_1_Loc_Space;
521
Str_2_Loc=Str_2_Loc_Space;
522
strcpy(Str_1_Loc, String1);
523
 
524
Ptr_Glob-->Ptr_Comp      = Next_Ptr_Glob;
525
Ptr_Glob-->Discr         = Ident_1;
526
Ptr_Glob-->Enum_Comp     = Ident_3;
527
Ptr_Glob-->Int_Comp      = 40;
528
strcpy(Ptr_Glob+Str_Comp, SomeString);
529
Arr_2_Glob-->(8*50+7)    = 10;
530
 
531
@print "Start Dhrystone x10000^";
532
@show_status;
533
 
534
for (Run_Index = 1: Run_Index <= Number_Of_Runs: Run_Index++)
535
  {
536
    Proc_5();
537
    Proc_4();
538
    Int_1_Loc = 2;
539
    Int_2_Loc = 3;
540
    strcpy (Str_2_Loc, String2);
541
    Enum_Loc = Ident_2;
542
    Bool_Glob = ~~Func_2 (Str_1_Loc, Str_2_Loc);
543
    while (Int_1_Loc < Int_2_Loc)
544
    {
545
      Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
546
      Int_3_Loc = Proc_7 (Int_1_Loc, Int_2_Loc);
547
      Int_1_Loc ++;
548
    }
549
    Proc_8 (Arr_1_Glob, Int_1_Loc, Int_3_Loc);
550
    Proc_1 (Ptr_Glob);
551
    for (Ch_Index = 'A': Ch_Index <= Ch_2_Glob: Ch_Index++)
552
    {
553
      if (Enum_Loc == Func_1 (Ch_Index, 'C'))
554
      {
555
        Enum_Loc=Proc_6 (Ident_1);
556
        strcpy (Str_2_Loc, String3);
557
        Int_2_Loc = Run_Index;
558
        Int_Glob = Run_Index;
559
      }
560
    }
561
    Int_2_Loc = Int_2_Loc * Int_1_Loc;
562
    Int_1_Loc = Int_2_Loc / Int_3_Loc;
563
    Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc;
564
    Int_1_Loc = Proc_2 (Int_1_Loc);
565
  }
566
@print "End Dhrystone^^";
567
@show_status;
568
 
569
@print "Int_Glob: ";
570
@print_num Int_Glob;
571
@print " should be 5^";
572
@print "Bool_Glob: ";
573
@print_num Bool_Glob;
574
@print " should be 1^";
575
@print "Ch_1_Glob: '";
576
@print_char Ch_1_Glob;
577
@print "' should be 'A'^";
578
@print "Ch_2_Glob: '";
579
@print_char Ch_2_Glob;
580
@print "' should be 'B'^";
581
@print "Arr_1_Glob[8]: ";
582
temp=Arr_1_Glob-->8;
583
@print_num temp;
584
@print " should be 7^";
585
@print "Arr_2_Glob[8][7]: ";
586
temp=Arr_2_Glob-->(8*50+7);
587
@print_num temp;
588
@print " should be Number_Of_Runs+10^";
589
 
590
@print "Ptr_Glob->^";
591
@print "  Ptr_Comp: ";
592
temp=Ptr_Glob-->Ptr_Comp;
593
@print_num temp;
594
@new_line;
595
@print "  Discr: ";
596
temp=Ptr_Glob-->Discr;
597
@print_num temp;
598
@print " should be 0^";
599
@print "  Enum_Comp: ";
600
temp=Ptr_Glob-->Enum_Comp;
601
@print_num temp;
602
@print " should be 2^";
603
@print "  Int_Comp: ";
604
temp=Ptr_Glob-->Int_Comp;
605
@print_num temp;
606
@print " should be 17^";
607
@print "  Str_Comp: ";
608
temp=Ptr_Glob+Str_Comp;
609
PrintString(temp);
610
@print " should be DHRYSTONE PROGRAM, SOME STRING^";
611
 
612
@print "Next_Ptr_Glob->^";
613
@print "  Ptr_Comp: ";
614
temp=Next_Ptr_Glob-->Ptr_Comp;
615
@print_num temp;
616
@print " should be same as above^";
617
@print "  Discr: ";
618
temp=Next_Ptr_Glob-->Discr;
619
@print_num temp;
620
@print " should be 0^";
621
@print "  Enum_Comp: ";
622
temp=Next_Ptr_Glob-->Enum_Comp;
623
@print_num temp;
624
@print " should be 1^";
625
@print "  Int_Comp: ";
626
temp=Next_Ptr_Glob-->Int_Comp;
627
@print_num temp;
628
@print " should be 18^";
629
@print "  Str_Comp: ";
630
temp=Next_Ptr_Glob+Str_Comp;
631
PrintString(temp);
632
@print " should be DHRYSTONE PROGRAM, SOME STRING^";
633
 
634
@print "Int_1_Loc: ";
635
@print_num Int_1_Loc;
636
@print " should be 5^";
637
@print "Int_2_Loc: ";
638
@print_num Int_2_Loc;
639
@print " should be 13^";
640
@print "Int_3_Loc: ";
641
@print_num Int_3_Loc;
642
@print " should be 7^";
643
@print "Enum_Loc: ";
644
@print_num Enum_Loc;
645
@print " should be 1^";
646
@print "Str_1_Loc: ";
647
PrintString(Str_1_Loc);
648
@print " should be DHRYSTONE PROGRAM, 1'ST STRING^";
649
@print "Str_2_Loc: ";
650
PrintString(Str_2_Loc);
651
@print " should be DHRYSTONE PROGRAM, 2'ND STRING^^";
652
@show_status;
653
];
654
 
655
[Main
656
t;
657
        AckermannBench();
658
        Sieve();
659
        Dhrystone();
660
        Mandelbrot();
661
        Mandelbrot32();
662
];

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.