source: trunk/IPs/systemC/Environment/RamLock/selftest/main.cpp @ 146

Last change on this file since 146 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: 1.2 KB
Line 
1#ifdef SYSTEMC
2#include "systemc.h"
3#endif
4#include "../include/RamLock.h"
5#include <iostream>
6
7using namespace std;
8using namespace environment;
9using namespace environment::ramlock;
10
11
12#define TEST(x,y)                               \
13  {                                             \
14    cout << "Line " << __LINE__ << " : ";       \
15    if (x==y)                                   \
16      {                                         \
17        cout << "Test OK";                      \
18      }                                         \
19    else                                        \
20      {                                         \
21        cout << "Test KO";                      \
22        exit (EXIT_FAILURE);                    \
23      }                                         \
24    cout << endl;                               \
25  } while (0)
26   
27
28
29#ifdef SYSTEMC
30int sc_main (int argc, char * argv[])
31#else
32int    main (int argc, char * argv[])
33#endif
34{
35  cout << "<main> Begin" << endl;
36
37  cout << "  * Create a Ramlock with a size of 70" << endl;
38
39  Parameters * param      = new Parameters (70);
40  RamLock    * my_ramlock = new RamLock("my_ramlock",param);
41
42  my_ramlock->reset();
43
44  cout << *my_ramlock << endl;
45
46  TEST (my_ramlock->read (10) , UNLOCK);  cout << *my_ramlock << endl;
47  TEST (my_ramlock->read (10) ,   LOCK);  cout << *my_ramlock << endl;
48  TEST (my_ramlock->write(10) ,   LOCK);  cout << *my_ramlock << endl;
49  TEST (my_ramlock->write(10) , UNLOCK);  cout << *my_ramlock << endl;
50
51  delete param      ;
52  delete my_ramlock ;
53 
54  cout << "<main> End" << endl;
55
56  return EXIT_SUCCESS;
57}
Note: See TracBrowser for help on using the repository browser.