Changeset 55 for sources/test_regression/15062006
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- Location:
- sources/test_regression/15062006
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/15062006/Makefile
r15 r55 1 1 2 include ../env.mk 3 include ../Makefile.common 2 4 3 SOCVIEW_INC = ${SOCVIEW}/include 4 SOCVIEW_LIB = ${SOCVIEW}/lib-linux/libsystemc.a 5 CFLAGS_SOCVIEW = ${CFLAGS} -DSOCVIEW -I${SOCVIEW_INC} 6 LFLAGS_SOCVIEW = ${LFLAGS} -ltermcap -lreadline ${SOCVIEW_LIB} 5 test : all 6 @echo -ne "| Testing $$(basename $$(pwd)): " ; 7 @./$(EXE_SCASS) > $(LOG_SCASS) 2> /dev/null 8 @./$(EXE_SC) > $(LOG_SC) 2> /dev/null 9 @if diff $(LOG_SC) $(LOG_SCASS) > /dev/null ; then \ 10 echo "OK" ; \ 11 else echo "KO" ; \ 12 fi ; 7 13 8 SYSTEM = system.cpp9 EXE_SCASS = $(SYSTEM:.cpp=_systemcass.x)10 EXE_SC = $(SYSTEM:.cpp=_systemc.x)11 EXE_SVIEW = $(SYSTEM:.cpp=_socview.x)12 EXE = ${EXE_SCASS} ${EXE_SVIEW} ${EXE_SC}13 OBJECTS = $(EXE:.x=.o)14 LINKS = $(OBJECTS:.o=.cpp)15 14 16 TEST1_DAT = \17 test_socview_1.dat test_socview_1_reloaded.dat \18 test_socview_2.dat test_socview_2_reloaded.dat \19 test_socview_3.dat test_socview_3_reloaded.dat \20 test_socview_3b.dat test_socview_3_reloaded_bis.dat \21 test_socview_4.dat test_socview_4_reloaded.dat \22 test_socview_5.dat test_socview_5_reloaded.dat \23 test_socview_6.dat test_socview_6_reloaded.dat \24 test_socview_7.dat test_socview_7_reloaded.dat \25 test_socview_8.dat test_socview_8_reloaded.dat \26 test_socview_9.dat test_socview_9_reloaded.dat \27 test_socview_10.dat test_socview_10_reloaded.dat \28 test_socview_10b.dat \29 15 30 TEST2_DAT = test2_socview_10.dat \31 test2_socview_24a.dat test2_socview_24b.dat test2_socview_24c.dat \32 test2_socview_20a.dat test2_socview_20b.dat test2_systemcass_20.dat33 34 .SECONDARY:35 36 main : $(EXE)37 38 test : system_systemcass.x39 ./system_systemcass.x40 41 %.gif : %.dot42 dot -Tgif -o $*.gif $*.dot43 44 %_systemc.x : %_systemc.o $(SYSTEMC_LIB)45 $(CXX) -o $@ $*_systemc.o $(LFLAGS_SYSTEMC)46 47 %_systemcass.x : %_systemcass.o $(SYSTEMCASS_LIB)48 $(CXX) -o $@ $*_systemcass.o $(LFLAGS_SYSTEMCASS)49 50 %_socview.x : %_socview.o $(SOCVIEW_LIB)51 $(CXX) -o $@ $*_socview.o $(LFLAGS_SOCVIEW)52 53 -include Makefile.deps54 55 %_systemc.cpp : %.cpp56 ln -s $*.cpp $*_systemc.cpp57 58 %_systemcass.cpp : %.cpp59 ln -s $*.cpp $*_systemcass.cpp60 61 %_socview.cpp : %.cpp62 ln -s $*.cpp $*_socview.cpp63 64 %_systemc.o : %_systemc.cpp65 $(CXX) $(CFLAGS_SYSTEMC) -MM $*_systemc.cpp >> Makefile.deps66 $(CXX) $(CFLAGS_SYSTEMC) -c $*_systemc.cpp -o $*_systemc.o67 68 %_systemcass.o : %_systemcass.cpp69 $(CXX) $(CFLAGS_SYSTEMCASS) -MM $*_systemcass.cpp >> Makefile.deps70 $(CXX) $(CFLAGS_SYSTEMCASS) -c $*_systemcass.cpp -o $*_systemcass.o71 72 %_socview.o : %_socview.cpp73 $(CXX) $(CFLAGS_SOCVIEW) -MM $*_socview.cpp >> Makefile.deps74 $(CXX) $(CFLAGS_SOCVIEW) -c $*_socview.cpp -o $*_socview.o75 76 clean :77 rm -f Makefile.deps78 -rm -f *.o gmon.out *~79 -rm -f results80 -rm -f signal_order.txt module_order.dot signal_graph.dot81 -rm -f module_order.gif signal_graph.gif82 -rm -f $(EXE) $(OBJECTS)83 -for i in $(LINKS) ; do unlink $$i ; done 2> /dev/null84 -rm -f core*85 -rm -rf generated_by_systemcass86 -rm -rf system_systemcass.x.vcd system_systemc.x.vcd87 -
sources/test_regression/15062006/system.cpp
r1 r55 1 // QM : je ne sais ce que cherche à tester ce test 2 // Dans le doute j'applique un traitement par défaut (diff sc) avec un cout "OK" 3 1 4 #include <systemc.h> 2 5 3 #define ASSERT(x) \ 4 { errnum++; \ 5 if (!(x)) \ 6 { \ 7 cerr << "ASSERT : " #x "\n"; \ 8 exit (errnum); \ 9 } \ 10 } 6 #include "test.h" 7 11 8 12 9 using namespace std; … … 14 11 template<typename datatype> 15 12 class module_base : public sc_module { 16 public:17 sc_in_clk clk;18 sc_in<datatype> i1;19 sc_out<datatype> o1;20 sc_signal<datatype> reg1;21 13 22 private: 23 void trans_module_base () 24 { 25 } 26 void gen_module_base () 27 { 28 this->kikoo (); 29 } 30 virtual void kikoo () = 0; 14 public: 15 sc_in_clk clk; 16 sc_in<datatype> i1; 17 sc_out<datatype> o1; 18 sc_signal<datatype> reg1; 31 19 32 public: 33 SC_HAS_PROCESS(module_base); 34 module_base (sc_module_name n) : sc_module (n), 35 clk("clk"), 36 i1("i1"), 37 o1("o1"), 38 reg1("reg1") 39 { 40 SC_METHOD(trans_module_base); 41 sensitive << clk.pos(); 42 dont_initialize(); 43 SC_METHOD(gen_module_base); 44 sensitive << clk.neg(); 45 dont_initialize(); 46 } 20 private: 21 void trans_module_base() {} 22 void gen_module_base() { 23 this->kikoo (); 24 } 25 virtual void kikoo() = 0; 26 27 28 public: 29 SC_HAS_PROCESS(module_base); 30 module_base (sc_module_name n) : sc_module (n), 31 clk("clk"), i1("i1"), o1("o1"), reg1("reg1") { 32 SC_METHOD(trans_module_base); 33 sensitive << clk.pos(); 34 dont_initialize(); 35 36 SC_METHOD(gen_module_base); 37 sensitive << clk.neg(); 38 dont_initialize(); 39 } 47 40 }; 41 48 42 49 43 template<typename datatype> 50 44 class test : public module_base<datatype> { 51 public:52 sc_in<datatype> i2;53 sc_out<datatype> o2;54 sc_signal<datatype> reg2;55 45 56 private:57 void trans ()58 {59 }46 public: 47 sc_in<datatype> i2; 48 sc_out<datatype> o2; 49 sc_signal<datatype> reg2; 60 50 61 void gen () 62 { 63 } 64 virtual void kikoo () 65 { } 51 private: 52 void trans() {} 66 53 67 public: 68 SC_HAS_PROCESS(test); 69 test (sc_module_name n) : module_base<datatype> (n), 54 void gen() {} 55 56 virtual void kikoo() {} 57 58 public: 59 SC_HAS_PROCESS(test); 60 test(sc_module_name n) : module_base<datatype> (n), 70 61 i2("i2"), 71 62 o2("o2"), 72 reg2("reg2") 73 {74 SC_METHOD(trans);75 this->sensitive << this->clk.pos();76 this->dont_initialize(); 77 78 79 this->dont_initialize();80 63 reg2("reg2") { 64 SC_METHOD(trans); 65 this->sensitive << this->clk.pos(); 66 this->dont_initialize(); 67 68 SC_METHOD(gen); 69 this->sensitive << this->clk.neg(); 70 this->dont_initialize(); 71 } 81 72 }; 82 73 83 int sc_main (int argc, char *argv[])84 {85 int errnum = 0;86 sc_clock signal_clk("my_clock",1, 0.5);87 sc_signal<int> s01("s01"),88 s02("s02"),89 s03("s03"),90 s04("s04");91 74 92 test<int> test1("test1"); 93 test1.clk (signal_clk); 94 test1.i1 (s01); 95 test1.i2 (s02); 96 test1.o1 (s03); 97 test1.o2 (s04); 75 int sc_main(int argc, char * argv[]) { 76 sc_clock signal_clk("my_clock"); 77 sc_signal<int> s01("s01"), s02("s02"), s03("s03"), s04("s04"); 98 78 99 // Init & run 100 sc_start (0); 79 test<int> test1("test1"); 80 test1.clk(signal_clk); 81 test1.i1(s01); 82 test1.i2(s02); 83 test1.o1(s03); 84 test1.o2(s04); 101 85 102 return EXIT_SUCCESS; 86 // Init & run 87 sc_start(sc_time(0, sc_core::SC_NS)); 88 89 cout << "OK" << endl; 90 return EXIT_SUCCESS; 103 91 } 104 92 93 94 /* 95 # Local Variables: 96 # tab-width: 4; 97 # c-basic-offset: 4; 98 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 99 # indent-tabs-mode: nil; 100 # End: 101 # 102 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 103 */ 104
Note: See TracChangeset
for help on using the changeset viewer.