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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [testbench/] [dhry.c] - Blame information for rev 224

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 224 markom
/*
2
 ****************************************************************************
3
 *
4
 *                   "DHRYSTONE" Benchmark Program
5
 *                   -----------------------------
6
 *
7
 *  Version:    C, Version 2.1
8
 *
9
 *  File:       dhry_1.c (part 2 of 3)
10
 *
11
 *  Date:       May 25, 1988
12
 *
13
 *  Author:     Reinhold P. Weicker
14
 *
15
 ****************************************************************************
16
 */
17
#include "support.h"
18
#include "dhry.h"
19
 
20
#define NUM_RUNS (20)
21
#define DLX_FREQ 200  /* in MHz */
22
#define PROC_6 0
23
 
24
char *strcpy (char *dst0, char *src0)
25
{
26
  char *s = dst0;
27
 
28
  while ((*dst0++ = *src0++));
29
 
30
  return s;
31
}
32
 
33
int strcmp (const char *s1, const char *s2)
34
{
35
  char x;
36
 
37
  while ((x = *s1++) && (x == *s2++));
38
 
39
  return (*(unsigned char *) s1) - (*(unsigned char *) s2);
40
}
41
 
42
#define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
43
#define UNALIGNED(X, Y) \
44
  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
45
 
46
 
47
/* Global Variables: */
48
 
49
Rec_Pointer     Ptr_Glob,
50
                Next_Ptr_Glob;
51
int             Int_Glob;
52
Boolean         Bool_Glob;
53
char            Ch_1_Glob,
54
                Ch_2_Glob;
55
int             Arr_1_Glob [50];
56
int             Arr_2_Glob [50] [50];
57
 
58
 
59
  /* forward declaration necessary since Enumeration may not simply be int */
60
 
61
#ifndef REG
62
        Boolean Reg = false;
63
#define REG
64
        /* REG becomes defined as empty */
65
        /* i.e. no register variables   */
66
#else
67
        Boolean Reg = true;
68
#endif
69
 
70
/* variables for time measurement: */
71
 
72
#if DLX || OR1K
73
#define Too_Small_Time DLX_FREQ
74
#else
75
#define Too_Small_Time 1
76
#endif
77
 
78
#define TIMER0 0
79
#define TIMER1 1
80
 
81
 
82
 
83
 
84
 
85
unsigned int    Begin_Time,
86
                End_Time,
87
                User_Time,
88
                Microseconds,
89
                Dhrystones_Per_Second;
90
 
91
/* end of variables for time measurement */
92
 
93
 
94
void Proc_1(REG Rec_Pointer Ptr_Val_Par);
95
void Proc_2(One_Fifty      *Int_Par_Ref);
96
void Proc_3(Rec_Pointer    *Ptr_Ref_Par);
97
void Proc_4();
98
void Proc_5();
99
void Proc_6(
100
    Enumeration     Enum_Val_Par,
101
    Enumeration    *Enum_Ref_Par);
102
void Proc_7(
103
    One_Fifty       Int_1_Par_Val,
104
    One_Fifty       Int_2_Par_Val,
105
    One_Fifty      *Int_Par_Ref);
106
void Proc_8(
107
    Arr_1_Dim       Arr_1_Par_Ref,
108
    Arr_2_Dim       Arr_2_Par_Ref,
109
    int             Int_1_Par_Val,
110
    int             Int_2_Par_Val);
111
Enumeration Func_1(Capital_Letter Ch_1_Par_Val,
112
                   Capital_Letter Ch_2_Par_Val);
113
Boolean Func_2(Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref);
114
Boolean Func_3(Enumeration     Enum_Par_Val);
115
 
116
int main ()
117
/*****/
118
 
119
  /* main program, corresponds to procedures        */
120
  /* Main and Proc_0 in the Ada version             */
