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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [cmds/] [dhry.c] - Blame information for rev 277

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

Line No. Rev Author Line
1 2 marcus.erl
/*
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 246 julius
#include "spr-defs.h"
19 2 marcus.erl
#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 140 julius
#if 0
42 2 marcus.erl
        unsigned long val;
43
 
44
        asm("l.mfspr    %0,r0,%1": "=r" (val) : "i" (SPR_TTCR));
45
        return val;
46 140 julius
#else
47
        return timestamp;
48
#endif
49 2 marcus.erl
}
50
 
51
/* Global Variables: */
52
 
53
Rec_Pointer     Ptr_Glob,
54
                Next_Ptr_Glob;
55
int             Int_Glob;
56
Boolean         Bool_Glob;
57
char            Ch_1_Glob,
58
                Ch_2_Glob;
59
int             Arr_1_Glob [50];
60
int             Arr_2_Glob [50] [50];
61
 
62
 
63
  /* forward declaration necessary since Enumeration may not simply be int */
64
 
65
#ifndef REG
66
        Boolean Reg = false;
67
#define REG
68
        /* REG becomes defined as empty */
69
        /* i.e. no register variables   */
70
#else
71
        Boolean Reg = true;
72
#endif
73
 
74
/* variables for time measurement: */
75
 
76 140 julius
#define Too_Small_Time US_PER_TICK
77 2 marcus.erl
 
78 140 julius
 
79 2 marcus.erl
#define TIMER0 0
80
#define TIMER1 1
81
 
82
 
83
 
84
 
85
 
86
unsigned int    Begin_Time,
87
                End_Time,
88
                User_Time,
89
                Microseconds,
90
                Dhrystones_Per_Second;
91
 
92
/* end of variables for time measurement */
93
 
94
 
95
void Proc_1(REG Rec_Pointer Ptr_Val_Par);
96
void Proc_2(One_Fifty      *Int_Par_Ref);
97
void Proc_3(Rec_Pointer    *Ptr_Ref_Par);
98
void Proc_4(void);
99
void Proc_5(void);
100
void Proc_6(
101
    Enumeration     Enum_Val_Par,
102
    Enumeration    *Enum_Ref_Par);
103
void Proc_7(
104
    One_Fifty       Int_1_Par_Val,
105
    One_Fifty       Int_2_Par_Val,
106
    One_Fifty      *Int_Par_Ref);
107
void Proc_8(
108
    Arr_1_Dim       Arr_1_Par_Ref,
109
    Arr_2_Dim       Arr_2_Par_Ref,
110
    int             Int_1_Par_Val,
111
    int             Int_2_Par_Val);
112
Enumeration Func_1(Capital_Letter Ch_1_Par_Val,
113
                   Capital_Letter Ch_2_Par_Val);
114
Boolean Func_2(Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref);
115
Boolean Func_3(Enumeration     Enum_Par_Val);
116
 
117
int dhry_main (int num_runs)
118
/*****/
119
 
120
  /* main program, corresponds to procedures        */
121
  /* Main and Proc_0 in the Ada version             */
122
{
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 140 julius
  //start_timer();
189
  Begin_Time = read_timer();
190 2 marcus.erl
 
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 140 julius
 
335 2 marcus.erl
  User_Time = End_Time - Begin_Time;
336
 
337 140 julius
  printf("Timer ticks (%d - %d) =\t%d\n",End_Time,Begin_Time, User_Time);
338 2 marcus.erl
 
339 140 julius
 
340
 
341
  // This is in ticks, convert to mS
342
  User_Time = User_Time * (MS_PER_SEC / TICKS_PER_SEC);
343
 
344
 /* microseconds */
345
 
346 2 marcus.erl
  printf ("\nNumber of Runs %i", num_runs);
347 140 julius
  printf ("\nElapsed time %i ms\n", User_Time);
348 2 marcus.erl
 
349 140 julius
 
350
  if (User_Time < MS_PER_SEC)
351 2 marcus.erl
  {
352
    printf ("Measured time too small to obtain meaningful results\n");
353
    printf ("Please increase number of runs\n");
354
    printf ("\n");
355
  }
356
  else
357
  {
358 140 julius
    printf("Processor at %d MHz\n",(IN_CLK/1000000));
359
 
360 2 marcus.erl
//    Microseconds = User_Time / Number_Of_Runs;
361
//    Dhrystones_Per_Second = Number_Of_Runs * 1000 / User_Time;
362 140 julius
    Dhrystones_Per_Second = (Number_Of_Runs * MS_PER_SEC) / User_Time;
363 2 marcus.erl
    printf ("Microseconds for one run through Dhrystone: ");
364 140 julius
    printf ("%d ms / %d runs\n", User_Time,Number_Of_Runs);
365 2 marcus.erl
    printf ("Dhrystones per Second:                      ");
366
    printf ("%d \n", Dhrystones_Per_Second);
367
  }
368
  return 0;
369
}
370
 
