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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [orpmon/] [cmds/] [dhry.c] - Blame information for rev 1765

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
        One_Fifty       Int_1_Loc;
123
  REG   One_Fifty       Int_2_Loc;
124
        One_Fifty       Int_3_Loc;
125
  REG   char            Ch_Index;
126
        Enumeration     Enum_Loc;
127
        Str_30          Str_1_Loc;
128
        Str_30          Str_2_Loc;
129
  REG   int             Run_Index;
130
  REG   int             Number_Of_Runs;
131
  Rec_Type              x, y;
132
 
133
  /* Initializations */
134
 
135
  Next_Ptr_Glob = (Rec_Pointer) &x;
136
  Ptr_Glob = (Rec_Pointer) &y;
137
 
138
  Ptr_Glob->Ptr_Comp                    = Next_Ptr_Glob;
139
  Ptr_Glob->Discr                       = Ident_1;
140
  Ptr_Glob->variant.var_1.Enum_Comp     = Ident_3;
141
  Ptr_Glob->variant.var_1.Int_Comp      = 40;
142
  strcpy (Ptr_Glob->variant.var_1.Str_Comp,
143
          "DHRYSTONE PROGRAM, SOME STRING");
144
  strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");
145
 
146
  Arr_2_Glob [8][7] = 10;
147
        /* Was missing in published program. Without this statement,    */
148
        /* Arr_2_Glob [8][7] would have an undefined value.             */
149
        /* Warning: With 16-Bit processors and Number_Of_Runs > 32000,  */
150
        /* overflow may occur for this array element.                   */
151
 
152
/* Initalize Data and Instruction Cache */
153
 
154
 
155
/*  printf ("\n");
156
  printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
157
  printf ("\n");
158
  if (Reg)
159
  {
160
    printf ("Program compiled with 'register' attribute\n");
161
    printf ("\n");
162
  }
163
  else
164
  {
165
    printf ("Program compiled without 'register' attribute\n");
166
    printf ("\n");
167
  }
168
  printf ("Please give the number of runs through the benchmark: ");
169
 */
170
  {
171
    int n;
172
    /* scanf ("%d", &n);
173
 */
174
    n = num_runs;
175
    Number_Of_Runs = n;
176
  }
177
  printf ("\n");
178
 
179
  printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
180
 
181
 
182
  /***************/
183
  /* Start timer */
184
  /***************/
185
 
186
/*  printf("%d", my_test2(Number_Of_Runs));*/
187
        start_timer();
188
        Begin_Time = read_timer();
189
 
190
  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
  End_Time = read_timer();
277
 
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
 
333
  User_Time = End_Time - Begin_Time;
334
 /* microseconds */
335
 
336
  printf("Begin Time = %d\n",Begin_Time);
337
  printf("End Time   = %d\n",End_Time);
338
 
339
  printf ("\nNumber of Runs %i", num_runs);
340
  printf ("\nBegin Time %i", Begin_Time);
341
  printf ("\nEnd Time %i\n", End_Time);
342
 
343
  if (User_Time < Too_Small_Time)
344
  {
345
    printf ("Measured time too small to obtain meaningful results\n");
346
    printf ("Please increase number of runs\n");
347
    printf ("\n");
348
  }
349
  else
350
  {
351
#if DLX || OR1K
352
//    User_Time /= DLX_FREQ;
353
#if DLX
354
    printf("DLX ");
355
#else
356
#if OR1K
357
    printf("OR1K ");
358
#else
359
    printf("Unknown CPU ");
360
#endif
361
#endif
362
    printf("at %u MHz  ", DLX_FREQ);
363
    if (PROC_6)
364
            printf("(+PROC_6)");
365
    printf("\n");
366
#endif
367
//    Microseconds = User_Time / Number_Of_Runs;
368
//    Dhrystones_Per_Second = Number_Of_Runs * 1000 / User_Time;
369
    printf ("Microseconds for one run through Dhrystone: ");
370
    printf ("%d us / %d runs\n", User_Time,Number_Of_Runs);
371
    printf ("Dhrystones per Second:                      ");
372
    printf ("%d \n", Dhrystones_Per_Second);
373
  }