121
{
122
        One_Fifty       Int_1_Loc;
123
  REG   One_Fifty       Int_2_Loc;
124
        One_Fifty       Int_3_Loc;
125
  REG   char            Ch_Index;
126
        Enumeration     Enum_Loc;
127
        Str_30          Str_1_Loc;
128
        Str_30          Str_2_Loc;
129
  REG   int             Run_Index;
130
  REG   int             Number_Of_Runs;
131
  Rec_Type              x, y;
132
 
133
  /* Initializations */
134
 
135
  Next_Ptr_Glob = (Rec_Pointer) &x;
136
  Ptr_Glob = (Rec_Pointer) &y;
137
 
138
  Ptr_Glob->Ptr_Comp                    = Next_Ptr_Glob;
139
  Ptr_Glob->Discr                       = Ident_1;
140
  Ptr_Glob->variant.var_1.Enum_Comp     = Ident_3;
141
  Ptr_Glob->variant.var_1.Int_Comp      = 40;
142
  strcpy (Ptr_Glob->variant.var_1.Str_Comp,
143
          "DHRYSTONE PROGRAM, SOME STRING");
144
  strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");
145
 
146
  Arr_2_Glob [8][7] = 10;
147
        /* Was missing in published program. Without this statement,    */
148
        /* Arr_2_Glob [8][7] would have an undefined value.             */
149
        /* Warning: With 16-Bit processors and Number_Of_Runs > 32000,  */
150
        /* overflow may occur for this array element.                   */
151
 
152
/* Initalize Data and Instruction Cache */
153
 
154
 
155
/*  printf ("\n");
156
  printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
157
  printf ("\n");
158
  if (Reg)
159
  {
160
    printf ("Program compiled with 'register' attribute\n");
161
    printf ("\n");
162
  }
163
  else
164
  {
165
    printf ("Program compiled without 'register' attribute\n");
166
    printf ("\n");
167
  }
168
  printf ("Please give the number of runs through the benchmark: ");
169
 */
170
  {
171
    int n;
172
    /* scanf ("%d", &n);
173
 */
174
    n = NUM_RUNS;
175
    Number_Of_Runs = n;
176
  }
177
  printf ("\n");
178
 
179
  printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
180
 
181
 
182
  /***************/
183
  /* Start timer */
184
  /***************/
185
 
186
/*  printf("%d", my_test2(Number_Of_Runs));*/
187
        start_timer(TIMER0);
188
        Begin_Time = read_timer(TIMER0);
189
 
190
  for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
191
  {
192
 
193
        report(1);
194
        report(Run_Index);
195
    Proc_5();
196
        report(2);
197
    Proc_4();
198
        report(3);
199
      /* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */
200
    Int_1_Loc = 2;
201
    Int_2_Loc = 3;
202
    strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
203
    Enum_Loc = Ident_2;
204
        report(0x31);
205
        report((unsigned long)Str_1_Loc);
206
        report((unsigned long)Str_2_Loc);
207
 
208
    Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
209
      /* Bool_Glob == 1 */
210
        report(4);
211
    while (Int_1_Loc < Int_2_Loc)  /* loop body executed once */
212
    {
213
      Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
214
        /* Int_3_Loc == 7 */
215
      Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
216
        /* Int_3_Loc == 7 */
217
      Int_1_Loc += 1;
218
    } /* while */
219
        report(5);
220
      /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
221
#if DBG
222
      printf("a) Int_1_Loc: %x\n", Int_1_Loc);
223
      printf("a) Int_2_Loc: %x\n", Int_2_Loc);
224
      printf("a) Int_3_Loc: %x\n\n", Int_3_Loc);
225
#endif
226
    Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc);
227
      /* Int_Glob == 5 */
228
#if DBG
229
      printf("b) Int_1_Loc: %x\n", Int_1_Loc);
230
      printf("b) Int_2_Loc: %x\n", Int_2_Loc);
231
      printf("b) Int_3_Loc: %x\n\n", Int_3_Loc);
232
#endif
233
        report(6);
234
 
235
    Proc_1 (Ptr_Glob);
236
#if DBG
237
      printf("c) Int_1_Loc: %x\n", Int_1_Loc);
238
      printf("c) Int_2_Loc: %x\n", Int_2_Loc);
239
      printf("c) Int_3_Loc: %x\n\n", Int_3_Loc);
240
#endif
241
        report(7);
242
 
243
    for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
244
                             /* loop body executed twice */
245
    {
246
      if (Enum_Loc == Func_1 (Ch_Index, 'C'))
247
          /* then, not executed */
248
        {
249
        Proc_6 (Ident_1, &Enum_Loc);
250
        strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
251
        Int_2_Loc = Run_Index;
252
        Int_Glob = Run_Index;
253
#if DBG
254
      printf("d) Int_1_Loc: %x\n", Int_1_Loc);
255
      printf("d) Int_2_Loc: %x\n", Int_2_Loc);
256
      printf("d) Int_3_Loc: %x\n\n", Int_3_Loc);
257
#endif
258
        }
259
    }
260
        report(8);
261
 
262
      /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
263
#if DBG
264
      printf("e) Int_1_Loc: %x\n", Int_1_Loc);
265
      printf("e) Int_2_Loc: %x\n", Int_2_Loc);
266
      printf("e) Int_3_Loc: %x\n", Int_3_Loc);
267
      printf("e) Ch_1_Glob: %c\n\n", Ch_1_Glob);
268
#endif
269
    Int_2_Loc = Int_2_Loc * Int_1_Loc;
270
    Int_1_Loc = Int_2_Loc / Int_3_Loc;
271
    Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc;
272
      /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */
273
    Proc_2 (&Int_1_Loc);
274
        report(9);
275
 
276
      /* Int_1_Loc == 5 */
277
#if DBG
278
      printf("f) Int_1_Loc: %x\n", Int_1_Loc);
279
      printf("f) Int_2_Loc: %x\n", Int_2_Loc);
280
      printf("f) Int_3_Loc: %x\n\n", Int_3_Loc);
281
#endif
282
 
283
  } /* loop "for Run_Index" */
