source: trunk/IPs/systemC/Environment/Sim2OS/selftest/main.cpp @ 138

Last change on this file since 138 was 138, checked in by rosiere, 14 years ago

1) add counters_t type for interface
2) fix in check load in load_store_unit
3) add parameters (but not yet implemented)
4) change environment and add script (distcc_env.sh ...)
5) add warning if an unser change rename flag with l.mtspr instruction
6) ...

  • Property svn:keywords set to Id
File size: 3.0 KB
Line 
1#ifdef SYSTEMC
2#include "systemc.h"
3#endif
4#include <iostream>
5#include "../include/Sim2OS.h"
6
7using namespace std;
8using namespace environment;
9using namespace environment::sim2os;
10
11#ifdef SYSTEMC
12int sc_main (int argc, char * argv[])
13#else
14int    main (int argc, char * argv[])
15#endif
16{
17  cout << "<main> Begin" << endl;
18
19  SOCLIB_SEGMENT_TABLE * segtable = new SOCLIB_SEGMENT_TABLE;
20  segtable->setMSBNumber    (8);
21  segtable->setDefaultTarget(0,0);
22 
23  //shared data segment
24
25  const int TEXT_BASE          = 0x1000;
26  const int DATA_CACHED_BASE   = 0x2000;
27  const int DATA_UNCACHED_BASE = 0x3000;
28  const int STACK_BASE         = 0x4000;
29  const int TTY_BASE           = 0x5000;
30  const int SIM2OS_BASE        = 0x6000;
31  const int RAMLOCK_BASE       = 0x7000;
32 
33  const int TEXT_SIZE          = 0x100;
34  const int DATA_CACHED_SIZE   = 0x100;
35  const int DATA_UNCACHED_SIZE = 0x100;
36  const int STACK_SIZE         = 0x100;
37  const int TTY_SIZE           = 0x100;
38  const int SIM2OS_SIZE        = 0x100;
39  const int RAMLOCK_SIZE       = 0x100;
40
41  // Add a segment   :name        , address of base    , size               , global index , local index, uncache
42  segtable->addSegment("text"      , TEXT_BASE          , TEXT_SIZE          , 0            ,0           , false);
43  segtable->addSegment("data"      , DATA_CACHED_BASE   , DATA_CACHED_SIZE   , 0            ,0           , false);
44  segtable->addSegment("data_unc"  , DATA_UNCACHED_BASE , DATA_UNCACHED_SIZE , 0            ,0           , true );
45  segtable->addSegment("stack"     , STACK_BASE         , STACK_SIZE         , 0            ,0           , false);
46  segtable->addSegment("tty"       , TTY_BASE           , TTY_SIZE           , 0            ,0           , true );
47  segtable->addSegment("sim2os"    , SIM2OS_BASE        , SIM2OS_SIZE        , 0            ,0           , true );
48  segtable->addSegment("ramlock"   , RAMLOCK_BASE       , RAMLOCK_SIZE       , 0            ,0           , true );
49
50  segtable->print();
51
52  Parameters * param = new Parameters (segtable);
53 
54  Sim2OS * my_sim2os = new Sim2OS ("my_sim2os",param);
55
56  cout << *my_sim2os << endl;
57
58  my_sim2os->transition();
59  my_sim2os->transition();
60  my_sim2os->transition();
61  my_sim2os->transition();
62  my_sim2os->transition();
63  my_sim2os->transition();
64  my_sim2os->transition();
65  my_sim2os->transition(); // cycle 8
66
67  my_sim2os->parameter(1,(void*)  21071981);
68  my_sim2os->parameter(2,(void*)0xdeadbeef);
69  my_sim2os->parameter(0,(void*)5); // SERVICE_CLOCK
70
71  cout << *my_sim2os << endl;
72  my_sim2os->execute();
73  cout << *my_sim2os << endl;
74
75//   char * pathname = "toto.txt";
76//   int    flags    = O_CREAT;
77//   mode_t mode     = 0777;
78
79//   my_sim2os->parameter(1,(void*)pathname);
80//   my_sim2os->parameter(2,(void*)flags   );
81//   my_sim2os->parameter(3,(void*)mode    );
82//   my_sim2os->parameter(0,(void*)0       );
83
84//   cout << *my_sim2os << endl;
85//   my_sim2os->execute();
86//   cout << *my_sim2os << endl;
87
88  delete my_sim2os;
89  delete param;
90  delete segtable;
91
92  cout << "<main> End" << endl;
93
94  return EXIT_SUCCESS;
95}
Note: See TracBrowser for help on using the repository browser.