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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [dhry/] [dhry.c] - Blame information for rev 90

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

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

powered by: WebSVN 2.1.0

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