OVP Forums - A community of assistance, help, questions, and answers.
  FAQFAQ    SearchSearch      RegisterRegister  ProfileProfile    Log in to check your private messagesLog in to check your private messages    Log inLog in
Slow cache?

 
Post new topic   Reply to topic    Open Virtual Platforms Forum Index -> Ask a Question
View previous topic :: View next topic  
Author Message
AntonioPrioletti



Joined: 02 May 2011
Posts: 20

PostPosted: Mon Oct 03, 2011 11:37 pm    Post subject: Slow cache? Reply with quote

Hi, i want to see you a very strange problem. I have a follow platform:

Code:


/*
 *
 * Copyright (c) 2005-2011 Imperas Software Ltd., www.imperas.com
 *
 * The contents of this file are provided under the Software License
 * Agreement that you accepted before downloading this file.
 *
 * This source forms part of the Software and can be used for educational,
 * training, and demonstration purposes but cannot be used for derivative
 * works except in cases where the derivative works require OVP technology
 * to run.
 *
 * For open source models released under licenses that you can use for
 * derivative works, please visit www.OVPworld.org or www.imperas.com
 * for the location of the open source models.
 *
 */

#include <stdio>
#include <stdlib>

#include "icm/icmCpuManager.h"

#define SIM_ATTRS (ICM_ATTR_RELAXED_SCHED)

