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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [testbench/] [dhry.c] - Diff between revs 715 and 997

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 715 Rev 997
Line 154... Line 154...
        /* overflow may occur for this array element.                   */
        /* overflow may occur for this array element.                   */
 
 
/* Initalize Data and Instruction Cache */
/* Initalize Data and Instruction Cache */
 
 
 
 
/*  printf ("\n");
/*  PRINTF ("\n");
  printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
  PRINTF ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
  printf ("\n");
  PRINTF ("\n");
  if (Reg)
  if (Reg)
  {
  {
    printf ("Program compiled with 'register' attribute\n");
    PRINTF ("Program compiled with 'register' attribute\n");
    printf ("\n");
    PRINTF ("\n");
  }
  }
  else
  else
  {
  {
    printf ("Program compiled without 'register' attribute\n");
    PRINTF ("Program compiled without 'register' attribute\n");
    printf ("\n");
    PRINTF ("\n");
  }
  }
  printf ("Please give the number of runs through the benchmark: ");
  PRINTF ("Please give the number of runs through the benchmark: ");
 */
 */
  {
  {
    int n;
    int n;
    /* scanf ("%d", &n);
    /* scanf ("%d", &n);
 */
 */
    n = NUM_RUNS;
    n = NUM_RUNS;
    Number_Of_Runs = n;
    Number_Of_Runs = n;
  }
  }
  printf ("\n");
  PRINTF ("\n");
 
 
  printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
  PRINTF ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
 
 
 
 
  /***************/
  /***************/
  /* Start timer */
  /* Start timer */
  /***************/
  /***************/
 
 
/*  printf("%d", my_test2(Number_Of_Runs));*/
/*  PRINTF("%d", my_test2(Number_Of_Runs));*/
        start_timer(TIMER0);
        start_timer(TIMER0);
        Begin_Time = read_timer(TIMER0);
        Begin_Time = read_timer(TIMER0);
 
 
  for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
  for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
  {
  {
Line 221... Line 221...
      Int_1_Loc += 1;
      Int_1_Loc += 1;
    } /* while */
    } /* while */
        report(5);
        report(5);
      /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
      /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
#if DBG
#if DBG
      printf("a) Int_1_Loc: %x\n", Int_1_Loc);
      PRINTF("a) Int_1_Loc: %x\n", Int_1_Loc);
      printf("a) Int_2_Loc: %x\n", Int_2_Loc);
      PRINTF("a) Int_2_Loc: %x\n", Int_2_Loc);
      printf("a) Int_3_Loc: %x\n\n", Int_3_Loc);
      PRINTF("a) Int_3_Loc: %x\n\n", Int_3_Loc);
#endif
#endif
    Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc);
    Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc);
      /* Int_Glob == 5 */
      /* Int_Glob == 5 */
#if DBG
#if DBG
      printf("b) Int_1_Loc: %x\n", Int_1_Loc);
      PRINTF("b) Int_1_Loc: %x\n", Int_1_Loc);
      printf("b) Int_2_Loc: %x\n", Int_2_Loc);
      PRINTF("b) Int_2_Loc: %x\n", Int_2_Loc);
      printf("b) Int_3_Loc: %x\n\n", Int_3_Loc);
      PRINTF("b) Int_3_Loc: %x\n\n", Int_3_Loc);
#endif
#endif
        report(6);
        report(6);
 
 
    Proc_1 (Ptr_Glob);
    Proc_1 (Ptr_Glob);
#if DBG
#if DBG
      printf("c) Int_1_Loc: %x\n", Int_1_Loc);
      PRINTF("c) Int_1_Loc: %x\n", Int_1_Loc);
      printf("c) Int_2_Loc: %x\n", Int_2_Loc);
      PRINTF("c) Int_2_Loc: %x\n", Int_2_Loc);
      printf("c) Int_3_Loc: %x\n\n", Int_3_Loc);
      PRINTF("c) Int_3_Loc: %x\n\n", Int_3_Loc);
#endif
#endif
        report(7);
        report(7);
 
 
    for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
    for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
                             /* loop body executed twice */
                             /* loop body executed twice */
Line 253... Line 253...
        Proc_6 (Ident_1, &Enum_Loc);
        Proc_6 (Ident_1, &Enum_Loc);
        strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
        strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
        Int_2_Loc = Run_Index;
        Int_2_Loc = Run_Index;
        Int_Glob = Run_Index;
        Int_Glob = Run_Index;
