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

Subversion Repositories fwrisc

[/] [fwrisc/] [trunk/] [ve/] [fwrisc/] [tests/] [dhrystone/] [src/] [dhrystone.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mballance
// See LICENSE for license details.
2
 
3
#pragma GCC optimize ("no-inline")
4
 
5
#include "dhrystone.h"
6
 
7
#ifndef REG
8
#define REG
9
        /* REG becomes defined as empty */
10
        /* i.e. no register variables   */
11
#else
12
#undef REG
13
#define REG register
14
#endif
15
 
16
extern  int     Int_Glob;
17
extern  char    Ch_1_Glob;
18
 
19
 
20
void Proc_6 (Enumeration  Enum_Val_Par, Enumeration *Enum_Ref_Par)
21
{
22
  *Enum_Ref_Par = Enum_Val_Par;
23
  if (! Func_3 (Enum_Val_Par))
24
    /* then, not executed */
25
    *Enum_Ref_Par = Ident_4;
26
  switch (Enum_Val_Par)
27
  {
28
    case Ident_1:
29
      *Enum_Ref_Par = Ident_1;
30
      break;
31
    case Ident_2:
32
      if (Int_Glob > 100)
33
        /* then */
34
      *Enum_Ref_Par = Ident_1;
35
      else *Enum_Ref_Par = Ident_4;
36
      break;
37
    case Ident_3: /* executed */
38
      *Enum_Ref_Par = Ident_2;
39
      break;
40
    case Ident_4: break;
41
    case Ident_5:
42
      *Enum_Ref_Par = Ident_3;
43
      break;
44
  } /* switch */
45
} /* Proc_6 */
46
 
47
 
48
void Proc_7 ( One_Fifty       Int_1_Par_Val, One_Fifty       Int_2_Par_Val, One_Fifty      *Int_Par_Ref)
49
/**********************************************/
50
    /* executed three times                                      */
51
    /* first call:      Int_1_Par_Val == 2, Int_2_Par_Val == 3,  */
52
    /*                  Int_Par_Ref becomes 7                    */
53
    /* second call:     Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
54
    /*                  Int_Par_Ref becomes 17                   */
55
    /* third call:      Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
56
    /*                  Int_Par_Ref becomes 18                   */
57
{
58
  One_Fifty Int_Loc;
59
 
60
  Int_Loc = Int_1_Par_Val + 2;
61
  *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
62
} /* Proc_7 */
63
 
64
 
65
void Proc_8 ( Arr_1_Dim Arr_1_Par_Ref, Arr_2_Dim Arr_2_Par_Ref, int Int_1_Par_Val, int Int_2_Par_Val)
66
/*********************************************************************/
67
    /* executed once      */
68
    /* Int_Par_Val_1 == 3 */
69
    /* Int_Par_Val_2 == 7 */
70
{
71
  REG One_Fifty Int_Index;
72
  REG One_Fifty Int_Loc;
73
 
74
  Int_Loc = Int_1_Par_Val + 5;
75
  Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
76
  Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
77
  Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
78
  for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
79
    Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc;
80
  Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1;
81
  Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc];
82
  Int_Glob = 5;
83
} /* Proc_8 */
84
 
85
 
86
Enumeration Func_1 (Ch_1_Par_Val, Ch_2_Par_Val)
87
/*************************************************/
88
    /* executed three times                                         */
89
    /* first call:      Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R'    */
90
    /* second call:     Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C'    */
91
    /* third call:      Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C'    */
92
 
93
Capital_Letter   Ch_1_Par_Val;
94
Capital_Letter   Ch_2_Par_Val;
95
{
96
  Capital_Letter        Ch_1_Loc;
97
  Capital_Letter        Ch_2_Loc;
98
 
99
  Ch_1_Loc = Ch_1_Par_Val;
100
  Ch_2_Loc = Ch_1_Loc;
101
  if (Ch_2_Loc != Ch_2_Par_Val)
102
    /* then, executed */
103
    return (Ident_1);
104
  else  /* not executed */
105
  {
106
    Ch_1_Glob = Ch_1_Loc;
107
    return (Ident_2);
108
   }
109
} /* Func_1 */
110
 
111
 
112
Boolean Func_2 (Str_1_Par_Ref, Str_2_Par_Ref)
113
/*************************************************/
114
    /* executed once */
115
    /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
116
    /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
117
 
118
Str_30  Str_1_Par_Ref;
119
Str_30  Str_2_Par_Ref;
120
{
121
  REG One_Thirty        Int_Loc;
122
      Capital_Letter    Ch_Loc;
123
 
124
  Int_Loc = 2;
125
  while (Int_Loc <= 2) /* loop body executed once */
126
    if (Func_1 (Str_1_Par_Ref[Int_Loc],
127
                Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
128
      /* then, executed */
129
    {
130
      Ch_Loc = 'A';
131
      Int_Loc += 1;
132
    } /* if, while */
133
  if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
134
    /* then, not executed */
135
    Int_Loc = 7;
136
  if (Ch_Loc == 'R')
137
    /* then, not executed */
138
    return (true);
139
  else /* executed */
140
  {
141
    if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
142
      /* then, not executed */
143
    {
144
      Int_Loc += 7;
145
      Int_Glob = Int_Loc;
146
      return (true);
147
    }
148
    else /* executed */
149
      return (false);
150
  } /* if Ch_Loc */
151
} /* Func_2 */
152
 
153
 
154
Boolean Func_3 (Enum_Par_Val)
155
/***************************/
156
    /* executed once        */
157
    /* Enum_Par_Val == Ident_3 */
158
Enumeration Enum_Par_Val;
159
{
160
  Enumeration Enum_Loc;
161
 
162
  Enum_Loc = Enum_Par_Val;
163
  if (Enum_Loc == Ident_3)
164
    /* then, executed */
165
    return (true);
166
  else /* not executed */
167
    return (false);
168
} /* Func_3 */
169
 
170
void debug_printf(const char* str, ...)
171
{
172
}

powered by: WebSVN 2.1.0

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