- Timestamp:
- Jun 29, 2009, 6:03:59 PM (16 years ago)
- Location:
- sources
- Files:
-
- 19 edited
-
src/casc.h (modified) (1 diff)
-
src/gen_code.cc (modified) (10 diffs)
-
src/port_dependency.h (modified) (1 diff)
-
src/process_dependency.h (modified) (1 diff)
-
src/sc_main.cc (modified) (3 diffs)
-
src/sc_module.cc (modified) (1 diff)
-
src/sc_module.h (modified) (2 diffs)
-
src/sc_port.cc (modified) (1 diff)
-
src/sc_port_ext.h (modified) (18 diffs)
-
src/signal_dependency.h (modified) (1 diff)
-
test_regression/05042006/system.cpp (modified) (4 diffs)
-
test_regression/07122006/system2.cpp (modified) (2 diffs)
-
test_regression/16112005/system.cpp (modified) (3 diffs)
-
test_regression/16122005/system.cpp (modified) (1 diff)
-
test_regression/17032005/Makefile (modified) (1 diff)
-
test_regression/17032005/system.cpp (modified) (9 diffs)
-
test_regression/25032005/system.cpp (modified) (2 diffs)
-
test_regression/28102005/system.cpp (modified) (1 diff)
-
test_regression/Makefile (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sources/src/casc.h
r27 r35 49 49 { 50 50 #ifdef CONFIG_CHECK_FSM_RULES 51 casc_fsm_step = TRANSITION;51 casc_fsm_step = TRANSITION; 52 52 #endif 53 53 transition (); 54 54 update (); 55 55 #ifdef CONFIG_CHECK_FSM_RULES 56 casc_fsm_step = GEN_MOORE;56 casc_fsm_step = GEN_MOORE; 57 57 #endif 58 58 moore_generation (); 59 59 #ifdef CONFIG_CHECK_FSM_RULES 60 casc_fsm_step = GEN_MEALY;60 casc_fsm_step = GEN_MEALY; 61 61 #endif 62 62 mealy_generation (); 63 63 #ifdef CONFIG_CHECK_FSM_RULES 64 casc_fsm_step = STIMULI;64 casc_fsm_step = STIMULI; 65 65 #endif 66 66 } -
sources/src/gen_code.cc
r31 r35 79 79 ostream& operator << (ostream &o, const SC_ENTRY_FUNC &f) 80 80 { 81 register fct p; 82 p.pmf = f; 83 return o << "0x" << hex << p.integer << "ULL"; 81 register fct p; 82 p.integer = 0; 83 p.pmf = f; 84 return o << "0x" << hex << p.integer << "ULL"; 84 85 } 85 86 … … 242 243 o << "\nextern void mealy_generation (void)\n{\n"; 243 244 o << " register fct p;\n" 244 << "\n\n /* fonctions de mealy */\n";245 ProcessDependencyList::iterator it;246 for (it = mealy_func_list.begin(); it != mealy_func_list.end(); ++it)247 {248 const method_process_t *m = *it;249 PrintCall (o, *m);250 }245 << "\n\n /* fonctions de mealy */\n"; 246 ProcessDependencyList::iterator it; 247 for (it = mealy_func_list.begin(); it != mealy_func_list.end(); ++it) 248 { 249 const method_process_t *m = *it; 250 PrintCall (o, *m); 251 } 251 252 } 252 253 … … 260 261 cerr << "Generating C code for scheduling...\n"; 261 262 262 // open temporary file263 ofstream o;263 // open temporary file 264 ofstream o; 264 265 char base_name[PATH_MAX]; 265 open_temp (o, base_name);266 open_temp (o, base_name); 266 267 267 if (! o.good ()) {268 if (! o.good ()) { 268 269 perror("scheduling: open file\n"); 269 270 exit(-1); … … 271 272 272 273 o << "// generated by " << sc_version () << endl 273 << "#include <casc.h>\n\n"274 << "#include <cstdio>\n\n"275 // << "#include <iostream>\n\n"276 << "namespace sc_core {\n"274 << "#include <casc.h>\n\n" 275 << "#include <cstdio>\n\n" 276 // << "#include <iostream>\n\n" 277 << "namespace sc_core {\n" 277 278 << " typedef void (sc_module::*SC_ENTRY_FUNC)();\n" 278 << " typedef void (*CASC_ENTRY_FUNC)(void *);\n";279 << " typedef void (*CASC_ENTRY_FUNC)(void *);\n"; 279 280 const char *pmf_type = (sizeof (SC_ENTRY_FUNC) == 4)? 280 281 // G4 pointer-to-member-function style … … 286 287 << " integer; SC_ENTRY_FUNC pmf; CASC_ENTRY_FUNC pf; } fct;\n"; 287 288 288 gen_transition (o, transition_func_list);289 gen_moore (o, moore_func_list);290 gen_mealy (o, strongcomponents);289 gen_transition (o, transition_func_list); 290 gen_moore (o, moore_func_list); 291 gen_mealy (o, strongcomponents); 291 292 292 293 o << " \n}\n"; … … 340 341 << " typedef union { unsigned long long int integer; SC_ENTRY_FUNC pmf; CASC_ENTRY_FUNC pf; } fct;\n"; 341 342 342 gen_transition (o, transition_func_list);343 gen_moore (o, moore_func_list);344 gen_mealy (o, mealy_func_list);343 gen_transition (o, transition_func_list); 344 gen_moore (o, moore_func_list); 345 gen_mealy (o, mealy_func_list); 345 346 346 347 o << "\n}\n"; … … 567 568 { 568 569 #ifdef CONFIG_CHECK_FSM_RULES 569 casc_fsm_step = TRANSITION;570 casc_fsm_step = TRANSITION; 570 571 #endif 571 572 call_functions (pf[0]); // transition 572 573 update (); 573 574 #ifdef CONFIG_CHECK_FSM_RULES 574 casc_fsm_step = GEN_MOORE;575 casc_fsm_step = GEN_MOORE; 575 576 #endif 576 577 call_functions (pf[1]); // moore generation 577 578 #ifdef CONFIG_CHECK_FSM_RULES 578 casc_fsm_step = GEN_MEALY;579 casc_fsm_step = GEN_MEALY; 579 580 #endif 580 581 call_functions (pf[2]); // mealy generation 581 582 #ifdef CONFIG_CHECK_FSM_RULES 582 casc_fsm_step = STIMULI;583 casc_fsm_step = STIMULI; 583 584 #endif 584 585 } … … 626 627 { 627 628 #ifdef CONFIG_CHECK_FSM_RULES 628 casc_fsm_step = TRANSITION;629 casc_fsm_step = TRANSITION; 629 630 #endif 630 631 method_process_list_t::iterator mm; … … 636 637 update (); 637 638 #ifdef CONFIG_CHECK_FSM_RULES 638 casc_fsm_step = GEN_MOORE;639 casc_fsm_step = GEN_MOORE; 639 640 #endif 640 641 for( mm = func_list[1].begin(); mm != func_list[1].end(); ++mm) … … 644 645 } 645 646 #ifdef CONFIG_CHECK_FSM_RULES 646 casc_fsm_step = GEN_MEALY;647 casc_fsm_step = GEN_MEALY; 647 648 #endif 648 649 quasistatic_mealy_generation (); 649 650 #ifdef CONFIG_CHECK_FSM_RULES 650 casc_fsm_step = STIMULI;651 casc_fsm_step = STIMULI; 651 652 #endif 652 653 } -
sources/src/port_dependency.h
r1 r35 22 22 // Port Dependency Graph 23 23 struct PortDependency { 24 const method_process_t *method;25 const sc_port_base *source;26 const sc_port_base *destination;24 const method_process_t *method; 25 const sc_port_base *source; 26 const sc_port_base *destination; 27 27 }; 28 28 typedef std::list<PortDependency> PortDependencyGraph; -
sources/src/process_dependency.h
r1 r35 19 19 // Signal Dependency Graph 20 20 struct ProcessDependency { 21 const method_process_t *source;22 const method_process_t *destination;23 bool operator < (const ProcessDependency &) const;21 const method_process_t *source; 22 const method_process_t *destination; 23 bool operator < (const ProcessDependency &) const; 24 24 }; 25 25 -
sources/src/sc_main.cc
r27 r35 187 187 << "modules filename : dump module hierarchy graph into specified dot file (tons of bugs inside)\n" 188 188 << "nobanner: do not print SystemCASS splash screen\n" 189 << " nodynamiclink: do not link dynamicallyscheduling code\n"189 << "dynamiclink: dynamically link the scheduling code\n" 190 190 << "nosim : run until elaboration stage. Don't simulate\n" 191 191 << "notrace : disable all tracing functions\n" … … 226 226 case 'c' : 227 227 print_schedule = true; 228 continue; 229 case 'd' : 230 if (strcmp (argv[i]+2, "dynamiclink") == 0) 231 dynamic_link_of_scheduling_code = true; 232 else 233 check_port_dependencies = true; 228 234 continue; 229 235 case 'e' : … … 279 285 scheduling_method = BUCHMANN_SCHEDULING; 280 286 continue; 281 case 'd' :282 check_port_dependencies = true;283 continue;284 287 default : 285 288 break; -
sources/src/sc_module.cc
r27 r35 139 139 { 140 140 name = nm; 141 func = fn;141 func = fn; 142 142 module = &mod; 143 143 dont_initialize = false; -
sources/src/sc_module.h
r27 r35 14 14 #define __SC_MODULE_H__ 15 15 16 #include "sc_module_ext.h"17 18 16 #include <list> 19 17 #include <set> 20 18 #include <stack> 19 20 #include "internal.h" 21 21 22 #include "sc_fwd.h" 22 #include " internal.h"23 #include "sc_module_ext.h" 23 24 #include "sc_object.h" 24 25 #include "sc_sensitive.h" … … 56 57 public: const char *name; // function name 57 58 #ifdef DUMP_SCHEDULE_STATS 58 long long int number_of_calls;59 long long int number_of_calls; 59 60 #endif 60 61 public: -
sources/src/sc_port.cc
r27 r35 138 138 } 139 139 140 static bool check_multiwriting2port_error_message = 1;140 static bool check_multiwriting2port_error_message = true; 141 141 void 142 142 sc_port_base::check_multiwriting2port () const -
sources/src/sc_port_ext.h
r27 r35 17 17 #include <iostream> 18 18 #include <cstdlib> 19 #include "sc_fwd.h" 20 #i nclude "sc_nbdefs.h"21 //#include "sc_event_finder.h"22 # include "sc_event.h"23 #include "sc_object.h" 24 #include " sc_interface.h"19 20 #ifdef HAVE_CONFIG_H 21 #include "config.h" 22 #endif 23 24 #include "fsm_rules.h" 25 25 #include "internal_ext.h" 26 26 #include "port_dependency_ext.h" 27 #include "fsm_rules.h" 27 #include "sc_event.h" 28 #include "sc_fwd.h" 29 #include "sc_interface.h" 30 #include "sc_nbdefs.h" 31 #include "sc_object.h" 28 32 29 33 … … 45 49 // 46 50 47 using namespace sc_dt;51 using namespace sc_dt; 48 52 49 53 const char *get_name (const tab_t *pointer); 50 54 51 55 #define READ_SIGNAL(value_type_,pointer_) \ 52 ((value_type_&) (*((value_type_*) (pointer_))))53 54 ///////////////////// DEPRECATED56 ((value_type_&) (*((value_type_*) (pointer_)))) 57 58 ///////////////////// DEPRECATED 55 59 // C ANSI-only since it is needed to link with extern "C" 56 60 // this declaration is not in casc.h since the CONFIG_CHECK_FSM_RULES macro … … 74 78 typedef sc_port_base base_type; 75 79 public: 76 ///////////77 // Internal78 const sc_module &get_module () const;79 void init ();80 /////////// 81 // Internal 82 const sc_module &get_module () const; 83 void init (); 80 84 void check_multiwriting2port () const; 81 ///////////85 /////////// 82 86 83 87 friend std::ostream& operator << (std::ostream &, const sc_port_base &); … … 114 118 typedef sc_signal<data_type> signal_type; 115 119 116 ///////////117 // Internal120 /////////// 121 // Internal 118 122 void init (); 119 /*120 public: virtual size_t data_size () const121 { return sizeof (data_type); }122 */123 ///////////123 /* 124 public: virtual size_t data_size () const 125 { return sizeof (data_type); } 126 */ 127 /////////// 124 128 public: 125 129 // constructors … … 130 134 explicit sc_in(const base_type& parent_ ): base_type( parent_ ) { init (); } 131 135 132 /*136 /* 133 137 // LRM error ! 134 138 //static const char *const kind_string; this is a template ! 135 */139 */ 136 140 // virtual const char *kind () const 137 141 // { return "sc_in"; }; … … 171 175 sc_in<T>::init() 172 176 { 173 set_kind (sc_in_string);174 sc_interface::init (sizeof (data_type));177 set_kind (sc_in_string); 178 sc_interface::init (sizeof (data_type)); 175 179 } 176 180 … … 182 186 #ifdef DUMP_READ 183 187 std::cerr << "read " << READ_SIGNAL(const T&, get_pointer()) 184 << " on signal " << name () << "\n";188 << " on signal " << name () << "\n"; 185 189 #endif 186 190 #ifdef CONFIG_CHECK_FSM_RULES 187 if (casc_fsm_step == GEN_MOORE) {188 std::cerr << "FSM rules error : trying to read on input port '"189 << name ()190 << "' from " << get_step_name () << " function.\n";191 exit (-1);192 } 191 if (casc_fsm_step == GEN_MOORE) { 192 std::cerr << "FSM rules error : trying to read on input port '" 193 << name () 194 << "' from " << get_step_name () << " function.\n"; 195 exit (-1); 196 } 193 197 #endif 194 198 return READ_SIGNAL(const T, get_pointer()); … … 212 216 class sc_inout : public sc_port_base 213 217 { 214 ///////////215 // Internal218 /////////// 219 // Internal 216 220 protected: 217 221 void init (); 218 T val;222 T val; 219 223 private: 220 224 typedef T data_type; … … 223 227 typedef sc_signal<data_type> signal_type; 224 228 225 /*226 public: virtual size_t data_size () const227 { return sizeof (data_type); }228 */229 ///////////229 /* 230 public: virtual size_t data_size () const 231 { return sizeof (data_type); } 232 */ 233 /////////// 230 234 public: 231 235 // contructeurs … … 234 238 explicit sc_inout(const char* name_): base_type(name_) { init (); }; 235 239 236 /*240 /* 237 241 // LRM error ! 238 242 //static const char *const kind_string; this is a template ! 239 */243 */ 240 244 //virtual const char *kind () const 241 245 //{ return "sc_inout"; }; … … 273 277 sc_inout<T>::init () 274 278 { 275 set_pointer ((tab_t*)(void*)&val);276 sc_object::set_kind (sc_inout_string);277 sc_interface::init (sizeof (data_type));279 set_pointer ((tab_t*)(void*)&val); 280 sc_object::set_kind (sc_inout_string); 281 sc_interface::init (sizeof (data_type)); 278 282 /*ref*/ val = (0); 279 283 //sc_inout::write (0); … … 292 296 #ifdef DUMP_READ 293 297 std::cerr << "read " << READ_SIGNAL(const T, get_pointer()) // val 294 << " on signal " << name () << "\n";298 << " on signal " << name () << "\n"; 295 299 #endif 296 300 #ifdef CONFIG_CHECK_FSM_RULES 297 if (casc_fsm_step == GEN_MOORE) {298 std::cerr << "FSM rules error : trying to read on input/output port "299 << name () //get_name (get_pointer())300 << " from " << get_step_name () << " function.\n";301 exit (-1);302 } 301 if (casc_fsm_step == GEN_MOORE) { 302 std::cerr << "FSM rules error : trying to read on input/output port " 303 << name () //get_name (get_pointer()) 304 << " from " << get_step_name () << " function.\n"; 305 exit (-1); 306 } 303 307 #endif 304 308 // return val; … … 317 321 #endif 318 322 #ifdef CONFIG_CHECK_FSM_RULES 319 if ((casc_fsm_step != GEN_MOORE) && ( casc_fsm_step != GEN_MEALY)) {320 std::cerr << "FSM rules error : trying to write on output port "321 << name ()322 << " from an " << get_step_name () << " function.\n";323 exit (-1);324 } 325 #endif 326 // T& ref = *(T*)(get_pointer());323 if ((casc_fsm_step != GEN_MOORE) && ( casc_fsm_step != GEN_MEALY)) { 324 std::cerr << "FSM rules error : trying to write on output port " 325 << name () 326 << " from an " << get_step_name () << " function.\n"; 327 exit (-1); 328 } 329 #endif 330 // T& ref = *(T*)(get_pointer()); 327 331 #if defined(CONFIG_CHECK_MULTIWRITING2PORT) 328 332 check_multiwriting2port (); … … 369 373 class sc_out : public sc_inout<T> 370 374 { 371 ///////////372 // Internal375 /////////// 376 // Internal 373 377 void init (); 374 ///////////378 /////////// 375 379 public: 376 380 // typedefs … … 386 390 sc_out (const char *name_, this_type & parent_); 387 391 388 /*392 /* 389 393 // LRM error ! 390 394 //static const char *const kind_string; this is a template ! 391 */395 */ 392 396 //virtual const char *kind () const 393 397 //{ return "sc_out"; }; … … 404 408 { bind (*this,parent_); } 405 409 406 //////////////////////407 // Systemcass specific410 ////////////////////// 411 // Systemcass specific 408 412 void operator () (sc_port_base &o) 409 413 { set_port_dependency (&o, (sc_port_base&)(*this)); } … … 412 416 { set_port_dependency (NULL, (sc_port_base&)(*this)); } 413 417 */ 414 //////////////////////418 ////////////////////// 415 419 416 420 … … 428 432 { 429 433 sc_inout<T>::init (); 430 // tab_t *t = &(sc_inout<T>::val);431 // sc_interface::set_pointer (t);432 sc_object::set_kind (sc_out_string);433 // sc_interface::init (sizeof (data_type));434 // tab_t *t = &(sc_inout<T>::val); 435 // sc_interface::set_pointer (t); 436 sc_object::set_kind (sc_out_string); 437 // sc_interface::init (sizeof (data_type)); 434 438 // /*ref*/ sc_inout<T>::val = 0; 435 439 //sc_inout<T>::write (0); -
sources/src/signal_dependency.h
r1 r35 24 24 // Signal Dependency Graph 25 25 struct SignalDependency { 26 const method_process_t *method;27 const equi_t *source;28 const equi_t *destination;29 bool operator < (const SignalDependency &a) const;30 // friend int operator < (const SignalDependency &a, const SignalDependency &b);26 const method_process_t *method; 27 const equi_t *source; 28 const equi_t *destination; 29 bool operator < (const SignalDependency &a) const; 30 // friend int operator < (const SignalDependency &a, const SignalDependency &b); 31 31 }; 32 32 -
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 sc_in_clk clk;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 test (sc_module_name n) : sc_module (n),29 test (sc_module_name n) : sc_module (n), 39 30 clk("clk"), 40 31 i1("i1"), … … 44 35 reg2("reg2") 45 36 { 46 SC_METHOD(trans);47 sensitive << clk.pos();37 SC_METHOD(trans); 38 sensitive << clk.pos(); 48 39 dont_initialize(); 49 SC_METHOD(gen);50 sensitive << clk.neg();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 // Init & run70 sc_start (0);59 // Init & run 60 sc_start (0); 71 61 72 62 sc_start (10); 73 63 74 return EXIT_SUCCESS;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 return EXIT_SUCCESS;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 internal_model (sc_module_name n) : sc_module (n),22 internal_model (sc_module_name n) : sc_module (n), 23 23 i("i"), 24 o("o")24 o("o") 25 25 { 26 26 } … … 31 31 sc_in<int> i1, i2, i3; 32 32 sc_out<int> o1, o2, o3; 33 sc_signal<int> r1, r2;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 o1("o1"), o2("o2"), o3("o3"),38 r1("r1"), r2("r2"),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 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;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 int errnum = 1;94 cout << "Tests ok\n";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 sc_trace_file *tf;102 sc_trace_file *tf; 103 103 104 104 if (argc != 3) … … 109 109 110 110 string trace_filename = argv[1]; 111 tf = sc_create_vcd_trace_file (trace_filename.c_str());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 sc_in_clk clk;9 sc_out<bool> o1;8 sc_in_clk clk; 9 sc_out<bool> o1; 10 10 11 void eval () {11 void eval () { 12 12 o1 = (rand()%2) == 0; 13 }13 } 14 14 15 SC_CTOR (A) : clk ("clk"), o1("o1") {16 SC_METHOD(eval);17 sensitive << clk.neg();15 SC_CTOR (A) : clk ("clk"), o1("o1") { 16 SC_METHOD(eval); 17 sensitive << clk.neg(); 18 18 #ifdef SYSTEMCASS_SPECIFIC 19 // s1();19 // s1(); 20 20 #endif 21 };21 }; 22 22 }; 23 23 24 24 struct B : sc_module { 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;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 void eval1 () {31 void eval1 () { 32 32 o1 = ~i1; 33 }34 void eval2 () {33 } 34 void eval2 () { 35 35 o2 = ~i2; 36 }36 } 37 37 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;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 o1(i1);43 o1(i1); 44 44 #endif 45 SC_METHOD(eval2);46 sensitive << clk.neg();47 sensitive << i2;45 SC_METHOD(eval2); 46 sensitive << clk.neg(); 47 sensitive << i2; 48 48 #ifdef SYSTEMCASS_SPECIFIC 49 o2(i2);49 o2(i2); 50 50 #endif 51 };51 }; 52 52 }; 53 53 54 54 struct C : sc_module { 55 sc_in_clk clk;56 sc_in<bool> i1;57 sc_in<bool> i2;58 sc_out<bool> o1;55 sc_in_clk clk; 56 sc_in<bool> i1; 57 sc_in<bool> i2; 58 sc_out<bool> o1; 59 59 60 void eval1 () {60 void eval1 () { 61 61 o1 = i1 ^ i2; 62 }62 } 63 63 64 SC_CTOR (C) : clk ("clk"), i1 ("i1"), o1("o1"), i2 ("i2") {65 SC_METHOD(eval1);66 sensitive << clk.neg();67 sensitive << i1 << i2;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 o1(i1);70 o1(i2);69 o1(i1); 70 o1(i2); 71 71 #endif 72 };72 }; 73 73 }; 74 74 75 75 struct D : sc_module { 76 sc_in_clk clk;77 sc_out<bool> o1;76 sc_in_clk clk; 77 sc_out<bool> o1; 78 78 79 void eval () {79 void eval () { 80 80 o1 = (rand()%2) == 0; 81 }81 } 82 82 83 SC_CTOR (D) : clk ("clk"), o1("o1") {84 SC_METHOD(eval);85 sensitive << clk.neg();83 SC_CTOR (D) : clk ("clk"), o1("o1") { 84 SC_METHOD(eval); 85 sensitive << clk.neg(); 86 86 #ifdef SYSTEMCASS_SPECIFIC 87 // s1();87 // s1(); 88 88 #endif 89 };89 }; 90 90 }; 91 91 92 92 int sc_main (int argc, char *argv[]) 93 93 { 94 sc_clock signal_clk("my_clock",1, 0.5);95 sc_signal<bool> s1("s1"),s2("s2"),s3("s3"),s4("s4"),s5("s5");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 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);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 b.o1 (s3);114 c.i1 (s3);115 116 c.o1 (s4);117 b.i2 (s4);118 119 b.o2 (s5);120 121 // Init & run122 sc_initialize ();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 chrono_t chrono;131 chrono.start ();130 chrono_t chrono; 131 chrono.start (); 132 132 133 133 sc_start (atoi(argv[1])); 134 134 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;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.
