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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [libtoplevel.c] - Diff between revs 143 and 220

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

Rev 143 Rev 220
Line 49... Line 49...
 
 
 
 
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/*!Initialize the simulator.
/*!Initialize the simulator.
 
 
   Allows specification of an (optional) config file and an image file. Builds
   The user can pass in any arguments acceptable to the standalone
   up dummy argc/argv to pass to the existing argument parser.
   simulator. Not all make any sense in a library environment.
 
 
   @param[in] config_file  Or1ksim configuration file name
   @param[in] argc         Size of argument vector
   @param[in] image_file   The program image to execute
   @param[in] argv         Argument vector
   @param[in] class_ptr    Pointer to a C++ class instance (for use when
   @param[in] class_ptr    Pointer to a C++ class instance (for use when
                           called by C++)
                           called by C++)
   @param[in] upr          Upcall routine for reads
   @param[in] upr          Upcall routine for reads
   @param[in] upw          Upcall routine for writes
   @param[in] upw          Upcall routine for writes
 
 
   @return  0 on success and an error code on failure                        */
   @return  0 on success and an error code on failure                        */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
int
int
or1ksim_init (const char *config_file,
or1ksim_init (int         argc,
              const char *image_file,
              char       *argv[],
              void       *class_ptr,
              void       *class_ptr,
              int       (*upr) (void              *class_ptr,
              int       (*upr) (void              *class_ptr,
                                unsigned long int  addr,
                                unsigned long int  addr,
                                unsigned char      mask[],
                                unsigned char      mask[],
                                unsigned char      rdata[],
                                unsigned char      rdata[],
Line 76... Line 76...
                                unsigned long int  addr,
                                unsigned long int  addr,
                                unsigned char      mask[],
                                unsigned char      mask[],
                                unsigned char      wdata[],
                                unsigned char      wdata[],
                                int                data_len))
                                int                data_len))
{
{
  int   dummy_argc;
 
  char *dummy_argv[4];
 
 
 
  /* Dummy argv array. Varies depending on whether an image file is
 
     specified. */
 
  dummy_argv[0] = "libsim";
 
  dummy_argv[1] = "-f";
 
  dummy_argv[2] = (char *) ((NULL != config_file) ? config_file : "sim.cfg");
 
  dummy_argv[3] = (char *) image_file;
 
 
 
  dummy_argc = (NULL == image_file) ? 3 : 4;
 
 
 
  /* Initialization copied from existing main() */
  /* Initialization copied from existing main() */
  srand (getpid ());
  srand (getpid ());
  init_defconfig ();
  init_defconfig ();
  reg_config_secs ();
  reg_config_secs ();
 
 
  if (parse_args (dummy_argc, dummy_argv))
  if (parse_args (argc, argv))
    {
    {
      return OR1KSIM_RC_BADINIT;
      return OR1KSIM_RC_BADINIT;
    }
    }
 
 
  config.sim.is_library = 1;    /* Library operation */
  config.sim.is_library = 1;    /* Library operation */

powered by: WebSVN 2.1.0

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