371
 
372
void Proc_1(Ptr_Val_Par)
373
/******************/
374
 
375
        REG Rec_Pointer Ptr_Val_Par;
376
 /* executed once */
377
{
378
        REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;
379
        /* == Ptr_Glob_Next */
380
        /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp,    */
381
        /* corresponds to "rename" in Ada, "with" in Pascal           */
382
 
383
 
384
        structassign(*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob);
385
        Ptr_Val_Par->variant.var_1.Int_Comp = 5;
386
        Next_Record->variant.var_1.Int_Comp
387
        = Ptr_Val_Par->variant.var_1.Int_Comp;
388
        Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
389
        Proc_3(&Next_Record->Ptr_Comp);
390
        /*
391
         * Ptr_Val_Par->Ptr_Comp->Ptr_Comp == Ptr_Glob->Ptr_Comp
392
         */
393
        if (Next_Record->Discr == Ident_1)
394
        /* then, executed */
395
        {
396
        Next_Record->variant.var_1.Int_Comp = 6;
397
        Proc_6(Ptr_Val_Par->variant.var_1.Enum_Comp,
398
                   &Next_Record->variant.var_1.Enum_Comp);
399
        Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
400
        Proc_7(Next_Record->variant.var_1.Int_Comp, 10,
401
                   &Next_Record->variant.var_1.Int_Comp);
402
        } else          /* not executed */
403
        structassign(*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp);
404
 
405
}               /* Proc_1 */
406
 
407
 
408
void
409
  Proc_2(Int_Par_Ref)
410
/******************/
411
 /* executed once */
412
 /* *Int_Par_Ref == 1, becomes 4 */
413
 
414
        One_Fifty      *Int_Par_Ref;
415
{
416
        One_Fifty       Int_Loc;
417
        Enumeration     Enum_Loc = 0;
418
 
419
 
420
        Int_Loc = *Int_Par_Ref + 10;
421
        do              /* executed once */
422
        if (Ch_1_Glob == 'A')
423
                /* then, executed */
424
        {
425
                Int_Loc -= 1;
426
                *Int_Par_Ref = Int_Loc - Int_Glob;
427
                Enum_Loc = Ident_1;
428
        }           /* if */
429
        while (Enum_Loc != Ident_1);/* true */
430
}               /* Proc_2 */
431
 
432
 
433
void
434
  Proc_3(Ptr_Ref_Par)
435
/******************/
436
 /* executed once */
437
 /* Ptr_Ref_Par becomes Ptr_Glob */
438
 
439
        Rec_Pointer    *Ptr_Ref_Par;
440
 