284
 
285
  /**************/
286
  /* Stop timer */
287
  /**************/
288
 
289
  End_Time = read_timer(TIMER0);
290
 
291
/*  printf ("Execution ends\n");
292
  printf ("\n");
293
  printf ("Final values of the variables used in the benchmark:\n");
294
  printf ("\n");
295
  printf ("Int_Glob:            %d\n", Int_Glob);
296
  printf ("        should be:   %d\n", 5);
297
  printf ("Bool_Glob:           %d\n", Bool_Glob);
298
  printf ("        should be:   %d\n", 1);
299
  printf ("Ch_1_Glob:           %c\n", Ch_1_Glob);
300
  printf ("        should be:   %c\n", 'A');
301
  printf ("Ch_2_Glob:           %c\n", Ch_2_Glob);
302
  printf ("        should be:   %c\n", 'B');
303
  printf ("Arr_1_Glob[8]:       %d\n", Arr_1_Glob[8]);
304
  printf ("        should be:   %d\n", 7);
305
  printf ("Arr_2_Glob[8][7]:    %d\n", Arr_2_Glob[8][7]);
306
  printf ("        should be:   Number_Of_Runs + 10\n");
307
  printf ("Ptr_Glob->\n");
308
  printf ("  Ptr_Comp:          %d\n", (int) Ptr_Glob->Ptr_Comp);
309
  printf ("        should be:   (implementation-dependent)\n");
310
  printf ("  Discr:             %d\n", Ptr_Glob->Discr);
311
  printf ("        should be:   %d\n", 0);
312
  printf ("  Enum_Comp:         %d\n", Ptr_Glob->variant.var_1.Enum_Comp);
313
  printf ("        should be:   %d\n", 2);
314
  printf ("  Int_Comp:          %d\n", Ptr_Glob->variant.var_1.Int_Comp);
315
  printf ("        should be:   %d\n", 17);
316
  printf ("  Str_Comp:          %s\n", Ptr_Glob->variant.var_1.Str_Comp);
317
  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
318
  printf ("Next_Ptr_Glob->\n");
319
  printf ("  Ptr_Comp:          %d\n", (int) Next_Ptr_Glob->Ptr_Comp);
320
  printf ("        should be:   (implementation-dependent), same as above\n");
321
  printf ("  Discr:             %d\n", Next_Ptr_Glob->Discr);
322
  printf ("        should be:   %d\n", 0);
323
  printf ("  Enum_Comp:         %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp);
324
  printf ("        should be:   %d\n", 1);
325
  printf ("  Int_Comp:          %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp);
326
  printf ("        should be:   %d\n", 18);
327
  printf ("  Str_Comp:          %s\n",
328
                                Next_Ptr_Glob->variant.var_1.Str_Comp);
329
  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
330
  printf ("Int_1_Loc:           %d\n", Int_1_Loc);
331
  printf ("        should be:   %d\n", 5);
332
  printf ("Int_2_Loc:           %d\n", Int_2_Loc);
333
  printf ("        should be:   %d\n", 13);
334
  printf ("Int_3_Loc:           %d\n", Int_3_Loc);
335
  printf ("        should be:   %d\n", 7);
336
  printf ("Enum_Loc:            %d\n", Enum_Loc);
337
  printf ("        should be:   %d\n", 1);
338
  printf ("Str_1_Loc:           %s\n", Str_1_Loc);
339
  printf ("        should be:   DHRYSTONE PROGRAM, 1'ST STRING\n");
340
  printf ("Str_2_Loc:           %s\n", Str_2_Loc);
341
  printf ("        should be:   DHRYSTONE PROGRAM, 2'ND STRING\n");
342
 
343
*/
344
 