374
  return 0;
375
}
376
 
377
 
378
void Proc_1(Ptr_Val_Par)
379
/******************/
380
 
381
        REG Rec_Pointer Ptr_Val_Par;
382
 /* executed once */
383
{
384
        REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;
385
        /* == Ptr_Glob_Next */
386
        /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp,    */
387
        /* corresponds to "rename" in Ada, "with" in Pascal           */
388
 
389
 
390
        structassign(*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob);
391
        Ptr_Val_Par->variant.var_1.Int_Comp = 5;
392
        Next_Record->variant.var_1.Int_Comp
393
        = Ptr_Val_Par->variant.var_1.Int_Comp;
394
        Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
395
        Proc_3(&Next_Record->Ptr_Comp);
396
        /*
397
         * Ptr_Val_Par->Ptr_Comp->Ptr_Comp == Ptr_Glob->Ptr_Comp
398
         */
399
        if (Next_Record->Discr == Ident_1)
400
        /* then, executed */
401
        {
402
        Next_Record->variant.var_1.Int_Comp = 6;
403
        Proc_6(Ptr_Val_Par->variant.var_1.Enum_Comp,
404
                   &Next_Record->variant.var_1.Enum_Comp);
405
        Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
406
        Proc_7(Next_Record->variant.var_1.Int_Comp, 10,
407
                   &Next_Record->variant.var_1.Int_Comp);
408
        } else          /* not executed */
409
        structassign(*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp);
410
 
411
}               /* Proc_1 */
412
 
413
 
414
void
415
  Proc_2(Int_Par_Ref)
416
/******************/
417
 /* executed once */
418
 /* *Int_Par_Ref == 1, becomes 4 */
419
 
420
        One_Fifty      *Int_Par_Ref;
421
{
422
        One_Fifty       Int_Loc;
423
        Enumeration     Enum_Loc = 0;
424
 
425
 
426
        Int_Loc = *Int_Par_Ref + 10;
427
        do              /* executed once */
428
        if (Ch_1_Glob == 'A')
429
                /* then, executed */
430
        {
431
                Int_Loc -= 1;
432
                *Int_Par_Ref = Int_Loc - Int_Glob;
433
                Enum_Loc = Ident_1;
434
        }           /* if */
435
        while (Enum_Loc != Ident_1);/* true */
436
}               /* Proc_2 */
437
 
438
 
439
void
440
  Proc_3(Ptr_Ref_Par)
441
/******************/
442
 /* executed once */
443
 /* Ptr_Ref_Par becomes Ptr_Glob */
444
 
445
        Rec_Pointer    *Ptr_Ref_Par;
446
 