#if DBG
#if DBG
      printf("d) Int_1_Loc: %x\n", Int_1_Loc);
      PRINTF("d) Int_1_Loc: %x\n", Int_1_Loc);
      printf("d) Int_2_Loc: %x\n", Int_2_Loc);
      PRINTF("d) Int_2_Loc: %x\n", Int_2_Loc);
      printf("d) Int_3_Loc: %x\n\n", Int_3_Loc);
      PRINTF("d) Int_3_Loc: %x\n\n", Int_3_Loc);
#endif
#endif
        }
        }
    }
    }
        report(8);
        report(8);
 
 
      /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
      /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
#if DBG
#if DBG
      printf("e) Int_1_Loc: %x\n", Int_1_Loc);
      PRINTF("e) Int_1_Loc: %x\n", Int_1_Loc);
      printf("e) Int_2_Loc: %x\n", Int_2_Loc);
      PRINTF("e) Int_2_Loc: %x\n", Int_2_Loc);
      printf("e) Int_3_Loc: %x\n", Int_3_Loc);
      PRINTF("e) Int_3_Loc: %x\n", Int_3_Loc);
      printf("e) Ch_1_Glob: %c\n\n", Ch_1_Glob);
      PRINTF("e) Ch_1_Glob: %c\n\n", Ch_1_Glob);
#endif
#endif
    Int_2_Loc = Int_2_Loc * Int_1_Loc;
    Int_2_Loc = Int_2_Loc * Int_1_Loc;
    Int_1_Loc = Int_2_Loc / Int_3_Loc;
    Int_1_Loc = Int_2_Loc / Int_3_Loc;
    Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc;
    Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc;
      /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */
      /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */
    Proc_2 (&Int_1_Loc);
    Proc_2 (&Int_1_Loc);
        report(9);
        report(9);
 
 
      /* Int_1_Loc == 5 */
      /* Int_1_Loc == 5 */
#if DBG
#if DBG
      printf("f) Int_1_Loc: %x\n", Int_1_Loc);
      PRINTF("f) Int_1_Loc: %x\n", Int_1_Loc);
      printf("f) Int_2_Loc: %x\n", Int_2_Loc);
      PRINTF("f) Int_2_Loc: %x\n", Int_2_Loc);
      printf("f) Int_3_Loc: %x\n\n", Int_3_Loc);
      PRINTF("f) Int_3_Loc: %x\n\n", Int_3_Loc);
#endif
#endif
 
 
  } /* loop "for Run_Index" */
  } /* loop "for Run_Index" */
 
 
  /**************/
  /**************/
  /* Stop timer */
  /* Stop timer */
  /**************/
  /**************/
 
 
  End_Time = read_timer(TIMER0);
  End_Time = read_timer(TIMER0);
 
 