345
 
346
  User_Time = End_Time - Begin_Time;
347
 /* microseconds */
348
 
349
  printf("Begin Time = %d\n",Begin_Time);
350
  printf("End Time   = %d\n",End_Time);
351
 
352
 
353
  if (User_Time < Too_Small_Time)
354
  {
355
    printf ("Measured time too small to obtain meaningful results\n");
356
    printf ("Please increase number of runs\n");
357
    printf ("\n");
358
  }
359
  else
360
  {
361
#if DLX || OR1K
362
    User_Time /= DLX_FREQ;
363
#if DLX
364
    printf("DLX ");
365
#else
366
#if OR1K
367
    printf("OR1K ");
368
#else
369
    printf("Unknown CPU ");
370
#endif
371
#endif
372
    printf("at %u MHz  ", DLX_FREQ);
373
    if (PROC_6)
374
            printf("(+PROC_6)");
375
    printf("\n");
376
#endif
377
    Microseconds = User_Time / Number_Of_Runs;
378
    Dhrystones_Per_Second = Number_Of_Runs * 1000 / User_Time;
379
    printf ("Microseconds for one run through Dhrystone: ");
380
    printf ("%d us / %d runs\n", User_Time,Number_Of_Runs);
381
    printf ("Dhrystones per Second:                      ");
382
    printf ("%d \n", Dhrystones_Per_Second);
383
  }
384
  report (0xdeaddead);
385
  return 0;
386
}
387
 
388
 
389
void Proc_1(Ptr_Val_Par)
390
/******************/
391
 
392
        REG Rec_Pointer Ptr_Val_Par;
393
 /* executed once */
394
{
395
        REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;
396
        /* == Ptr_Glob_Next */
397
        /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp,    */
398
        /* corresponds to "rename" in Ada, "with" in Pascal           */
399
 
400
        report(0x20010);
401
 
402
        structassign(*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob);
403
        Ptr_Val_Par->variant.var_1.Int_Comp = 5;
404
        Next_Record->variant.var_1.Int_Comp
405
        = Ptr_Val_Par->variant.var_1.Int_Comp;
406
        Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
407
        Proc_3(&Next_Record->Ptr_Comp);
408
        report(0x20011);
409
        /*
410
         * Ptr_Val_Par->Ptr_Comp->Ptr_Comp == Ptr_Glob->Ptr_Comp
411
         */
412
        if (Next_Record->Discr == Ident_1)
413
        /* then, executed */
414
        {
415
        Next_Record->variant.var_1.Int_Comp = 6;
416
        Proc_6(Ptr_Val_Par->variant.var_1.Enum_Comp,
417
                   &Next_Record->variant.var_1.Enum_Comp);
418
        report(0x20012);
419
        Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
420
        Proc_7(Next_Record->variant.var_1.Int_Comp, 10,
421
                   &Next_Record->variant.var_1.Int_Comp);
422
        } else          /* not executed */
423
        structassign(*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp);
424
        report(0x20013);
425
 
426
}               /* Proc_1 */
427
 
428
 
429
void
430
  Proc_2(Int_Par_Ref)
431
/******************/
432
 /* executed once */
433
 /* *Int_Par_Ref == 1, becomes 4 */
434
 
435
        One_Fifty      *Int_Par_Ref;
436
{
437
        One_Fifty       Int_Loc;
438
        Enumeration     Enum_Loc = 0;
439
 
440
        report(0x20020);
441
 
442
        Int_Loc = *Int_Par_Ref + 10;
443
        do              /* executed once */
444
        if (Ch_1_Glob == 'A')
445
                /* then, executed */
446
        {
447
                Int_Loc -= 1;
448
                *Int_Par_Ref = Int_Loc - Int_Glob;
449
                Enum_Loc = Ident_1;
450
        }           /* if */
451
        while (Enum_Loc != Ident_1);/* true */
452
}               /* Proc_2 */
453
 
454
 
455
void
456
  Proc_3(Ptr_Ref_Par)
457
/******************/
458
 /* executed once */
459
 /* Ptr_Ref_Par becomes Ptr_Glob */
460
 
461
        Rec_Pointer    *Ptr_Ref_Par;
462
 
