Last change
on this file since 35 was
34,
checked in by buchmann, 15 years ago
|
Remove an unused regression test.
Update some other tests.
Add a TODO section into README file.
Disable some debugging compiler options for common users.
|
File size:
1.1 KB
|
Line | |
---|
1 | #include "systemc.h" |
---|
2 | #include <iostream> |
---|
3 | |
---|
4 | using namespace std; |
---|
5 | |
---|
6 | #define ASSERT(x) \ |
---|
7 | { errnum++; \ |
---|
8 | if (!(x)) \ |
---|
9 | { \ |
---|
10 | cerr << "ASSERT : " #x "\n"; \ |
---|
11 | exit (errnum); \ |
---|
12 | } \ |
---|
13 | } |
---|
14 | |
---|
15 | using namespace std; |
---|
16 | |
---|
17 | typedef sc_uint<36> data_type; |
---|
18 | |
---|
19 | class param_t |
---|
20 | { |
---|
21 | public: |
---|
22 | static const unsigned int B = 36; |
---|
23 | typedef sc_dt::sc_uint<B> be_t; |
---|
24 | }; |
---|
25 | |
---|
26 | template <typename param_t> |
---|
27 | class test_t |
---|
28 | { |
---|
29 | public: |
---|
30 | typedef typename param_t::be_t test_be_t; |
---|
31 | |
---|
32 | test_be_t test_be; |
---|
33 | }; |
---|
34 | |
---|
35 | int |
---|
36 | sc_main (int argc, char ** argv) |
---|
37 | { |
---|
38 | sc_uint<36> a; |
---|
39 | const long long int ca = 0xf00000000LLU; |
---|
40 | a = ca; |
---|
41 | |
---|
42 | test_t<param_t> test1, test2; |
---|
43 | test1.test_be = a; |
---|
44 | test2.test_be = ca; |
---|
45 | |
---|
46 | if (test1.test_be != test2.test_be) |
---|
47 | return 1; |
---|
48 | |
---|
49 | bool ret = (test1.test_be == a); |
---|
50 | if (!ret) |
---|
51 | return 1; |
---|
52 | |
---|
53 | return 0; |
---|
54 | |
---|
55 | /* the following should be compiled and not executed */ |
---|
56 | sc_signal<test_t<param_t>::test_be_t > sig_test; |
---|
57 | sig_test = test1.test_be; |
---|
58 | |
---|
59 | ret = (sig_test.read() == test2.test_be); /* OK */ |
---|
60 | //ret = (sig_test == test2.test_be); /* should be OK but it is not */ |
---|
61 | if (!ret) |
---|
62 | return 1; |
---|
63 | } |
---|
64 | |
---|
Note: See
TracBrowser
for help on using the repository browser.