/*  printf ("Execution ends\n");
/*  PRINTF ("Execution ends\n");
  printf ("\n");
  PRINTF ("\n");
  printf ("Final values of the variables used in the benchmark:\n");
  PRINTF ("Final values of the variables used in the benchmark:\n");
  printf ("\n");
  PRINTF ("\n");
  printf ("Int_Glob:            %d\n", Int_Glob);
  PRINTF ("Int_Glob:            %d\n", Int_Glob);
  printf ("        should be:   %d\n", 5);
  PRINTF ("        should be:   %d\n", 5);
  printf ("Bool_Glob:           %d\n", Bool_Glob);
  PRINTF ("Bool_Glob:           %d\n", Bool_Glob);
  printf ("        should be:   %d\n", 1);
  PRINTF ("        should be:   %d\n", 1);
  printf ("Ch_1_Glob:           %c\n", Ch_1_Glob);
  PRINTF ("Ch_1_Glob:           %c\n", Ch_1_Glob);
  printf ("        should be:   %c\n", 'A');
  PRINTF ("        should be:   %c\n", 'A');
  printf ("Ch_2_Glob:           %c\n", Ch_2_Glob);
  PRINTF ("Ch_2_Glob:           %c\n", Ch_2_Glob);
  printf ("        should be:   %c\n", 'B');
  PRINTF ("        should be:   %c\n", 'B');
  printf ("Arr_1_Glob[8]:       %d\n", Arr_1_Glob[8]);
  PRINTF ("Arr_1_Glob[8]:       %d\n", Arr_1_Glob[8]);
  printf ("        should be:   %d\n", 7);
  PRINTF ("        should be:   %d\n", 7);
  printf ("Arr_2_Glob[8][7]:    %d\n", Arr_2_Glob[8][7]);
  PRINTF ("Arr_2_Glob[8][7]:    %d\n", Arr_2_Glob[8][7]);
  printf ("        should be:   Number_Of_Runs + 10\n");
  PRINTF ("        should be:   Number_Of_Runs + 10\n");
  printf ("Ptr_Glob->\n");
  PRINTF ("Ptr_Glob->\n");
  printf ("  Ptr_Comp:          %d\n", (int) Ptr_Glob->Ptr_Comp);
  PRINTF ("  Ptr_Comp:          %d\n", (int) Ptr_Glob->Ptr_Comp);
  printf ("        should be:   (implementation-dependent)\n");
  PRINTF ("        should be:   (implementation-dependent)\n");
  printf ("  Discr:             %d\n", Ptr_Glob->Discr);
  PRINTF ("  Discr:             %d\n", Ptr_Glob->Discr);
  printf ("        should be:   %d\n", 0);
  PRINTF ("        should be:   %d\n", 0);
  printf ("  Enum_Comp:         %d\n", Ptr_Glob->variant.var_1.Enum_Comp);
  PRINTF ("  Enum_Comp:         %d\n", Ptr_Glob->variant.var_1.Enum_Comp);
  printf ("        should be:   %d\n", 2);
  PRINTF ("        should be:   %d\n", 2);
  printf ("  Int_Comp:          %d\n", Ptr_Glob->variant.var_1.Int_Comp);
  PRINTF ("  Int_Comp:          %d\n", Ptr_Glob->variant.var_1.Int_Comp);
  printf ("        should be:   %d\n", 17);
  PRINTF ("        should be:   %d\n", 17);
  printf ("  Str_Comp:          %s\n", Ptr_Glob->variant.var_1.Str_Comp);
  PRINTF ("  Str_Comp:          %s\n", Ptr_Glob->variant.var_1.Str_Comp);
  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
  PRINTF ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
  printf ("Next_Ptr_Glob->\n");
  PRINTF ("Next_Ptr_Glob->\n");
  printf ("  Ptr_Comp:          %d\n", (int) Next_Ptr_Glob->Ptr_Comp);
  PRINTF ("  Ptr_Comp:          %d\n", (int) Next_Ptr_Glob->Ptr_Comp);
  printf ("        should be:   (implementation-dependent), same as above\n");
  PRINTF ("        should be:   (implementation-dependent), same as above\n");
  printf ("  Discr:             %d\n", Next_Ptr_Glob->Discr);
  PRINTF ("  Discr:             %d\n", Next_Ptr_Glob->Discr);
  printf ("        should be:   %d\n", 0);
  PRINTF ("        should be:   %d\n", 0);
  printf ("  Enum_Comp:         %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp);
  PRINTF ("  Enum_Comp:         %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp);
  printf ("        should be:   %d\n", 1);
  PRINTF ("        should be:   %d\n", 1);
  printf ("  Int_Comp:          %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp);
  PRINTF ("  Int_Comp:          %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp);
  printf ("        should be:   %d\n", 18);
  PRINTF ("        should be:   %d\n", 18);
  printf ("  Str_Comp:          %s\n",
  PRINTF ("  Str_Comp:          %s\n",
                                Next_Ptr_Glob->variant.var_1.Str_Comp);
                                Next_Ptr_Glob->variant.var_1.Str_Comp);
  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
  PRINTF ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
  printf ("Int_1_Loc:           %d\n", Int_1_Loc);
  PRINTF ("Int_1_Loc:           %d\n", Int_1_Loc);
  printf ("        should be:   %d\n", 5);
  PRINTF ("        should be:   %d\n", 5);
  printf ("Int_2_Loc:           %d\n", Int_2_Loc);
  PRINTF ("Int_2_Loc:           %d\n", Int_2_Loc);
  printf ("        should be:   %d\n", 13);
  PRINTF ("        should be:   %d\n", 13);
  printf ("Int_3_Loc:           %d\n", Int_3_Loc);
  PRINTF ("Int_3_Loc:           %d\n", Int_3_Loc);
  printf ("        should be:   %d\n", 7);
  PRINTF ("        should be:   %d\n", 7);
  printf ("Enum_Loc:            %d\n", Enum_Loc);
  PRINTF ("Enum_Loc:            %d\n", Enum_Loc);
  printf ("        should be:   %d\n", 1);
  PRINTF ("        should be:   %d\n", 1);
  printf ("Str_1_Loc:           %s\n", Str_1_Loc);
  PRINTF ("Str_1_Loc:           %s\n", Str_1_Loc);
  printf ("        should be:   DHRYSTONE PROGRAM, 1'ST STRING\n");
  PRINTF ("        should be:   DHRYSTONE PROGRAM, 1'ST STRING\n");
  printf ("Str_2_Loc:           %s\n", Str_2_Loc);
  PRINTF ("Str_2_Loc:           %s\n", Str_2_Loc);
  printf ("        should be:   DHRYSTONE PROGRAM, 2'ND STRING\n");
  PRINTF ("        should be:   DHRYSTONE PROGRAM, 2'ND STRING\n");
 
 
*/
*/
 
 
 
 
  User_Time = End_Time - Begin_Time;
  User_Time = End_Time - Begin_Time;
 /* microseconds */
 /* microseconds */
 
 
  printf("Begin Time = %d\n",Begin_Time);
  PRINTF("Begin Time = %d\n",Begin_Time);
  printf("End Time   = %d\n",End_Time);
  PRINTF("End Time   = %d\n",End_Time);
 
 
 
 
  if (User_Time < Too_Small_Time)
  if (User_Time < Too_Small_Time)
  {
  {
    printf ("Measured time too small to obtain meaningful results\n");
    PRINTF ("Measured time too small to obtain meaningful results\n");
    printf ("Please increase number of runs\n");
    PRINTF ("Please increase number of runs\n");
    printf ("\n");
    PRINTF ("\n");
  }
  }
  else
  else
  {
  {
#if DLX || OR1K
#if DLX || OR1K
    User_Time /= DLX_FREQ;
    User_Time /= DLX_FREQ;
#if DLX
#if DLX
    printf("DLX ");
    PRINTF("DLX ");
#else
#else
#if OR1K
#if OR1K
    printf("OR1K ");
    PRINTF("OR1K ");
#else
#else
    printf("Unknown CPU ");
    PRINTF("Unknown CPU ");
#endif
#endif
#endif
#endif
    printf("at %u MHz  ", DLX_FREQ);
    PRINTF("at %u MHz  ", DLX_FREQ);
    if (PROC_6)
    if (PROC_6)
            printf("(+PROC_6)");
            PRINTF("(+PROC_6)");
    printf("\n");
    PRINTF("\n");
#endif
#endif
    Microseconds = User_Time / Number_Of_Runs;
    Microseconds = User_Time / Number_Of_Runs;
    Dhrystones_Per_Second = Number_Of_Runs * 1000 / User_Time;
    Dhrystones_Per_Second = Number_Of_Runs * 1000 / User_Time;
    printf ("Microseconds for one run through Dhrystone: ");
    PRINTF ("Microseconds for one run through Dhrystone: ");
    printf ("%d us / %d runs\n", User_Time,Number_Of_Runs);
    PRINTF ("%d us / %d runs\n", User_Time,Number_Of_Runs);
    printf ("Dhrystones per Second:                      ");
    PRINTF ("Dhrystones per Second:                      ");
    printf ("%d \n", Dhrystones_Per_Second);
    PRINTF ("%d \n", Dhrystones_Per_Second);
  }
  }
  report (0xdeaddead);
  report (0xdeaddead);
  return 0;
  return 0;
}
}
 
 
Line 606... Line 606...
{
{
    REG One_Fifty   Int_Index;
    REG One_Fifty   Int_Index;
    REG One_Fifty   Int_Loc;
    REG One_Fifty   Int_Loc;
 
 
#if DBG
#if DBG
      printf("X) Int_1_Par_Val: %x\n", Int_1_Par_Val);
      PRINTF("X) Int_1_Par_Val: %x\n", Int_1_Par_Val);
      printf("X) Int_2_Par_Val: %x\n", Int_2_Par_Val);
      PRINTF("X) Int_2_Par_Val: %x\n", Int_2_Par_Val);
#endif
#endif
 
 
        report(0x20080);
        report(0x20080);
 
 
    Int_Loc = Int_1_Par_Val + 5;
    Int_Loc = Int_1_Par_Val + 5;
Line 623... Line 623...
    Arr_2_Par_Ref[Int_Loc][Int_Loc - 1] += 1;
    Arr_2_Par_Ref[Int_Loc][Int_Loc - 1] += 1;
    Arr_2_Par_Ref[Int_Loc + 20][Int_Loc] = Arr_1_Par_Ref[Int_Loc];
    Arr_2_Par_Ref[Int_Loc + 20][Int_Loc] = Arr_1_Par_Ref[Int_Loc];
    Int_Glob = 5;
    Int_Glob = 5;
 
 
#if DBG
#if DBG
      printf("Y) Int_1_Par_Val: %x\n", Int_1_Par_Val);
      PRINTF("Y) Int_1_Par_Val: %x\n", Int_1_Par_Val);
      printf("Y) Int_2_Par_Val: %x\n", Int_2_Par_Val);
      PRINTF("Y) Int_2_Par_Val: %x\n", Int_2_Par_Val);
#endif
#endif
 
 
}                               /* Proc_8 */
}                               /* Proc_8 */
 
 
 
 

powered by: WebSVN 2.1.0

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