|
Last change
on this file since 45 was
21,
checked in by buchmann, 17 years ago
|
|
Add 2 another testbench to check various operators on sc_uint :
- system2.cpp works with SystemCASS
- systemCASS doesn't compile system3.cpp but using SystemC works fine.
SystemCASS needs a fix.
Implicit cast is not implicitly called when using SystemCASS. The workaround
is to call read() method.
|
|
File size:
551 bytes
|
| Rev | Line | |
|---|
| [21] | 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 | int |
|---|
| 20 | sc_main (int argc, char ** argv) |
|---|
| 21 | { |
|---|
| 22 | sc_uint<36> a, b, c; |
|---|
| 23 | const long long int ca = 0xf00000000LLU; |
|---|
| 24 | const long long int cb = 0x123456789LLU; |
|---|
| 25 | a = ca; |
|---|
| 26 | b = cb; |
|---|
| 27 | |
|---|
| 28 | c = a & b; |
|---|
| 29 | if (c != (ca & cb)) |
|---|
| 30 | return 1; |
|---|
| 31 | |
|---|
| 32 | c = a; |
|---|
| 33 | if (a != c) |
|---|
| 34 | return 1; |
|---|
| 35 | if (!(a == c)) |
|---|
| 36 | return 1; |
|---|
| 37 | |
|---|
| 38 | return 0; |
|---|
| 39 | } |
|---|
| 40 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.