463
{
464
        report(0x20030);
465
 
466
        if (Ptr_Glob != Null)
467
        /* then, executed */
468
        *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
469
        Proc_7(10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
470
}               /* Proc_3 */
471
 
472
 
473
void
474
  Proc_4()
475
{               /* without parameters */
476
        /*******/
477
        /* executed once */
478
        Boolean         Bool_Loc;
479
 
480
        report(0x20040);
481
 
482
        Bool_Loc = Ch_1_Glob == 'A';
483
        Bool_Glob = Bool_Loc | Bool_Glob;
484
        Ch_2_Glob = 'B';
485
}               /* Proc_4 */
486
 
487
 
488
void
489
  Proc_5()
490
{               /* without parameters */
491
        /*******/
492
        /* executed once */
493
        report(0x20050);
494
 
495
        Ch_1_Glob = 'A';
496
        Bool_Glob = false;
497
}               /* Proc_5 */
498
 
499
/* @(#)dhry_2.c 1.2 92/05/28 14:44:54, AMD */
500
/*
501
 ****************************************************************************
502
 *
503
 *                   "DHRYSTONE" Benchmark Program
504
 *                   -----------------------------
505
 *
506
 *  Version:    C, Version 2.1
507
 *
508
 *  File:       dhry_2.c (part 3 of 3)
509
 *
510
 *  Date:       May 25, 1988
511
 *
512
 *  Author:     Reinhold P. Weicker
513
 *
514
 ****************************************************************************
515
 */
516
 
517
#ifndef REG
518
#define REG
519
 /* REG becomes defined as empty */
520
 /* i.e. no register variables   */
521
#ifdef _AM29K
522
#undef REG
523
#define REG register    /* Define REG; saves room on 127-char MS-DOS cmd line */
524
#endif
525
#endif
526
 
527
 
528
void
529
  Proc_6(Enum_Val_Par, Enum_Ref_Par)
530
/*********************************/
531
 /* executed once */
532
 /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
533
 
534
    Enumeration     Enum_Val_Par;
535
    Enumeration    *Enum_Ref_Par;
536
{
537
#if PROC_6
538
        report(0x20060);
539
 
540
    *Enum_Ref_Par = Enum_Val_Par;
541
    if (!Func_3(Enum_Val_Par))
542
        /* then, not executed */
543
        *Enum_Ref_Par = Ident_4;
544
    switch (Enum_Val_Par) {
545
    case Ident_1:
546
        *Enum_Ref_Par = Ident_1;
547
        break;
548
    case Ident_2:
549
        if (Int_Glob > 100)
550
            /* then */
551
            *Enum_Ref_Par = Ident_1;
552
        else
553
            *Enum_Ref_Par = Ident_4;
554
        break;
555
    case Ident_3:               /* executed */
556
        *Enum_Ref_Par = Ident_2;
557
        break;
558
    case Ident_4:
559
        break;
560
    case Ident_5:
561
        *Enum_Ref_Par = Ident_3;
562
        break;
563
    }                           /* switch */
564
#endif
565
    return;
566
}                               /* Proc_6 */
567
 
568
 
569
void
570
  Proc_7(Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
571
/**********************************************/
572
 /* executed three times                                      */
573
 /* first call:      Int_1_Par_Val == 2, Int_2_Par_Val == 3,  */
574
 /* Int_Par_Ref becomes 7                    */
575
 /* second call:     Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
576
 /* Int_Par_Ref becomes 17                   */
577
 /* third call:      Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
578
 /* Int_Par_Ref becomes 18                   */
579
    One_Fifty       Int_1_Par_Val;
580
    One_Fifty       Int_2_Par_Val;
581
    One_Fifty      *Int_Par_Ref;
582
{
583
    One_Fifty       Int_Loc;
584
 
585
        report(0x20070);
586
 
587
    Int_Loc = Int_1_Par_Val + 2;
588
    *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
589
}                               /* Proc_7 */
590
 
591
 
592
void
593
  Proc_8(Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
594
/*********************************************************************/
595
 /* executed once      */
596
 /* Int_Par_Val_1 == 3 */
597
 /* Int_Par_Val_2 == 7 */
598
    Arr_1_Dim       Arr_1_Par_Ref;
599
    Arr_2_Dim       Arr_2_Par_Ref;
600
    int             Int_1_Par_Val;
601
    int             Int_2_Par_Val;
602
{
603
    REG One_Fifty   Int_Index;
604
    REG One_Fifty   Int_Loc;
605
 
606
#if DBG
607
      printf("X) Int_1_Par_Val: %x\n", Int_1_Par_Val);
608
      printf("X) Int_2_Par_Val: %x\n", Int_2_Par_Val);
609
#endif
610
 
611
        report(0x20080);
612
 
613
    Int_Loc = Int_1_Par_Val + 5;
614
    Arr_1_Par_Ref[Int_Loc] = Int_2_Par_Val;
615
    Arr_1_Par_Ref[Int_Loc + 1] = Arr_1_Par_Ref[Int_Loc];
616
    Arr_1_Par_Ref[Int_Loc + 30] = Int_Loc;
617
    for (Int_Index = Int_Loc; Int_Index <= Int_Loc + 1; ++Int_Index)
618
        Arr_2_Par_Ref[Int_Loc][Int_Index] = Int_Loc;
619
    Arr_2_Par_Ref[Int_Loc][Int_Loc - 1] += 1;
620
    Arr_2_Par_Ref[Int_Loc + 20][Int_Loc] = Arr_1_Par_Ref[Int_Loc];
621
    Int_Glob = 5;
622
 
623
#if DBG
624
      printf("Y) Int_1_Par_Val: %x\n", Int_1_Par_Val);
625
      printf("Y) Int_2_Par_Val: %x\n", Int_2_Par_Val);
626
#endif
627
 
628
}                               /* Proc_8 */
629
 
630
 
631
Enumeration
632
  Func_1(Ch_1_Par_Val, Ch_2_Par_Val)
633
/*************************************************/
634
 /* executed three times                                         */
635
 /* first call:      Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R'    */
636
 /* second call:     Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C'    */
637
 /* third call:      Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C'    */
638
 
639
    Capital_Letter  Ch_1_Par_Val;
640
    Capital_Letter  Ch_2_Par_Val;
641
{
642
    Capital_Letter  Ch_1_Loc;
643
    Capital_Letter  Ch_2_Loc;
644
 
645
        report(0x30010);
646
 
647
    Ch_1_Loc = Ch_1_Par_Val;
648
    Ch_2_Loc = Ch_1_Loc;
649
    if (Ch_2_Loc != Ch_2_Par_Val)
650
        /* then, executed */
651
        return (Ident_1);
652
    else {                      /* not executed */
653
        Ch_1_Glob = Ch_1_Loc;
654
        return (Ident_2);
655
    }
656
}                               /* Func_1 */
657
 
658
 
659
Boolean
660
  Func_2(Str_1_Par_Ref, Str_2_Par_Ref)
661
/*************************************************/
662
 /* executed once */
663
 /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
664
 /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
665
 
666
    Str_30          Str_1_Par_Ref;
667
    Str_30          Str_2_Par_Ref;
668
{
669
    REG One_Thirty  Int_Loc;
670
    Capital_Letter  Ch_Loc = 0;
671
 
672
        report(0x30020);
673
 
674
    Int_Loc = 2;
675
    while (Int_Loc <= 2)        /* loop body executed once */
676
        if (Func_1(Str_1_Par_Ref[Int_Loc],
677
                   Str_2_Par_Ref[Int_Loc + 1]) == Ident_1)
678
            /* then, executed */
679
        {
680
            Ch_Loc = 'A';
681
            Int_Loc += 1;
682
        }                       /* if, while */
683
        report(0x30021);
684
 
685
    if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
686
        /* then, not executed */
687
        Int_Loc = 7;
688
        report(0x30022);
689
    if (Ch_Loc == 'R')
690
        /* then, not executed */
691
        return (true);
692
    else {                      /* executed */
693
        report(0x30023);
694
        if (strcmp(Str_1_Par_Ref, Str_2_Par_Ref) > 0)
695
            /* then, not executed */
696
        {
697
            Int_Loc += 7;
698
            Int_Glob = Int_Loc;
699
            return (true);
700
        } else                  /* executed */
701
            return (false);
702
    }                           /* if Ch_Loc */
703
}                               /* Func_2 */
704
 
705
 
706
Boolean
707
  Func_3(Enum_Par_Val)
708
/***************************/
709
 /* executed once        */
710
 /* Enum_Par_Val == Ident_3 */
711
    Enumeration     Enum_Par_Val;
712
{
713
    Enumeration     Enum_Loc;
714
 
715
    Enum_Loc = Enum_Par_Val;
716
        report(0x30030);
717
    if (Enum_Loc == Ident_3)
718
        /* then, executed */
719
        return (true);
720
    else                        /* not executed */
721
        return (false);
722
}                               /* Func_3 */

powered by: WebSVN 2.1.0

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