//
// Main simulation routine
//
int main(int argc, char ** argv) {

    int portNum;
    const char *appName;
   
    // check for the application program name argument
    if(argc<2) {
        icmPrintf("usage: %s <application> [<port> <processor>]\n", argv[0]);
        return -1;
    }
    if(argc<3){
        // initialize ICM - require Imperas intercepts because the
        // application uses impProcessorId() to get processor id
        icmInit(ICM_VERBOSE|ICM_ENABLE_IMPERAS_INTERCEPTS, 0, 0);
    }
    else {
         if(argc<4){
              icmPrintf("usage: %s <application> <port> <processor> \n", argv[0]);
              return -1;     
         }
         else{
                  sscanf(argv[2], "%d", &portNum);
                  // initialize ICM - require Imperas intercepts because the
                  // application uses impProcessorId() to get processor id
                  icmInit(ICM_VERBOSE|ICM_ENABLE_IMPERAS_INTERCEPTS, "rsp", portNum);
         }
    }
   
    appName = argv[1];
   
    // select library components
   const char *vlnvRoot = NULL; //When NULL use default library
    const char *model       = icmGetVlnvString(vlnvRoot, "ovpworld.org", "processor", "or1k", "1.0", "model");
    const char *semihosting = icmGetVlnvString(vlnvRoot, "ovpworld.org", "semihosting", "or1kNewlib", "1.0", "model");
    const char *mmc_model = icmGetVlnvString( vlnvRoot, "ovpworld.org", "mmc", "wb_1way_32byteline_2048tags", "1.0","model");

    // create processor cpu0
    icmProcessorP processor0 = icmNewProcessor(
        "cpu0",             // CPU name
        "or1k",             // CPU type
        0,                  // CPU cpuId
        0,                  // CPU model flags
        32,                 // address bits
        model,              // model file
        "modelAttrs",       // morpher attributes
        SIM_ATTRS,          // simulation attributes
        0,                  // user-defined attributes
        semihosting,        // semi-hosting file
        "modelAttrs"        // semi-hosting attributes
    );
   
    //create processor cpu1
    icmProcessorP processor1 = icmNewProcessor(
        "cpu1",             // CPU name
        "or1k",             // CPU type
        1,                  // CPU cpuId
        0,                  // CPU model flags
        32,                 // address bits
        model,              // model file
        "modelAttrs",       // morpher attributes
        SIM_ATTRS,          // simulation attributes
        0,                  // user-defined attributes
        semihosting,        // semi-hosting file
        "modelAttrs"        // semi-hosting attributes
    );
   
   
    // create full MMCs
    icmMmcP mmci1 = icmNewMMC("mmci1", mmc_model, "modelAttrs", 0, 0, False);
    icmMmcP mmcd1 = icmNewMMC("mmcd1", mmc_model, "modelAttrs", 0, 0, False);
   
    icmMmcP mmci2 = icmNewMMC("mmci2", mmc_model, "modelAttrs", 0, 0, False);
    icmMmcP mmcd2 = icmNewMMC("mmcd2", mmc_model, "modelAttrs", 0, 0, False);

    // create the processor instruction bus and data bus
    icmBusP ibus1 = icmNewBus("ibus1", 32);
    icmBusP dbus1 = icmNewBus("dbus1", 32);

    icmBusP ibus2 = icmNewBus("ibus2", 32);
    icmBusP dbus2 = icmNewBus("dbus2", 32);
   
    // main bus
    icmBusP mbus1 = icmNewBus("mbus1", 32);
    icmBusP mbus2 = icmNewBus("mbus2", 32);
   
    // connect processor ports to their buses
    icmConnectProcessorBusses(processor0, ibus1, dbus1);
    icmConnectProcessorBusses(processor1, ibus2, dbus2);
   
    // connect MMCs to buses
    icmConnectMMCBus(mmci1, ibus1, "sp1", False);
    icmConnectMMCBus(mmcd1, dbus1, "sp1", False);
   
    icmConnectMMCBus(mmci2, ibus2, "sp1", False);
    icmConnectMMCBus(mmcd2, dbus2, "sp1", False);
   
    // connect master ports of MMC layer 1 to buscache
    icmConnectMMCBus(mmci1, mbus1, "mp1", True);
    icmConnectMMCBus(mmcd1, mbus1, "mp1", True);
   
    icmConnectMMCBus(mmci2, mbus2, "mp1", True);
    icmConnectMMCBus(mmcd2, mbus2, "mp1", True);
   
    // create memories
    icmMemoryP memory1 = icmNewMemory("mem1", ICM_PRIV_RWX, 0xffffffff);
    icmMemoryP memory2 = icmNewMemory("mem2", ICM_PRIV_RWX, 0xffffffff);
   
    // connect memory to main bus
    icmConnectMemoryToBus(mbus1, "mp1", memory1, 0x00000000);
    icmConnectMemoryToBus(mbus2, "mp1", memory2, 0x00000000);
   
    // show the bus connections

    icmPrintf("\nmbus1 CONNECTIONS\n");
    icmPrintBusConnections(mbus1);
    icmPrintf("\nmbus1 CONNECTIONS\n");
    icmPrintBusConnections(mbus2);
    icmPrintf("\nibus1 CONNECTIONS\n");
    icmPrintBusConnections(ibus1);
    icmPrintf("\nibus2 CONNECTIONS\n");
    icmPrintBusConnections(ibus2);
    icmPrintf("\ndbus1 CONNECTIONS\n");
    icmPrintBusConnections(dbus1);
    icmPrintf("\ndbus2 CONNECTIONS\n");
    icmPrintBusConnections(dbus2);
    icmPrintf("\n");
   
   
    if(argc == 4 ){
            icmProcessorP sub = icmFindProcessorByName(argv[3]);
            icmDebugThisProcessor(sub);
    }
   
   
    // load the processor object file - because all memory is shared, both
    // processors will execute the same application code
    icmLoadProcessorMemory(processor0, appName, False, False, True);
    icmLoadProcessorMemory(processor1, appName, False, False, True);

    // run simulation
    icmSimulatePlatform();

    // report the total number of instructions executed
    icmPrintf(
        "processor0 has executed " FMT_64u " instructions\n",
        icmGetProcessorICount(processor0)
    );
    icmPrintf(
        "processor1 has executed " FMT_64u " instructions\n",
        icmGetProcessorICount(processor1)
    );

    // free simulation data structures
    icmTerminate();

    return 0;
}



and run on it dhrystone:

Code:



#include "stdio.h"
#include <stdlib>


#define Mic_secs_Per_Second     1000000.0
                /* Berkeley UNIX C returns process times in seconds/HZ */

