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

Subversion Repositories test_project

[/] [test_project/] [trunk/] [sw/] [dhry/] [dhry.c] - Blame information for rev 51

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

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

powered by: WebSVN 2.1.0

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