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 87

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

powered by: WebSVN 2.1.0

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