source: sources/test_regression/15042009c/system.cpp @ 56

Last change on this file since 56 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.3 KB
Line 
1
2#include <iostream>
3
4#include "systemc.h"
5#include "test.h"
6
7
8using namespace std;
9
10
11typedef sc_uint<36> data_type; 
12
13
14class param_t {
15    public:
16    static const unsigned int B = 36;
17    typedef sc_dt::sc_uint<B> be_t;
18};
19
20
21template <typename param_t>
22class test_t {
23    public:
24    typedef typename param_t::be_t test_be_t;
25
26    test_be_t test_be;
27};
28
29
30int sc_main (int argc, char ** argv) {
31    sc_uint<36> a;
32    const long long int ca = 0xf00000000LLU;
33    a = ca;
34
35    test_t<param_t> test1, test2;
36    test1.test_be = a;
37    test2.test_be = ca;
38
39    if (test1.test_be != test2.test_be) {
40        return 1;
41    }
42
43    bool ret = (test1.test_be == a);
44    if (!ret) {
45        return 1;
46    }
47
48    cout << "OK" << endl;
49    return 0;
50
51    /* the following should be compiled and not executed */
52    // QM : je ne sais pas pourquoi ; je n'ai pas cherché mais ça seg faulte...
53    sc_signal<test_t<param_t>::test_be_t > sig_test;
54    sig_test = test1.test_be;
55
56    ret = (sig_test.read() == test2.test_be); /* OK */
57    if (!ret) {
58        return 1;
59    }
60
61    return 0;
62}
63
64
65/*
66# Local Variables:
67# tab-width: 4;
68# c-basic-offset: 4;
69# c-file-offsets:((innamespace . 0)(inline-open . 0));
70# indent-tabs-mode: nil;
71# End:
72#
73# vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
74*/
75
Note: See TracBrowser for help on using the repository browser.