⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dhry_1.lst

📁 ARM入门的好帮手.包含了从简单到相对较复杂的程序.
💻 LST
字号:
##############################################################################
#                                                                            #
# IAR ARM ANSI C/EC++ Compiler V3.10A/W32              05/Nov/2001  14:58:26 #
# Copyright 1999-2001 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode     =  arm                                                     #
#    Code model   =  small                                                   #
#    Endian       =  little                                                  #
#    Source file  =  C:\At91\software\projects\bench\Source\dhry_1.c         #
#    Command line =  -I C:\Compil\EW23\ARM\INC\ -I ../../..\ -lcN            #
#                    C:\At91\software\projects\bench\IAR\ARM_INT\List\ -la   #
#                    C:\At91\software\projects\bench\IAR\ARM_INT\List\ -o    #
#                    C:\At91\software\projects\bench\IAR\ARM_INT\Obj\ -e     #
#                    -s9 --debug --cpu_mode arm --code_model small --endian  #
#                    little --cpu=arm7tdmi C:\At91\software\projects\bench\S #
#                    ource\dhry_1.c                                          #
#    List file    =  C:\At91\software\projects\bench\IAR\ARM_INT\List\dhry_1 #
#                    .lst                                                    #
#    Object file  =  C:\At91\software\projects\bench\IAR\ARM_INT\Obj\dhry_1. #
#                    r79                                                     #
#                                                                            #
#                                                                            #
##############################################################################