#ifdef  NOSTRUCTASSIGN
#define structassign(d, s)      memcpy(&(d), &(s), sizeof(d))
#else
#define structassign(d, s)      d = s
#endif

#ifdef  NOENUM
#define Ident_1 0
#define Ident_2 1
#define Ident_3 2
#define Ident_4 3
#define Ident_5 4
  typedef int   Enumeration;
#else
  typedef       enum    {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5}
                Enumeration;
#endif
        /* for boolean and enumeration types in Ada, Pascal */

/* General definitions: */

/* #include <stdio>
 */
                /* for strcpy, strcmp */

#define Null 0
                /* Value of a Null pointer */
#define true  1
#define false 0

typedef int     One_Thirty;
typedef int     One_Fifty;
typedef char    Capital_Letter;
typedef int     Boolean;
typedef char    Str_30 [31];
typedef int     Arr_1_Dim [50];
typedef int     Arr_2_Dim [50] [50];

typedef struct record
    {
    struct record *Ptr_Comp;
    Enumeration    Discr;
    union {
          struct {
                  Enumeration Enum_Comp;
                  int         Int_Comp;
                  char        Str_Comp [31];
                  } var_1;
          struct {
                  Enumeration E_Comp_2;
                  char        Str_2_Comp [31];
                  } var_2;
          struct {
                  char        Ch_1_Comp;
                  char        Ch_2_Comp;
                  } var_3;
          } variant;
      } Rec_Type, *Rec_Pointer;


//#define NUM_RUNS (20)
#define NUM_RUNS (8000)
#define DLX_FREQ 200  /* in MHz */
#define PROC_6 0

void Ireport ( int c ) {
  // report(c);
}

#ifndef strcpy
char *strcpy (char *dst0, const char *src0)
{
  char *s = dst0;

  while ((*dst0++ = *src0++));

  return s;   
}
#endif

#ifndef strcmp
int strcmp (const char *s1, const char *s2)
{
  while (*s1 && *s2 && *s1 == *s2) {
    s1++;
    s2++;
  }
  return (*(unsigned char *) s1) - (*(unsigned char *) s2);
}
#endif

#define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
#define UNALIGNED(X, Y) \
  (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))


/* Global Variables: */

Rec_Pointer     Ptr_Glob,
                Next_Ptr_Glob;
int             Int_Glob;
Boolean         Bool_Glob;
char            Ch_1_Glob,
                Ch_2_Glob;
int             Arr_1_Glob [50];
int             Arr_2_Glob [50] [50];


  /* forward declaration necessary since Enumeration may not simply be int */

#ifndef REG
        Boolean Reg = false;
#define REG
        /* REG becomes defined as empty */
        /* i.e. no register variables   */
#else
        Boolean Reg = true;
#endif

/* variables for time measurement: */

#if DLX || OR1K
#define Too_Small_Time DLX_FREQ
#else
#define Too_Small_Time 1
#endif

#define TIMER0 0
#define TIMER1 1





unsigned int   Begin_Time,
                End_Time,
                User_Time,
      Microseconds,
      Dhrystones_Per_Second;

/* end of variables for time measurement */


void Proc_1(REG Rec_Pointer Ptr_Val_Par);
void Proc_2(One_Fifty      *Int_Par_Ref);
void Proc_3(Rec_Pointer    *Ptr_Ref_Par);
void Proc_4();
void Proc_5();
void Proc_6(
    Enumeration     Enum_Val_Par,
    Enumeration    *Enum_Ref_Par);
void Proc_7(
    One_Fifty       Int_1_Par_Val,
    One_Fifty       Int_2_Par_Val,
    One_Fifty      *Int_Par_Ref);
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);
Enumeration Func_1(Capital_Letter Ch_1_Par_Val,
                   Capital_Letter Ch_2_Par_Val);
Boolean Func_2(Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref);
Boolean Func_3(Enumeration     Enum_Par_Val);

int main ()
/*****/

  /* main program, corresponds to procedures        */
  /* Main and Proc_0 in the Ada version             */
{
        One_Fifty       Int_1_Loc;
  REG   One_Fifty       Int_2_Loc=0;
        One_Fifty       Int_3_Loc;
  REG   char            Ch_Index;
        Enumeration     Enum_Loc;
        Str_30          Str_1_Loc;
        Str_30          Str_2_Loc;
  REG   int             Run_Index;
  REG   int             Number_Of_Runs;
  Rec_Type      x, y;

  /* Initializations */

  Next_Ptr_Glob = (Rec_Pointer) &x;
  Ptr_Glob = (Rec_Pointer) &y;

  Ptr_Glob->Ptr_Comp                    = Next_Ptr_Glob;
  Ptr_Glob->Discr                       = Ident_1;
  Ptr_Glob->variant.var_1.Enum_Comp     = Ident_3;
  Ptr_Glob->variant.var_1.Int_Comp      = 40;
  strcpy (Ptr_Glob->variant.var_1.Str_Comp,
          "DHRYSTONE PROGRAM, SOME STRING");
  strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");

  Arr_2_Glob [8][7] = 10;
        /* Was missing in published program. Without this statement,    */
        /* Arr_2_Glob [8][7] would have an undefined value.             */
        /* Warning: With 16-Bit processors and Number_Of_Runs > 32000,  */
        /* overflow may occur for this array element.                   */

/* Initalize Data and Instruction Cache */


  printf (" %c", '\n');
  printf ("Dhrystone Benchmark, Version 2.1 (Language: C)%c", '\n');
  printf (" %c", '\n');
  if (Reg)
  {
    printf ("Program compiled with 'register' attribute%c", '\n');
    printf (" %c", '\n');
  }
  else
  {
    printf ("Program compiled without 'register' attribute%c", '\n');
    printf (" %c", '\n');
  }
  printf ("Please give the number of runs through the benchmark:%c", ' ');

  {
    int n;
    /* scanf ("%d", &n);
 */
    n = NUM_RUNS;
    Number_Of_Runs = n;
  }
  printf (" %c", '\n');

  printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
 


  for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
  {
    printf("\n"); // THIS IS THE PROBLEM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   Ireport(1);
   Ireport(Run_Index);
    Proc_5();
   Ireport(2);
    Proc_4();
   Ireport(3);
      /* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */
    Int_1_Loc = 2;
    Int_2_Loc = 3;
    strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
    Enum_Loc = Ident_2;
   Ireport(0x31);
   Ireport((unsigned long)Str_1_Loc);
   Ireport((unsigned long)Str_2_Loc);
   
    Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
      /* Bool_Glob == 1 */
   Ireport(4);
    while (Int_1_Loc < Int_2_Loc)  /* loop body executed once */
    {
      Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
        /* Int_3_Loc == 7 */
      Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
        /* Int_3_Loc == 7 */
      Int_1_Loc += 1;
    } /* while */
   Ireport(5);
      /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
#if DBG
      printf("a) Int_1_Loc: %x\n", Int_1_Loc);
      printf("a) Int_2_Loc: %x\n", Int_2_Loc);
      printf("a) Int_3_Loc: %x\n\n", Int_3_Loc);
#endif
    Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc);
      /* Int_Glob == 5 */
#if DBG
      printf("b) Int_1_Loc: %x\n", Int_1_Loc);
      printf("b) Int_2_Loc: %x\n", Int_2_Loc);
      printf("b) Int_3_Loc: %x\n\n", Int_3_Loc);
#endif
   Ireport(6);

    Proc_1 (Ptr_Glob);
#if DBG
      printf("c) Int_1_Loc: %x\n", Int_1_Loc);
      printf("c) Int_2_Loc: %x\n", Int_2_Loc);
      printf("c) Int_3_Loc: %x\n\n", Int_3_Loc);
#endif
   Ireport(7);

    for (Ch_Index = 'A'; Ch_Index <Ch_2_Glob>Ptr_Comp);
  printf ("        should be:   (implementation-dependent)%c", '\n');
  printf ("  Discr:             %d\n", Ptr_Glob->Discr);
  printf ("        should be:   %d\n", 0);
  printf ("  Enum_Comp:         %d\n", Ptr_Glob->variant.var_1.Enum_Comp);
  printf ("        should be:   %d\n", 2);
  printf ("  Int_Comp:          %d\n", Ptr_Glob->variant.var_1.Int_Comp);
  printf ("        should be:   %d\n", 17);
  printf ("  Str_Comp:          %s\n", Ptr_Glob->variant.var_1.Str_Comp);
  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING%c", '\n');
  printf ("Next_Ptr_Glob->%c", '\n');
//  printf ("  Ptr_Comp:          %d\n", (int) Next_Ptr_Glob->Ptr_Comp);
  printf ("        should be:   (implementation-dependent), same as above%c", '\n');
  printf ("  Discr:             %d\n", Next_Ptr_Glob->Discr);
  printf ("        should be:   %d\n", 0);
  printf ("  Enum_Comp:         %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp);
  printf ("        should be:   %d\n", 1);
  printf ("  Int_Comp:          %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp);
  printf ("        should be:   %d\n", 18);
  printf ("  Str_Comp:          %s\n",
                                Next_Ptr_Glob->variant.var_1.Str_Comp);
  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING%c", '\n');
  printf ("Int_1_Loc:           %d\n", Int_1_Loc);
  printf ("        should be:   %d\n", 5);
  printf ("Int_2_Loc:           %d\n", Int_2_Loc);
  printf ("        should be:   %d\n", 13);
  printf ("Int_3_Loc:           %d\n", Int_3_Loc);
  printf ("        should be:   %d\n", 7);
  printf ("Enum_Loc:            %d\n", Enum_Loc);
  printf ("        should be:   %d\n", 1);
  printf ("Str_1_Loc:           %s\n", Str_1_Loc);
  printf ("        should be:   DHRYSTONE PROGRAM, 1'ST STRING%c", '\n');
  printf ("Str_2_Loc:           %s\n", Str_2_Loc);
  printf ("        should be:   DHRYSTONE PROGRAM, 2'ND STRING%c", '\n');




  User_Time = End_Time - Begin_Time;
 /* microseconds */

  printf("Begin Time = %d\n",Begin_Time);
  printf("End Time   = %d\n",End_Time);
 

  if (User_Time <Too_Small_Time>Ptr_Comp;
   /* == Ptr_Glob_Next */
   /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp,    */
   /* corresponds to "rename" in Ada, "with" in Pascal           */

   Ireport(0x20010);
   
   structassign(*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob);
   Ptr_Val_Par->variant.var_1.Int_Comp = 5;
   Next_Record->variant.var_1.Int_Comp
   = Ptr_Val_Par->variant.var_1.Int_Comp;
   Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
   Proc_3(&Next_Record->Ptr_Comp);
   Ireport(0x20011);
   /*
    * Ptr_Val_Par->Ptr_Comp->Ptr_Comp == Ptr_Glob->Ptr_Comp
    */
   if (Next_Record->Discr == Ident_1)
   /* then, executed */
   {
   Next_Record->variant.var_1.Int_Comp = 6;
   Proc_6(Ptr_Val_Par->variant.var_1.Enum_Comp,
         &Next_Record->variant.var_1.Enum_Comp);
   Ireport(0x20012);
   Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
   Proc_7(Next_Record->variant.var_1.Int_Comp, 10,
         &Next_Record->variant.var_1.Int_Comp);
   } else          /* not executed */
   structassign(*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp);
   Ireport(0x20013);

}               /* Proc_1 */


void
  Proc_2(Int_Par_Ref)
/******************/
 /* executed once */
 /* *Int_Par_Ref == 1, becomes 4 */

   One_Fifty      *Int_Par_Ref;
{
   One_Fifty       Int_Loc;
   Enumeration     Enum_Loc = 0;

   Ireport(0x20020);

   Int_Loc = *Int_Par_Ref + 10;
   do              /* executed once */
   if (Ch_1_Glob == 'A')
      /* then, executed */
   {
      Int_Loc -= 1;
      *Int_Par_Ref = Int_Loc - Int_Glob;
      Enum_Loc = Ident_1;
   }           /* if */
   while (Enum_Loc != Ident_1);/* true */
}               /* Proc_2 */


void
  Proc_3(Ptr_Ref_Par)
/******************/
 /* executed once */
 /* Ptr_Ref_Par becomes Ptr_Glob */

   Rec_Pointer    *Ptr_Ref_Par;

{
   Ireport(0x20030);

   if (Ptr_Glob != Null)
   /* then, executed */
   *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
   Proc_7(10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
}               /* Proc_3 */


void
  Proc_4()
{               /* without parameters */
   /*******/
   /* executed once */
   Boolean         Bool_Loc;

   Ireport(0x20040);

   Bool_Loc = Ch_1_Glob == 'A';
   Bool_Glob = Bool_Loc | Bool_Glob;
   Ch_2_Glob = 'B';
}               /* Proc_4 */


void
  Proc_5()
{               /* without parameters */
   /*******/
   /* executed once */
   Ireport(0x20050);

   Ch_1_Glob = 'A';
   Bool_Glob = false;
}               /* Proc_5 */

/* @(#)dhry_2.c   1.2 92/05/28 14:44:54, AMD */
/*
 ****************************************************************************
 *
 *                   "DHRYSTONE" Benchmark Program
 *                   -----------------------------
 *
 *  Version:    C, Version 2.1
 *
 *  File:       dhry_2.c (part 3 of 3)
 *
 *  Date:       May 25, 1988
 *
 *  Author:     Reinhold P. Weicker
 *
 ****************************************************************************
 */

#ifndef REG
#define REG
 /* REG becomes defined as empty */
 /* i.e. no register variables   */
#ifdef _AM29K
#undef REG
#define REG register   /* Define REG; saves room on 127-char MS-DOS cmd line */
#endif
#endif


void
  Proc_6(Enum_Val_Par, Enum_Ref_Par)
/*********************************/
 /* executed once */
 /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */

    Enumeration     Enum_Val_Par;
    Enumeration    *Enum_Ref_Par;
{
#if PROC_6
   Ireport(0x20060);

    *Enum_Ref_Par = Enum_Val_Par;
    if (!Func_3(Enum_Val_Par))
   /* then, not executed */
   *Enum_Ref_Par = Ident_4;
    switch (Enum_Val_Par) {
    case Ident_1:
   *Enum_Ref_Par = Ident_1;
   break;
    case Ident_2:
   if (Int_Glob > 100)
       /* then */
       *Enum_Ref_Par = Ident_1;
   else
       *Enum_Ref_Par = Ident_4;
   break;
    case Ident_3:      /* executed */
   *Enum_Ref_Par = Ident_2;
   break;
    case Ident_4:
   break;
    case Ident_5:
   *Enum_Ref_Par = Ident_3;
   break;
    }            /* switch */
#endif
    return;
}            /* Proc_6 */


void
  Proc_7(Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
/**********************************************/
 /* executed three times                                      */
 /* first call:      Int_1_Par_Val == 2, Int_2_Par_Val == 3,  */
 /* Int_Par_Ref becomes 7                    */
 /* second call:     Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
 /* Int_Par_Ref becomes 17                   */
 /* third call:      Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
 /* Int_Par_Ref becomes 18                   */
    One_Fifty       Int_1_Par_Val;
    One_Fifty       Int_2_Par_Val;
    One_Fifty      *Int_Par_Ref;
{
    One_Fifty       Int_Loc;

   Ireport(0x20070);

    Int_Loc = Int_1_Par_Val + 2;
    *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
}            /* Proc_7 */


void
  Proc_8(Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
/*********************************************************************/
 /* executed once      */
 /* Int_Par_Val_1 == 3 */
 /* Int_Par_Val_2 == 7 */
    Arr_1_Dim       Arr_1_Par_Ref;
    Arr_2_Dim       Arr_2_Par_Ref;
    int             Int_1_Par_Val;
    int             Int_2_Par_Val;
{
    REG One_Fifty   Int_Index;
    REG One_Fifty   Int_Loc;

#if DBG
      printf("X) Int_1_Par_Val: %x\n", Int_1_Par_Val);
      printf("X) Int_2_Par_Val: %x\n", Int_2_Par_Val);
#endif

   Ireport(0x20080);

    Int_Loc = Int_1_Par_Val + 5;
    Arr_1_Par_Ref[Int_Loc] = Int_2_Par_Val;
    Arr_1_Par_Ref[Int_Loc + 1] = Arr_1_Par_Ref[Int_Loc];
    Arr_1_Par_Ref[Int_Loc + 30] = Int_Loc;
    for (Int_Index = Int_Loc; Int_Index <= Int_Loc + 1; ++Int_Index)
   Arr_2_Par_Ref[Int_Loc][Int_Index] = Int_Loc;
    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];
    Int_Glob = 5;

#if DBG
      printf("Y) Int_1_Par_Val: %x\n", Int_1_Par_Val);
      printf("Y) Int_2_Par_Val: %x\n", Int_2_Par_Val);
#endif

}            /* Proc_8 */


Enumeration
  Func_1(Ch_1_Par_Val, Ch_2_Par_Val)
/*************************************************/
 /* executed three times                                         */
 /* first call:      Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R'    */
 /* second call:     Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C'    */
 /* third call:      Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C'    */

    Capital_Letter  Ch_1_Par_Val;
    Capital_Letter  Ch_2_Par_Val;
{
    Capital_Letter  Ch_1_Loc;
    Capital_Letter  Ch_2_Loc;

   Ireport(0x30010);

    Ch_1_Loc = Ch_1_Par_Val;
    Ch_2_Loc = Ch_1_Loc;
    if (Ch_2_Loc != Ch_2_Par_Val)
   /* then, executed */
   return (Ident_1);
    else {         /* not executed */
   Ch_1_Glob = Ch_1_Loc;
   return (Ident_2);
    }
}            /* Func_1 */


Boolean
  Func_2(Str_1_Par_Ref, Str_2_Par_Ref)
/*************************************************/
 /* executed once */
 /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
 /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */

    Str_30          Str_1_Par_Ref;
    Str_30          Str_2_Par_Ref;
{
    REG One_Thirty  Int_Loc;
    Capital_Letter  Ch_Loc = 0;

   Ireport(0x30020);

    Int_Loc = 2;
    while (Int_Loc <2>= 'W' && Ch_Loc < 'Z')
   /* then, not executed */
   Int_Loc = 7;
   Ireport(0x30022);
    if (Ch_Loc == 'R')
   /* then, not executed */
   return (true);
    else {         /* executed */
   Ireport(0x30023);
   if (strcmp(Str_1_Par_Ref, Str_2_Par_Ref) > 0)
       /* then, not executed */
   {
       Int_Loc += 7;
       Int_Glob = Int_Loc;
       return (true);
   } else         /* executed */
       return (false);
    }            /* if Ch_Loc */
}            /* Func_2 */


Boolean
  Func_3(Enum_Par_Val)
/***************************/
 /* executed once        */
 /* Enum_Par_Val == Ident_3 */
    Enumeration     Enum_Par_Val;
{
    Enumeration     Enum_Loc;

    Enum_Loc = Enum_Par_Val;
   Ireport(0x30030);
    if (Enum_Loc == Ident_3)
   /* then, executed */
   return (true);
    else         /* not executed */
   return (false);
}            /* Func_3 */




if i don't have in main function a printf function in the for cycle, the platform crashes. Why I must enter a printf function????
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1656
Location: United Kingdom

PostPosted: Fri Oct 07, 2011 5:35 am    Post subject: Reply with quote

The modified Dhrystone application you posted into the forum is corrupt i.e. it does not compile. I have sent you a PM with an email address for you to send the original files and I will take a look at your problem.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Open Virtual Platforms Forum Index -> Ask a Question All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Information regarding OVP © 2008-2022 Imperas Software