|
Last change
on this file since 54 was
1,
checked in by buchmann, 18 years ago
|
|
Initial import from CVS repository
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | #include <systemc.h> |
|---|
| 2 | #include <iostream> |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | using namespace std; |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | int |
|---|
| 9 | sc_main (int argc, char ** argv) |
|---|
| 10 | { |
|---|
| 11 | int errnum = 0; |
|---|
| 12 | |
|---|
| 13 | sc_uint<17> a; |
|---|
| 14 | sc_uint<3> b; |
|---|
| 15 | sc_uint<2> c1; |
|---|
| 16 | sc_uint<2> c2; |
|---|
| 17 | sc_uint<5> d; |
|---|
| 18 | sc_uint<7> e; |
|---|
| 19 | sc_uint<1> f; |
|---|
| 20 | sc_uint<16> g; |
|---|
| 21 | sc_uint<8> h; |
|---|
| 22 | |
|---|
| 23 | b = 0x7; |
|---|
| 24 | c1 = 0x3; |
|---|
| 25 | c2 = 0x1; |
|---|
| 26 | d = 0xA0; |
|---|
| 27 | e = 0x11; |
|---|
| 28 | g = 0xabcd; |
|---|
| 29 | |
|---|
| 30 | // bit vector concatenation and boolean concatenation |
|---|
| 31 | a = (b, |
|---|
| 32 | (c1 | c2), |
|---|
| 33 | d & (b,c1), |
|---|
| 34 | e); |
|---|
| 35 | |
|---|
| 36 | f = b.range (0,0); |
|---|
| 37 | |
|---|
| 38 | h = g.range (11,4); |
|---|
| 39 | |
|---|
| 40 | errnum++; |
|---|
| 41 | cerr << "a = 0x" << hex << (unsigned int)a << " = " << a.to_string (SC_BIN) << "\n"; |
|---|
| 42 | if (a.to_string (SC_BIN) != "0b000000111100010001") |
|---|
| 43 | { |
|---|
| 44 | exit (errnum); |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | errnum++; |
|---|
| 48 | cerr << "f = 0x" << hex << (unsigned int)f << " = " << f.to_string (SC_BIN) << "\n"; |
|---|
| 49 | if (f.to_string (SC_BIN) != "0b01") |
|---|
| 50 | { |
|---|
| 51 | exit (errnum); |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | errnum++; |
|---|
| 55 | cerr << "h = 0x" << hex << (unsigned int)h << " = " << h.to_string (SC_BIN) << "\n"; |
|---|
| 56 | if (h.to_string (SC_BIN) != "0b010111100") |
|---|
| 57 | { |
|---|
| 58 | exit (errnum); |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | cerr << "Test OK.\n"; |
|---|
| 62 | return 0; |
|---|
| 63 | } |
|---|
| 64 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.