C:\At91\software\projects\bench\Source\dhry_1.c
      1          /*
      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          
     18          #include <string.h>
     19          #include <stdlib.h>
     20          #include "dhry.h"
     21          
     22          
     23          /* Global Variables: */
     24          
     25          Rec_Pointer     Ptr_Glob,
     26                          Next_Ptr_Glob;
     27          int             Int_Glob;
     28          Boolean         Bool_Glob;
     29          char            Ch_1_Glob,
     30                          Ch_2_Glob;
     31          int             Arr_1_Glob [50];
     32          int             Arr_2_Glob [50] [50];
     33          
     34          //extern char     *malloc (int i );
     35          extern Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val);
     36          extern Boolean Func_2 (Str_30  Str_1_Par_Ref, Str_30  Str_2_Par_Ref) ;
     37            /* forward declaration necessary since Enumeration may not simply be int */
     38          extern Boolean Func_3 (Enumeration Enum_Par_Val);
     39          extern void Proc_6 ( Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par) ;
     40          extern void Proc_7 ( One_Fifty Int_1_Par_Val,
     41                        One_Fifty Int_2_Par_Val,
     42                        One_Fifty *Int_Par_Ref ) ;
     43          extern void Proc_8 ( Arr_1_Dim Arr_1_Par_Ref,
     44                        Arr_2_Dim Arr_2_Par_Ref,
     45                        int Int_1_Par_Val,
     46                        int Int_2_Par_Val) ;
     47          void Proc_1 (Rec_Pointer Ptr_Val_Par) ;
     48          void Proc_2 (One_Fifty *Int_Par_Ref) ;
     49          void Proc_3 (Rec_Pointer *Ptr_Ref_Par) ;
     50          void Proc_4 ( void ) ;
     51          void Proc_5 ( void ) ;
     52          
     53          
     54          #ifndef REG
     55                  Boolean Reg = false;
     56          #define REG
     57                  /* REG becomes defined as empty */
     58                  /* i.e. no register variables   */
     59          #else
     60                  Boolean Reg = true;
     61          #endif
     62          
     63          /* variables for time measurement: */
     64          long            Begin_Time,
     65                          End_Time,
     66                          User_Time;
     67          float           Microseconds,
     68                          Dhrystones_Per_Second;
     69          
     70          /* end of variables for time measurement */
     71          
     72          
     73          void Proc_1 (Rec_Pointer Ptr_Val_Par)
     74          /******************/
     75          
     76              /* executed once */
     77          {
     78              REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;
     79                                                  /* == Ptr_Glob_Next */
     80              /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp,    */
     81              /* corresponds to "rename" in Ada, "with" in Pascal           */
     82          
     83              structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob);
     84              Ptr_Val_Par->variant.var_1.Int_Comp = 5;
     85              Next_Record->variant.var_1.Int_Comp = Ptr_Val_Par->variant.var_1.Int_Comp;
     86              Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
     87              Proc_3 (&Next_Record->Ptr_Comp);
     88              /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp == Ptr_Glob->Ptr_Comp */
     89              if (Next_Record->Discr == Ident_1)
     90              {
     91                  Next_Record->variant.var_1.Int_Comp = 6;
     92                  Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp,
     93                          &Next_Record->variant.var_1.Enum_Comp);
     94                  Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
     95                  Proc_7 (Next_Record->variant.var_1.Int_Comp, 10,
     96                          &Next_Record->variant.var_1.Int_Comp);
     97              }
     98              else
     99                  structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp);
    100          } /* Proc_1 */
    101          
    102          
    103          void Proc_2 (One_Fifty *Int_Par_Ref)
    104          /******************/
    105              /* executed once */
    106              /* *Int_Par_Ref == 1, becomes 4 */
    107          
    108          {
    109              One_Fifty  Int_Loc;
    110              Enumeration   Enum_Loc;
    111          
    112              Int_Loc = *Int_Par_Ref + 10;
    113              do /* executed once */
    114                  if (Ch_1_Glob == 'A')
    115                  {
    116                      Int_Loc -= 1;
    117                      *Int_Par_Ref = Int_Loc - Int_Glob;
    118                      Enum_Loc = Ident_1;
    119                  }
    120              while (Enum_Loc != Ident_1); /* true */
    121          } /* Proc_2 */
    122          
    123          
    124          void Proc_3 (Rec_Pointer *Ptr_Ref_Par)
    125          /******************/
    126              /* executed once */
    127              /* Ptr_Ref_Par becomes Ptr_Glob */
    128          {
    129              if (Ptr_Glob != Null)
    130                  *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
    131              Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
    132          } /* Proc_3 */
    133          
    134          
    135          void Proc_4 ( void )
    136          /*******/
    137              /* executed once */
    138          {
    139              Boolean Bool_Loc;
    140          
    141              Bool_Loc = Ch_1_Glob == 'A';
    142              Bool_Glob = Bool_Loc | Bool_Glob;
    143              Ch_2_Glob = 'B';
    144          } /* Proc_4 */
    145          
    146          
    147          void Proc_5 ( void )
    148          /*******/
    149          {
    150              Ch_1_Glob = 'A';
    151              Bool_Glob = false;
    152          } /* Proc_5 */
    153          
    154          
    155          //int main ( void )
    156          void testloop ( int Number_Of_Runs )
    157          /*****/
    158          
    159          /* main program, corresponds to procedures        */
    160          /* Main and Proc_0 in the Ada version             */
    161          {
    162              One_Fifty       Int_1_Loc;
    163              REG One_Fifty   Int_2_Loc;
    164              One_Fifty       Int_3_Loc;
    165              REG char        Ch_Index;
    166              Enumeration     Enum_Loc;
    167              Str_30          Str_1_Loc;
    168              Str_30          Str_2_Loc;
    169              REG int         Run_Index;
    170            
    171          
    172              /* Initializations */
    173              Next_Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
    174              Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
    175          
    176              Ptr_Glob->Ptr_Comp                    = Next_Ptr_Glob;
    177              Ptr_Glob->Discr                       = Ident_1;
    178              Ptr_Glob->variant.var_1.Enum_Comp     = Ident_3;
    179              Ptr_Glob->variant.var_1.Int_Comp      = 40;
    180              strcpy (Ptr_Glob->variant.var_1.Str_Comp,
    181                      "DHRYSTONE PROGRAM, SOME STRING");
    182              strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");
    183          
    184              Arr_2_Glob [8][7] = 10;
    185                  /* Was missing in published program. Without this statement,    */
    186                  /* Arr_2_Glob [8][7] would have an undefined value.             */
    187                  /* Warning: With 16-Bit processors and Number_Of_Runs > 32000,  */
    188                  /* overflow may occur for this array element.                   */
    189          
    190          
    191              /***************/
    192              /* Start loop */
    193              /***************/
    194          
    195              for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
    196              {
    197                  Proc_5();
    198                  Proc_4();
    199                  /* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */
    200                  Int_1_Loc = 2;
    201                  Int_2_Loc = 3;
    202                  strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
    203                  Enum_Loc = Ident_2;
    204                  Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
    205                  /* Bool_Glob == 1 */
    206                  while (Int_1_Loc < Int_2_Loc)  /* loop body executed once */
    207                  {
    208                      Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
    209                      /* Int_3_Loc == 7 */
    210                      Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
    211                      /* Int_3_Loc == 7 */
    212                      Int_1_Loc += 1;
    213                  } /* while */
    214                  /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
    215                  Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc);
    216                  /* Int_Glob == 5 */
    217                  Proc_1 (Ptr_Glob);
    218                  for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
    219                                       /* loop body executed twice */
    220                  {
    221                      if (Enum_Loc == Func_1 (Ch_Index, 'C'))
    222                      /* then, not executed */
    223                      {
    224                          Proc_6 (Ident_1, &Enum_Loc);
    225                          strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
    226                          Int_2_Loc = Run_Index;
    227                          Int_Glob = Run_Index;
    228                      }
    229                  }
    230                  /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
    231                  Int_2_Loc = Int_2_Loc * Int_1_Loc;
    232                  Int_1_Loc = Int_2_Loc / Int_3_Loc;
    233                  Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc;
    234                  /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */
    235                  Proc_2 (&Int_1_Loc);
    236                  /* Int_1_Loc == 5 */
    237          
    238              } /* loop "for Run_Index" */
    239          
    240          }
    241          
    242          
    243          

   Maximum stack usage in bytes:

     Function  CSTACK
     --------  ------
     Proc_1       16 
     Proc_2        4 
     Proc_3        4 
     Proc_4        0 
     Proc_5        0 
     testloop     96 

 
    124 bytes in segment HUGE_C    
 10 244 bytes in segment HUGE_Z    
     12 bytes in segment INITTAB   
    864 bytes in segment NEARFUNC_A
 
    864 bytes of CODE      memory (+ 12 bytes shared)
    124 bytes of HUGECONST memory
 10 244 bytes of HUGEDATA  memory

Errors: none
Warnings: none

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -