Changeset 35 for sources/test_regression
- Timestamp:
- Jun 29, 2009, 6:03:59 PM (16 years ago)
- Location:
- sources/test_regression
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/05042006/system.cpp
r1 r35 1 1 #include <systemc.h> 2 3 #define ASSERT(x) \4 { errnum++; \5 if (!(x)) \6 { \7 cerr << "ASSERT : " #x "\n"; \8 exit (errnum); \9 } \10 }11 2 12 3 using namespace std; 13 4 14 5 struct test : sc_module { 15 6 sc_in_clk clk; 16 7 sc_in<int> i1; 17 8 sc_out<int> o1; … … 36 27 37 28 SC_HAS_PROCESS(test); 38 29 test (sc_module_name n) : sc_module (n), 39 30 clk("clk"), 40 31 i1("i1"), … … 44 35 reg2("reg2") 45 36 { 46 47 37 SC_METHOD(trans); 38 sensitive << clk.pos(); 48 39 dont_initialize(); 49 50 40 SC_METHOD(gen); 41 sensitive << clk.neg(); 51 42 dont_initialize(); 52 43 }; 53 44 }; 54 45 55 46 int sc_main (int argc, char *argv[]) 56 47 { 57 int errnum = 0; 58 sc_clock signal_clk("my_clock",1, 0.5); 48 sc_clock signal_clk("my_clock",1, 0.5); 59 49 sc_signal<int> s01("s01"); 60 50 sc_signal<int> s02("s02"); … … 67 57 test1.o2 (s03); 68 58 69 70 59 // Init & run 60 sc_start (0); 71 61 72 62 sc_start (10); 73 63 74 64 return EXIT_SUCCESS; 75 65 } 76 66 -
sources/test_regression/07122006/system2.cpp
r34 r35 34 34 sc_signal<int> reg; 35 35 36 v oid transition ();36 virtual void transition (); 37 37 void gen_moore (); 38 38 void gen_mealy (); … … 89 89 90 90 cout << "Test OK.\n"; 91 91 return EXIT_SUCCESS; 92 92 } -
sources/test_regression/16112005/system.cpp
r1 r35 1 #include "systemc.h"1 #include <systemc.h> 2 2 #include <iostream> 3 3 #include <string> … … 20 20 sc_in<int> i; 21 21 sc_out<int> o; 22 22 internal_model (sc_module_name n) : sc_module (n), 23 23 i("i"), 24 24 o("o") 25 25 { 26 26 } … … 31 31 sc_in<int> i1, i2, i3; 32 32 sc_out<int> o1, o2, o3; 33 33 sc_signal<int> r1, r2; 34 34 internal_model internal; 35 model (sc_module_name n) : sc_module (n), 35 36 model (sc_module_name n) : sc_module (n), 36 37 i1("i1"), i2("i2"), i3("i3"), 37 38 38 o1("o1"), o2("o2"), o3("o3"), 39 r1("r1"), r2("r2"), 39 40 internal ("internal") 40 41 { -
sources/test_regression/16122005/system.cpp
r18 r35 1 #include "systemc.h"1 #include <systemc.h> 2 2 #include <iostream> 3 3 #include <fstream> -
sources/test_regression/17032005/Makefile
r15 r35 14 14 15 15 system-23.vcd : system_systemcass.x 16 ./system_systemcass.x system 2316 ./system_systemcass.x --nodynamiclink system 23 17 17 tail -n +8 system.vcd > system-23.vcd 18 18 rm system.vcd -
sources/test_regression/17032005/system.cpp
r18 r35 20 20 sc_in<bool> clk; 21 21 sc_in<bool> resetn; 22 23 24 25 22 sc_signal<sc_uint<6> > ui6; 23 sc_signal<sc_uint<16> > ui16; 24 sc_signal<sc_uint<31> > ui31; 25 sc_signal<sc_uint<32> > ui32; 26 26 sc_signal<sc_uint<64> > ui64; 27 27 sc_signal<sc_int<6> > i6; … … 45 45 ui31 = 0x100; 46 46 ui32 = 0x211; 47 ui64 = 0xABCF1234 ;47 ui64 = 0xABCF1234ULL; 48 48 i6 = 0xF; 49 49 i16 = 0x3F; 50 50 i31 = 0x11112222; 51 51 i32 = 0x43214321; 52 i64 = 0x4444abcd ;52 i64 = 0x4444abcdULL; 53 53 // bui64 = 0xFFFFFFFF; 54 54 // bui64b= 0xFFFFFFFF; … … 91 91 int sc_main (int argc, char *argv[]) 92 92 { 93 94 93 int errnum = 1; 94 cout << "Tests ok\n"; 95 95 sc_clock clk("clk"); 96 96 sc_signal<bool> resetn("resetn"); … … 100 100 test.resetn (resetn); 101 101 102 102 sc_trace_file *tf; 103 103 104 104 if (argc != 3) … … 109 109 110 110 string trace_filename = argv[1]; 111 111 tf = sc_create_vcd_trace_file (trace_filename.c_str()); 112 112 sc_trace (tf, test.ui6 , "ui6" ); 113 113 sc_trace (tf, test.ui16 , "ui16" ); … … 139 139 sc_start (20); 140 140 141 sc_close_vcd_trace_file (tf);142 143 141 #if 1 144 142 cout << "0x3f" << " 0x" << hex << (unsigned int) (sc_uint<6> )test.ui6 << endl; … … 148 146 #endif 149 147 cerr << test.ui6.read() << endl; 148 150 149 union t { 151 150 int v1:3; 152 151 int v2; 153 152 }; 153 154 154 t t1,t2; 155 155 t1.v1 = 7; … … 161 161 ASSERT(test.ui31.read() == 0x100fffff); 162 162 ASSERT(test.ui32.read() == 0x211fffff); 163 long long unsigned int ui64_reference = 0xabcf1234; 163 164 long long unsigned int ui64_reference = 0xabcf1234ULL; 164 165 ui64_reference <<= 20; 165 ui64_reference += 0xfffff ;166 ui64_reference += 0xfffffULL; 166 167 #if 0 167 168 cout << "0xffffffff" << " 0x" << hex << (int) (sc_int<6>)test.i6 << endl; … … 170 171 cout << "0x4444abcdfffff" << " 0x" << hex << (long long signed int) (sc_int<64>)test.i64 << endl; 171 172 #endif 173 172 174 ASSERT(test.ui64.read() == ui64_reference); 173 175 ASSERT(test.i6.read() == (sc_int<6>)~0); 174 176 ASSERT(test.i31.read() == 0x222fffff); 175 177 ASSERT(test.i32.read() == 0x321fffff) 176 long long signed int i64_reference = 0x4444abcd; 178 179 long long signed int i64_reference = 0x4444abcdULL; 177 180 i64_reference <<= 20; 178 i64_reference += 0xfffff ;181 i64_reference += 0xfffffULL; 179 182 ASSERT(test.i64.read() == i64_reference); 183 180 184 // cout << "0x4294967315" << " 0x" << hex << test.bui64 << endl; 181 185 cout << "Test OK.\n"; 182 return EXIT_SUCCESS; 186 187 sc_close_vcd_trace_file (tf); 188 189 return EXIT_SUCCESS; 183 190 } -
sources/test_regression/25032005/system.cpp
r1 r35 4 4 5 5 using namespace std; 6 6 7 7 struct A : sc_module { 8 9 8 sc_in_clk clk; 9 sc_out<bool> o1; 10 10 11 11 void eval () { 12 12 o1 = (rand()%2) == 0; 13 13 } 14 14 15 16 17 15 SC_CTOR (A) : clk ("clk"), o1("o1") { 16 SC_METHOD(eval); 17 sensitive << clk.neg(); 18 18 #ifdef SYSTEMCASS_SPECIFIC 19 // 19 // s1(); 20 20 #endif 21 21 }; 22 22 }; 23 23 24 24 struct B : sc_module { 25 26 27 28 29 25 sc_in_clk clk; 26 sc_in<bool> i1; 27 sc_in<bool> i2; 28 sc_out<bool> o1; 29 sc_out<bool> o2; 30 30 31 31 void eval1 () { 32 32 o1 = ~i1; 33 34 33 } 34 void eval2 () { 35 35 o2 = ~i2; 36 36 } 37 37 38 39 40 41 38 SC_CTOR (B) : clk ("clk"), i1 ("i1"), o1("o1"), i2 ("i2"), o2 ("o2") { 39 SC_METHOD(eval1); 40 sensitive << clk.neg(); 41 sensitive << i1; 42 42 #ifdef SYSTEMCASS_SPECIFIC 43 43 o1(i1); 44 44 #endif 45 46 47 45 SC_METHOD(eval2); 46 sensitive << clk.neg(); 47 sensitive << i2; 48 48 #ifdef SYSTEMCASS_SPECIFIC 49 49 o2(i2); 50 50 #endif 51 51 }; 52 52 }; 53 53 54 54 struct C : sc_module { 55 56 57 58 55 sc_in_clk clk; 56 sc_in<bool> i1; 57 sc_in<bool> i2; 58 sc_out<bool> o1; 59 59 60 60 void eval1 () { 61 61 o1 = i1 ^ i2; 62 62 } 63 63 64 65 66 67 64 SC_CTOR (C) : clk ("clk"), i1 ("i1"), o1("o1"), i2 ("i2") { 65 SC_METHOD(eval1); 66 sensitive << clk.neg(); 67 sensitive << i1 << i2; 68 68 #ifdef SYSTEMCASS_SPECIFIC 69 70 69 o1(i1); 70 o1(i2); 71 71 #endif 72 72 }; 73 73 }; 74 74 75 75 struct D : sc_module { 76 77 76 sc_in_clk clk; 77 sc_out<bool> o1; 78 78 79 79 void eval () { 80 80 o1 = (rand()%2) == 0; 81 81 } 82 82 83 84 85 83 SC_CTOR (D) : clk ("clk"), o1("o1") { 84 SC_METHOD(eval); 85 sensitive << clk.neg(); 86 86 #ifdef SYSTEMCASS_SPECIFIC 87 // 87 // s1(); 88 88 #endif 89 89 }; 90 90 }; 91 91 92 92 int sc_main (int argc, char *argv[]) 93 93 { 94 95 94 sc_clock signal_clk("my_clock",1, 0.5); 95 sc_signal<bool> s1("s1"),s2("s2"),s3("s3"),s4("s4"),s5("s5"); 96 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 97 A a("a"); 98 B b("b"); 99 C c("c"); 100 D d("d"); 101 102 a.clk (signal_clk); 103 b.clk (signal_clk); 104 c.clk (signal_clk); 105 d.clk (signal_clk); 106 107 a.o1 (s1); 108 b.i1 (s1); 109 110 d.o1 (s2); 111 c.i2 (s2); 112 112 113 114 115 116 117 118 119 120 121 122 113 b.o1 (s3); 114 c.i1 (s3); 115 116 c.o1 (s4); 117 b.i2 (s4); 118 119 b.o2 (s5); 120 121 // Init & run 122 sc_initialize (); 123 123 124 124 if (argc == 1) … … 128 128 } 129 129 130 131 130 chrono_t chrono; 131 chrono.start (); 132 132 133 133 sc_start (atoi(argv[1])); 134 134 135 136 137 138 139 140 141 142 143 135 chrono.stop (); 136 unsigned int t = chrono; 137 cout << "Time elapsed (sec) : " << t << endl; 138 cout << "Cycles done : " << sc_simulation_time () << endl; 139 cout << "Performance : " << sc_simulation_time () / t << endl; 140 printf("\nPress <RETURN> to exit simulation."); 141 char buf_ret[2]; 142 cin.getline(buf_ret,1); 143 return EXIT_SUCCESS; 144 144 } -
sources/test_regression/28102005/system.cpp
r23 r35 1 #include "systemc.h"1 #include <systemc.h> 2 2 #include <iostream> 3 3 #include <cstring> -
sources/test_regression/Makefile
r18 r35 30 30 # 05042006 : check number of writings into each out port 31 31 # check reading from an sc_out port 32 # (test check_multiwriting2port option) 32 33 # 02052006 : check sc_uint, sc_int, sc_signal<X> when X is double, char, 33 34 # signed int, unsigned int and so on. (little/big endianness test) … … 38 39 # 07122006 : check if we can declare an undefined external function as 39 40 # a sc_method. 40 # check a virtual method as a sc_method => segmentation fault41 # check a virtual method as a sc_method 41 42 # (Unable to check if sc_method is a virtual one) 42 43 # 20122006 : check Petrot's scheduling (CASS, quasi static) … … 46 47 # 23032007 : check multiple execution on the same computer 47 48 # 15042009 : check sc_uint operators (==, =, <<=, +=) 49 # in some cases, such as a compairison, the developper has to use 50 # sc_signal<T>::read() method to explicitly read a sc_signal. 48 51 49 52 ## Uncomment the following variable if you want to compile and run the
Note: See TracChangeset
for help on using the changeset viewer.