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 52

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

powered by: WebSVN 2.1.0

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