source: sources/test_regression/07052005/system.cpp @ 55

Last change on this file since 55 was 55, checked in by meunier, 11 years ago

Tried to clean the test_regression directory:

  • Code formatting
  • Supressed warnings
  • Made comprehensible outputs
  • Factorized Makefiles

There's still a lot to do (many tests don't pass for either good or bad reasons)

File size: 1.2 KB
Line 
1
2
3#include <iostream>
4
5#include "systemc.h"
6#include "test.h"
7
8
9using namespace std;
10
11
12int sc_main (int argc, char ** argv) {
13
14    sc_uint<17> a;
15    sc_uint<3>  b;
16    sc_uint<2>  c1;
17    sc_uint<2>  c2;
18    sc_uint<5>  d;
19    sc_uint<7>  e;
20    sc_uint<1>  f;
21    sc_uint<16> g;
22    sc_uint<8>  h;
23
24    b  = 0x7;
25    c1 = 0x3;
26    c2 = 0x1;
27    d  = 0xA0;
28    e  = 0x11;
29    g  = 0xabcd;
30
31    // bit vector concatenation and boolean concatenation
32    a = (b, (c1 | c2), d & (b, c1), e);
33
34    f = b.range (0, 0);
35
36    h = g.range (11, 4);
37
38    cout << "a = 0x" << hex << (unsigned int) a << " = " << a.to_string(SC_BIN) << "\n";
39    //ASSERT(a.to_string(SC_BIN) == "0b000000111100010001");
40
41    cout << "f = 0x" << hex << (unsigned int) f << " = " << f.to_string(SC_BIN) << "\n";
42    //ASSERT(f.to_string(SC_BIN) == "0b01");
43
44    cout << "h = 0x" << hex << (unsigned int) h << " = " << h.to_string(SC_BIN) << "\n";
45    //ASSERT(h.to_string(SC_BIN) == "0b010111100");
46
47    cout << "Test OK.\n";
48
49    return 0;
50}
51
52
53/*
54# Local Variables:
55# tab-width: 4;
56# c-basic-offset: 4;
57# c-file-offsets:((innamespace . 0)(inline-open . 0));
58# indent-tabs-mode: nil;
59# End:
60#
61# vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
62*/
63
Note: See TracBrowser for help on using the repository browser.