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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel-0-3-0-rc2/] [or1ksim/] [toplevel.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 cvs
/* toplevel.c -- Top level simulator source file
2 1748 jeremybenn
 
3 2 cvs
   Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
4 1748 jeremybenn
   Copyright (C) 2008 Embecosm Limited
5 2 cvs
 
6 1748 jeremybenn
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
7 2 cvs
 
8 1748 jeremybenn
   This file is part of Or1ksim, the OpenRISC 1000 Architectural Simulator.
9 2 cvs
 
10 1748 jeremybenn
   This program is free software; you can redistribute it and/or modify it
11
   under the terms of the GNU General Public License as published by the Free
12
   Software Foundation; either version 3 of the License, or (at your option)
13
   any later version.
14 2 cvs
 
15 1748 jeremybenn
   This program is distributed in the hope that it will be useful, but WITHOUT
16
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
18
   more details.
19 2 cvs
 
20 1748 jeremybenn
   You should have received a copy of the GNU General Public License along
21
   with this program.  If not, see <http://www.gnu.org/licenses/>.  */
22 2 cvs
 
23 1748 jeremybenn
/* This program is commented throughout in a fashion suitable for processing
24
   with Doxygen. */
25 16 jrydberg
 
26 1745 jeremybenn
 
27 1748 jeremybenn
/* Autoconf and/or portability configuration */
28 1350 nogj
#include "config.h"
29
 
30 1748 jeremybenn
/* System includes */
31
#include <stdlib.h>
32
#include <unistd.h>
33
#include <signal.h>
34 1350 nogj
 
35 1745 jeremybenn
/* Package includes */
36 69 lampret
#include "sim-config.h"
37 1748 jeremybenn
#include "toplevel-support.h"
38 1432 nogj
#include "execute.h"
39 632 ivang
 
40 2 cvs
 
41 1748 jeremybenn
/*---------------------------------------------------------------------------*/
42
/*!Main function
43 2 cvs
 
44 1748 jeremybenn
   Set up the standalone simulation. Initialize the default configuration and
45
   register all the sections that may appear in a user configuration.
46 2 cvs
 
47 1748 jeremybenn
   Then attempt to parse the args, configure the system from any configuration
48
   file specified and print out the configuration used.
49 304 markom
 
50 1748 jeremybenn
   Add a signal hander, so ctrl-C will drop the user into the CLI.
51 883 markom
 
52 1748 jeremybenn
   The initialize the simulator, call the appropriate main simulator function
53
   and when it returns tidy up.
54 1745 jeremybenn
 
55 1748 jeremybenn
   @param[in] argc  The number of arguments to the command
56
   @param[in] argv  The vector of argument strings
57 1745 jeremybenn
 
58 1748 jeremybenn
   @return  The return code required from the simulator. This is actually
59
            achieved by calling exit() with the return code, rather than
60
            returning an explict value.                                      */
61
/*---------------------------------------------------------------------------*/
62
int
63
main (int   argc,
64
      char *argv[])
65
{
66
  srand (getpid ());
67
  init_defconfig ();
68
  reg_config_secs ();
69 335 markom
 
70 1748 jeremybenn
  if (parse_args (argc, argv))
71
    {
72
      exit (-1);                /* Parse args will have printed any messages */
73
    }
74
 
75
  print_config ();
76
  signal (SIGINT, ctrl_c);
77
 
78 1353 nogj
  runtime.sim.hush = 1;
79 1748 jeremybenn
  do_stats         = config.cpu.superscalar ||
80
                     config.cpu.dependstats ||
81
                     config.sim.history     ||
82
                     config.sim.exe_log;
83 1353 nogj
 
84 1471 nogj
  sim_init ();
85
 
86 1692 nogj
#if DYNAMIC_EXECUTION
87 1748 jeremybenn
  dyn_main ();
88 1692 nogj
#else
89 1748 jeremybenn
  exec_main ();
90 1692 nogj
#endif
91 127 chris
 
92 1748 jeremybenn
  sim_done ();
93
  exit (0);
94 2 cvs
}

powered by: WebSVN 2.1.0

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