441
{
442
 
443
        if (Ptr_Glob != Null)
444
        /* then, executed */
445
        *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
446
        Proc_7(10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
447
}               /* Proc_3 */
448
 
449
 
450
void
451
  Proc_4()
452
{               /* without parameters */
453
        /*******/
454
        /* executed once */
455
        Boolean         Bool_Loc;
456
 
457
 
458
        Bool_Loc = Ch_1_Glob == 'A';
459
        Bool_Glob = Bool_Loc | Bool_Glob;
460
        Ch_2_Glob = 'B';
461
}               /* Proc_4 */
462
 
463
 
464
void
465
  Proc_5()
466
{               /* without parameters */
467
        /*******/
468
        /* executed once */
469
 
470
        Ch_1_Glob = 'A';
471
        Bool_Glob = false;
472
}               /* Proc_5 */
473
 
474
/* @(#)dhry_2.c 1.2 92/05/28 14:44:54, AMD */
475
/*
476
 ****************************************************************************
477
 *
478
 *                   "DHRYSTONE" Benchmark Program
479
 *                   -----------------------------
480
 *
481
 *  Version:    C, Version 2.1
482
 *
483
 *  File:       dhry_2.c (part 3 of 3)
484
 *
485
 *  Date:       May 25, 1988
486
 *
487
 *  Author:     Reinhold P. Weicker
488
 *
489
 ****************************************************************************
490
 */
491
 
492
#ifndef REG
493
#define REG
494
 /* REG becomes defined as empty */
495
 /* i.e. no register variables   */
496
#ifdef _AM29K
497
#undef REG
498
#define REG register    /* Define REG; saves room on 127-char MS-DOS cmd line */
499
#endif
500
#endif
501
 
502
 
503
void
504
  Proc_6(Enum_Val_Par, Enum_Ref_Par)
505
/*********************************/
506
 /* executed once */
507
 /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
508
 
509
    Enumeration     Enum_Val_Par;
510
    Enumeration    *Enum_Ref_Par;
511
{
512
#if PROC_6
513
 
514
    *Enum_Ref_Par = Enum_Val_Par;
515
    if (!Func_3(Enum_Val_Par))
516
        /* then, not executed */
517
        *Enum_Ref_Par = Ident_4;
518
    switch (Enum_Val_Par) {
519
    case Ident_1:
520
        *Enum_Ref_Par = Ident_1;
521
        break;
522
    case Ident_2:
523
        if (Int_Glob > 100)
524
            /* then */
525
            *Enum_Ref_Par = Ident_1;
526
        else
527
            *Enum_Ref_Par = Ident_4;
528
        break;
529
    case Ident_3:               /* executed */
530
        *Enum_Ref_Par = Ident_2;
531
        break;
532
    case Ident_4:
533
        break;
534
    case Ident_5:
535
        *Enum_Ref_Par = Ident_3;
536
        break;
537
    }                           /* switch */
538
#endif
539
    return;
540
}                               /* Proc_6 */
541
 
542
void
543
  Proc_7(Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
544
/**********************************************/
545
 /* executed three times                                      */
546
 /* first call:      Int_1_Par_Val == 2, Int_2_Par_Val == 3,  */
547
 /* Int_Par_Ref becomes 7                    */
548
 /* second call:     Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
549
 /* Int_Par_Ref becomes 17                   */
550
 /* third call:      Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
551
 /* Int_Par_Ref becomes 18                   */
552
    One_Fifty       Int_1_Par_Val;
553
    One_Fifty       Int_2_Par_Val;
554
    One_Fifty      *Int_Par_Ref;
555
{
556
    One_Fifty       Int_Loc;
557
 
558
 
559
    Int_Loc = Int_1_Par_Val + 2;
560
    *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
561
}                               /* Proc_7 */
562
 
563
 
564
void
565
  Proc_8(Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
566
/*********************************************************************/
567
 /* executed once      */
568
 /* Int_Par_Val_1 == 3 */
569
 /* Int_Par_Val_2 == 7 */
570
    Arr_1_Dim       Arr_1_Par_Ref;
571
    Arr_2_Dim       Arr_2_Par_Ref;
572
    int             Int_1_Par_Val;
573
    int             Int_2_Par_Val;
574
{
575
    REG One_Fifty   Int_Index;
576
    REG One_Fifty   Int_Loc;
577
 
578
#if DBG
579
      printf("X) Int_1_Par_Val: %x\n", Int_1_Par_Val);
580
      printf("X) Int_2_Par_Val: %x\n", Int_2_Par_Val);
581
#endif
582
 
583
 
584
    Int_Loc = Int_1_Par_Val + 5;
585
    Arr_1_Par_Ref[Int_Loc] = Int_2_Par_Val;
586
    Arr_1_Par_Ref[Int_Loc + 1] = Arr_1_Par_Ref[Int_Loc];
587
    Arr_1_Par_Ref[Int_Loc + 30] = Int_Loc;
588
    for (Int_Index = Int_Loc; Int_Index <= Int_Loc + 1; ++Int_Index)
589
        Arr_2_Par_Ref[Int_Loc][Int_Index] = Int_Loc;
590
    Arr_2_Par_Ref[Int_Loc][Int_Loc - 1] += 1;
591
    Arr_2_Par_Ref[Int_Loc + 20][Int_Loc] = Arr_1_Par_Ref[Int_Loc];
592
    Int_Glob = 5;
593
 
594
#if DBG
595
      printf("Y) Int_1_Par_Val: %x\n", Int_1_Par_Val);
596
      printf("Y) Int_2_Par_Val: %x\n", Int_2_Par_Val);
597
#endif
598
 
599
}                               /* Proc_8 */
600
 
601
 
602
Enumeration
603
  Func_1(Ch_1_Par_Val, Ch_2_Par_Val)
604
/*************************************************/
605
 /* executed three times                                         */
606
 /* first call:      Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R'    */
607
 /* second call:     Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C'    */
608
 /* third call:      Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C'    */
609
 
610
    Capital_Letter  Ch_1_Par_Val;
611
    Capital_Letter  Ch_2_Par_Val;
612
{
613
    Capital_Letter  Ch_1_Loc;
614
    Capital_Letter  Ch_2_Loc;
615
 
616
 
617
    Ch_1_Loc = Ch_1_Par_Val;
618
    Ch_2_Loc = Ch_1_Loc;
619
    if (Ch_2_Loc != Ch_2_Par_Val)
620
        /* then, executed */
621
        return (Ident_1);
622
    else {                      /* not executed */
623
        Ch_1_Glob = Ch_1_Loc;
624
        return (Ident_2);
625
    }
626
}                               /* Func_1 */
627
 
628
 
629
Boolean
630
  Func_2(Str_1_Par_Ref, Str_2_Par_Ref)
631
/*************************************************/
632
 /* executed once */
633
 /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
634
 /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
635
 
636
    Str_30          Str_1_Par_Ref;
637
    Str_30          Str_2_Par_Ref;
638
{
639
    REG One_Thirty  Int_Loc;
640
    Capital_Letter  Ch_Loc = 0;
641
 
642
 
643
    Int_Loc = 2;
644
    while (Int_Loc <= 2)        /* loop body executed once */
645
        if (Func_1(Str_1_Par_Ref[Int_Loc],
646
                   Str_2_Par_Ref[Int_Loc + 1]) == Ident_1)
647
            /* then, executed */
648
        {
649
            Ch_Loc = 'A';
650
            Int_Loc += 1;
651
        }                       /* if, while */
652
 
653
    if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
654
        /* then, not executed */
655
        Int_Loc = 7;
656
    if (Ch_Loc == 'R')
657
        /* then, not executed */
658
        return (true);
659
    else {                      /* executed */
660
        if (strcmp(Str_1_Par_Ref, Str_2_Par_Ref) > 0)
661
            /* then, not executed */
662
        {
663
            Int_Loc += 7;
664
            Int_Glob = Int_Loc;
665
            return (true);
666
        } else                  /* executed */
667
            return (false);
668
    }                           /* if Ch_Loc */
669
}                               /* Func_2 */
670
 
671
 
672
Boolean
673
  Func_3(Enum_Par_Val)
674
/***************************/
675
 /* executed once        */
676
 /* Enum_Par_Val == Ident_3 */
677
    Enumeration     Enum_Par_Val;
678
{
679
    Enumeration     Enum_Loc;
680
 
681
    Enum_Loc = Enum_Par_Val;
682
    if (Enum_Loc == Ident_3)
683
        /* then, executed */
684
        return (true);
685
    else                        /* not executed */
686
        return (false);
687
}                               /* Func_3 */
688
 
689
int dhry_cmd (int argc, char *argv[])
690
{
691
  if (argc == 1) dhry_main(strtoul (argv[0], 0, 0));
692
  else if (argc == 0) dhry_main(20);
693
  else return -1;
694
  return 0;
695
}
696
 
697
void module_dhry_init (void)
698
{
699
  register_command ("dhry", "[<num_runs>]", "run dhrystone", dhry_cmd);
700
}

powered by: WebSVN 2.1.0

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