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

Subversion Repositories or1k

[/] [or1k/] [tags/] [first/] [orp/] [orp_soc/] [sw/] [orp_mon/] [dhry.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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