447
{
448
 
449
        if (Ptr_Glob != Null)
450
        /* then, executed */
451
        *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
452
        Proc_7(10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
453
}               /* Proc_3 */
454
 
455
 
456
void
457
  Proc_4()
458
{               /* without parameters */
459
        /*******/
460
        /* executed once */
461
        Boolean         Bool_Loc;
462
 
463
 
464
        Bool_Loc = Ch_1_Glob == 'A';
465
        Bool_Glob = Bool_Loc | Bool_Glob;
466
        Ch_2_Glob = 'B';
467
}               /* Proc_4 */
468
 
469
 
470
void
471
  Proc_5()
472
{               /* without parameters */
473
        /*******/
474
        /* executed once */
475
 
476
        Ch_1_Glob = 'A';
477
        Bool_Glob = false;
478
}               /* Proc_5 */
479
 
480
/* @(#)dhry_2.c 1.2 92/05/28 14:44:54, AMD */
481
/*
482
 ****************************************************************************
483
 *
484
 *                   "DHRYSTONE" Benchmark Program
485
 *                   -----------------------------
486
 *
487
 *  Version:    C, Version 2.1
488
 *
489
 *  File:       dhry_2.c (part 3 of 3)
490
 *
491
 *  Date:       May 25, 1988
492
 *
493
 *  Author:     Reinhold P. Weicker
494
 *
495
 ****************************************************************************
496
 */
497
 
498
#ifndef REG
499
#define REG
500
 /* REG becomes defined as empty */
501
 /* i.e. no register variables   */
502
#ifdef _AM29K
503
#undef REG
504
#define REG register    /* Define REG; saves room on 127-char MS-DOS cmd line */
505
#endif
506
#endif
507
 
508
 
509
void
510
  Proc_6(Enum_Val_Par, Enum_Ref_Par)
511
/*********************************/
512
 /* executed once */
513
 /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
514
 
515
    Enumeration     Enum_Val_Par;
516
    Enumeration    *Enum_Ref_Par;
517
{
518
#if PROC_6
519
 
520
    *Enum_Ref_Par = Enum_Val_Par;
521
    if (!Func_3(Enum_Val_Par))
522
        /* then, not executed */
523
        *Enum_Ref_Par = Ident_4;
524
    switch (Enum_Val_Par) {
525
    case Ident_1:
526
        *Enum_Ref_Par = Ident_1;
527
        break;
528
    case Ident_2:
529
        if (Int_Glob > 100)
530
            /* then */
531
            *Enum_Ref_Par = Ident_1;
532
        else
533
            *Enum_Ref_Par = Ident_4;
534
        break;
535
    case Ident_3:               /* executed */
536
        *Enum_Ref_Par = Ident_2;
537
        break;
538
    case Ident_4:
539
        break;
540
    case Ident_5:
541
        *Enum_Ref_Par = Ident_3;
542
        break;
543
    }                           /* switch */
544
#endif
545
    return;
546
}                               /* Proc_6 */
547
 
548
void
549
  Proc_7(Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
550
/**********************************************/
551
 /* executed three times                                      */
552
 /* first call:      Int_1_Par_Val == 2, Int_2_Par_Val == 3,  */
553
 /* Int_Par_Ref becomes 7                    */
554
 /* second call:     Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
555
 /* Int_Par_Ref becomes 17                   */
556
 /* third call:      Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
557
 /* Int_Par_Ref becomes 18                   */
558
    One_Fifty       Int_1_Par_Val;
559
    One_Fifty       Int_2_Par_Val;
560
    One_Fifty      *Int_Par_Ref;
561
{
562
    One_Fifty       Int_Loc;
563
 
564
 
565
    Int_Loc = Int_1_Par_Val + 2;
566
    *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
567
}                               /* Proc_7 */
568
 
569
 
570
void
571
  Proc_8(Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
572
/*********************************************************************/
573
 /* executed once      */
574
 /* Int_Par_Val_1 == 3 */
575
 /* Int_Par_Val_2 == 7 */
576
    Arr_1_Dim       Arr_1_Par_Ref;
577
    Arr_2_Dim       Arr_2_Par_Ref;
578
    int             Int_1_Par_Val;
579
    int             Int_2_Par_Val;
580
{
581
    REG One_Fifty   Int_Index;
582
    REG One_Fifty   Int_Loc;
583
 
584
#if DBG
585
      printf("X) Int_1_Par_Val: %x\n", Int_1_Par_Val);
586
      printf("X) Int_2_Par_Val: %x\n", Int_2_Par_Val);
587
#endif
588
 
589
 
590
    Int_Loc = Int_1_Par_Val + 5;
591
    Arr_1_Par_Ref[Int_Loc] = Int_2_Par_Val;
592
    Arr_1_Par_Ref[Int_Loc + 1] = Arr_1_Par_Ref[Int_Loc];
593
    Arr_1_Par_Ref[Int_Loc + 30] = Int_Loc;
594
    for (Int_Index = Int_Loc; Int_Index <= Int_Loc + 1; ++Int_Index)
595
        Arr_2_Par_Ref[Int_Loc][Int_Index] = Int_Loc;
596
    Arr_2_Par_Ref[Int_Loc][Int_Loc - 1] += 1;
597
    Arr_2_Par_Ref[Int_Loc + 20][Int_Loc] = Arr_1_Par_Ref[Int_Loc];
598
    Int_Glob = 5;
599
 
600
#if DBG
601
      printf("Y) Int_1_Par_Val: %x\n", Int_1_Par_Val);
602
      printf("Y) Int_2_Par_Val: %x\n", Int_2_Par_Val);
603
#endif
604
 
605
}                               /* Proc_8 */
606
 
607
 
608
Enumeration
609
  Func_1(Ch_1_Par_Val, Ch_2_Par_Val)
610
/*************************************************/
611
 /* executed three times                                         */
612
 /* first call:      Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R'    */
613
 /* second call:     Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C'    */
614
 /* third call:      Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C'    */
615
 
616
    Capital_Letter  Ch_1_Par_Val;
617
    Capital_Letter  Ch_2_Par_Val;
618
{
619
    Capital_Letter  Ch_1_Loc;
620
    Capital_Letter  Ch_2_Loc;
621
 
622
 
623
    Ch_1_Loc = Ch_1_Par_Val;
624
    Ch_2_Loc = Ch_1_Loc;
625
    if (Ch_2_Loc != Ch_2_Par_Val)
626
        /* then, executed */
627
        return (Ident_1);
628
    else {                      /* not executed */
629
        Ch_1_Glob = Ch_1_Loc;
630
        return (Ident_2);
631
    }
632
}                               /* Func_1 */
633
 
634
 
635
Boolean
636
  Func_2(Str_1_Par_Ref, Str_2_Par_Ref)
637
/*************************************************/
638
 /* executed once */
639
 /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
640
 /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
641
 
642
    Str_30          Str_1_Par_Ref;
643
    Str_30          Str_2_Par_Ref;
644
{
645
    REG One_Thirty  Int_Loc;
646
    Capital_Letter  Ch_Loc = 0;
647
 
648
 
649
    Int_Loc = 2;
650
    while (Int_Loc <= 2)        /* loop body executed once */
651
        if (Func_1(Str_1_Par_Ref[Int_Loc],
652
                   Str_2_Par_Ref[Int_Loc + 1]) == Ident_1)
653
            /* then, executed */
654
        {
655
            Ch_Loc = 'A';
656
            Int_Loc += 1;
657
        }                       /* if, while */
658
 
659
    if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
660
        /* then, not executed */
661
        Int_Loc = 7;
662
    if (Ch_Loc == 'R')
663
        /* then, not executed */
664
        return (true);
665
    else {                      /* executed */
666
        if (strcmp(Str_1_Par_Ref, Str_2_Par_Ref) > 0)
667
            /* then, not executed */
668
        {
669
            Int_Loc += 7;
670
            Int_Glob = Int_Loc;
671
            return (true);
672
        } else                  /* executed */
673
            return (false);
674
    }                           /* if Ch_Loc */
675
}                               /* Func_2 */
676
 
677
 
678
Boolean
679
  Func_3(Enum_Par_Val)
680
/***************************/
681
 /* executed once        */
682
 /* Enum_Par_Val == Ident_3 */
683
    Enumeration     Enum_Par_Val;
684
{
685
    Enumeration     Enum_Loc;
686
 
687
    Enum_Loc = Enum_Par_Val;
688
    if (Enum_Loc == Ident_3)
689
        /* then, executed */
690
        return (true);
691
    else                        /* not executed */
692
        return (false);
693
}                               /* Func_3 */
694
 
695
int dhry_cmd (int argc, char *argv[])
696
{
697 816 markom
  if (argc == 1) dhry_main(strtoul (argv[0], 0, 0));
698 809 simons
  else if (argc == 0) dhry_main(20);
699
  else return -1;
700
  return 0;
701
}
702
 
703
void module_dhry_init (void)
704
{
705
  register_command ("dhry", "[<num_runs>]", "run dhrystone", dhry_cmd);
706
}

powered by: WebSVN 2.1.0

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