source: trunk/IPs/systemC/Environment/Endianness/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.3 KB
Line 
1#ifdef SYSTEMC
2#include "systemc.h"
3#endif
4#include <iostream>
5#include "../include/Endianness.h"
6
7using namespace std;
8using namespace environment;
9using namespace environment::endianness;
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  cout << "hostEndianness : " << hostEndianness() << endl;
20  cout << "cpuEndianness  : " << cpuEndianness (0) << endl;
21  cout << "same ?         : " << isSameEndianness (0) << endl;
22
23  char * str = new char [16];
24
25  str [0] = 'a';
26  for (uint32_t i=1; i<16; i++)
27    str [i] = str[i-1]+1;
28
29  cout << "str : ";
30  for (uint32_t i=0; i<16; i++)
31    cout << str [i];
32  cout << endl;
33
34  str = swapBytes (str, 16, 4);
35
36  cout << "str : ";
37  for (uint32_t i=0; i<16; i++)
38    cout << str [i];
39  cout << endl;
40
41  str = swapBytes (str, 16, 1);
42
43  cout << "str : ";
44  for (uint32_t i=0; i<16; i++)
45    cout << str [i];
46  cout << endl;
47
48  str = swapBytes (str, 16, 8);
49
50  cout << "str : ";
51  for (uint32_t i=0; i<16; i++)
52    cout << str [i];
53  cout << endl;
54
55  str = swapBytes (str, 16, 4);
56
57  cout << "str : ";
58  for (uint32_t i=0; i<16; i++)
59    cout << str [i];
60  cout << endl;
61
62  delete [] str;
63 
64
65  cout << "<main> End" << endl;
66 
67  return EXIT_SUCCESS;
68}
Note: See TracBrowser for help on using the repository browser.