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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [sw/] [apps/] [dhry/] [dhry.c] - Blame information for rev 850

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

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

powered by: WebSVN 2.1.0

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