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

Subversion Repositories or1k

[/] [or1k/] [branches/] [oc/] [orpmon/] [cmds/] [dhry.c] - Blame information for rev 1775

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

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

powered by: WebSVN 2.1.0

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