source: sources/test_regression/15042009/system3.cpp @ 21

Last change on this file since 21 was 21, checked in by buchmann, 15 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: 988 bytes
Line 
1#include "systemc.h"
2#include <iostream>
3
4using namespace std;
5
6#define ASSERT(x) \
7  { errnum++; \
8    if (!(x)) \
9    { \
10    cerr << "ASSERT : " #x "\n"; \
11    exit (errnum); \
12    } \
13  }
14
15using namespace std;
16
17typedef sc_uint<36> data_type; 
18
19class param_t
20{
21public:
22  static const unsigned int B = 36;
23  typedef sc_dt::sc_uint<B> be_t;
24};
25
26template <typename param_t>
27class test_t 
28{
29public:
30  typedef typename param_t::be_t test_be_t;
31 
32  test_be_t test_be;
33};
34
35int
36sc_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 == test2.test_be);
60  if (!ret)
61    return 1;
62}
63
Note: See TracBrowser for help on using the repository browser.