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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [testbench/] [dhry.c] - Blame information for rev 1765

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

powered by: WebSVN 2.1.0

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