Changeset 55 for sources/test_regression/17022006
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- Location:
- sources/test_regression/17022006
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/17022006/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 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_systemc.x system_systemcass.x system_socview.x39 ./system_systemc.x ; ./system_systemcass.x ; ./system_socview.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/17022006/system.cpp
r1 r55 1 #include <systemc.h>2 1 3 #define ASSERT(x) \ 4 { errnum++; \ 5 if (!(x)) \ 6 { \ 7 cerr << "ASSERT : " #x "\n"; \ 8 exit (errnum); \ 9 } \ 10 } 2 #include <cstring> 3 4 #include "systemc.h" 5 #include "test.h" 6 11 7 12 8 using namespace std; 13 9 10 14 11 struct test : sc_module { 15 sc_in_clkclk;16 sc_in<int>i1;17 sc_in<bool>i2[4];18 sc_out<int>o1;19 sc_out<char>o2[3];12 sc_in_clk clk; 13 sc_in<int> i1; 14 sc_in<bool> i2[4]; 15 sc_out<int> o1; 16 sc_out<char> o2[3]; 20 17 21 sc_signal<bool>reg1;22 sc_signal<int>reg2;23 sc_signal<int>reg3;24 sc_signal<int>reg4[10];18 sc_signal<bool> reg1; 19 sc_signal<int> reg2; 20 sc_signal<int> reg3; 21 sc_signal<int> reg4[10]; 25 22 26 void trans () 27 { 28 } 23 void trans() {} 29 24 30 void gen () 31 { 32 } 25 void gen() {} 33 26 34 SC_HAS_PROCESS(test); 35 test (sc_module_name n) : sc_module (n), 27 SC_HAS_PROCESS(test); 28 29 test(sc_module_name n) : sc_module(n), 36 30 clk("clk"), 37 31 i1("i1"), … … 39 33 reg1("reg1"), 40 34 reg2("reg2"), 41 reg3("reg3") 42 { 43 SC_METHOD(trans); 44 sensitive << clk.pos(); 45 dont_initialize(); 46 SC_METHOD(gen); 47 sensitive << clk.neg(); 48 dont_initialize(); 35 reg3("reg3") { 36 SC_METHOD(trans); 37 sensitive << clk.pos(); 38 dont_initialize(); 39 40 SC_METHOD(gen); 41 sensitive << clk.neg(); 42 dont_initialize(); 43 49 44 #ifdef NONAME_RENAME 50 char str[100]; 51 for (int i=0; i<3; i++ ) { 52 sprintf(str,"o2_%d", i); 53 o2[i].rename(str); 45 char str[100]; 46 for (int i = 0; i < 3; i++) { 47 sprintf(str, "o2_%d", i); 48 o2[i].rename(str); 49 } 50 for (int i = 0; i < 4; i++) { 51 sprintf(str, "i2_%d", i); 52 i2[i].rename(str); 53 } 54 for (int i = 0; i < 10; i++) { 55 sprintf(str, "reg4_%d", i); 56 reg4[i].rename(str); 57 } 58 #endif 54 59 } 55 for (int i=0; i<4; i++ ) { 56 sprintf(str,"i2_%d", i); 57 i2[i].rename(str); 58 } 59 for (int i=0; i<10; i++ ) { 60 sprintf(str,"reg4_%d", i); 61 reg4[i].rename(str); 62 } 63 #endif 64 }; 60 65 61 }; 66 62 67 int sc_main (int argc, char *argv[])68 {69 int errnum = 0;70 sc_clock signal_clk("my_clock",1, 0.5);71 sc_signal<int> s01("s01");72 sc_signal<bool> s02_0("s02_0"), s02_1("s02_1"), s02_2("s02_2"), s02_3("s02_3");73 sc_signal<int> s03("s03");74 sc_signal<char> s04_0("s04_0"),s04_1("s04_1"),s04_2("s04_2");75 63 76 test test1("test1"); 77 test1.clk (signal_clk); 78 test1.i1 (s01); 79 test1.i2[0] (s02_0); 80 test1.i2[1] (s02_1); 81 test1.i2[2] (s02_2); 82 test1.i2[3] (s02_3); 83 test1.o1 (s03); 84 test1.o2[0] (s04_0); 85 test1.o2[1] (s04_1); 86 test1.o2[2] (s04_2); 64 int sc_main (int argc, char * argv[]) { 65 sc_clock signal_clk("my_clock"); 66 sc_signal<int> s01("s01"); 67 sc_signal<bool> s02_0("s02_0"), s02_1("s02_1"), s02_2("s02_2"), s02_3("s02_3"); 68 sc_signal<int> s03("s03"); 69 sc_signal<char> s04_0("s04_0"), s04_1("s04_1"), s04_2("s04_2"); 87 70 88 // Init & run 89 sc_start (0); 71 test test1("test1"); 72 test1.clk(signal_clk); 73 test1.i1(s01); 74 test1.i2[0](s02_0); 75 test1.i2[1](s02_1); 76 test1.i2[2](s02_2); 77 test1.i2[3](s02_3); 78 test1.o1(s03); 79 test1.o2[0](s04_0); 80 test1.o2[1](s04_1); 81 test1.o2[2](s04_2); 90 82 91 ASSERT(strcmp (test1.o1.name (), "test1.o1") == 0); 92 ASSERT(strcmp (test1.i1.name (), "test1.i1") == 0); 93 ASSERT(strcmp (test1.reg1.name (), "test1.reg1") == 0); 94 ASSERT(strcmp (test1.reg2.basename (), "reg2") == 0); 95 ASSERT(strcmp (test1.reg3.name (), "test1.reg3") == 0); 96 #if defined(NONAME_RENAME) 97 ASSERT(strcmp (test1.o2[1].name (), "test1.o2_1") == 0); 98 ASSERT(strcmp (test1.i2[2].basename (), "i2_2") == 0); 99 ASSERT(strcmp (test1.reg4[1].name (), "test1.reg4_1") == 0); 100 ASSERT(strcmp (test1.reg4[9].basename (), "reg4_9") == 0); 83 // Init & run 84 sc_start(sc_time(0, sc_core::SC_NS)); 85 86 ASSERT(strcmp(test1.o1.name(), "test1.o1") == 0); 87 ASSERT(strcmp(test1.i1.name(), "test1.i1") == 0); 88 ASSERT(strcmp(test1.reg1.name(), "test1.reg1") == 0); 89 ASSERT(strcmp(test1.reg2.basename(), "reg2") == 0); 90 ASSERT(strcmp(test1.reg3.name(), "test1.reg3") == 0); 91 92 #if defined(SYSTEMCASS_SPECIFIC) 93 ASSERT(strcmp(test1.o2[1].name(), "test1.o2_1") == 0); 94 ASSERT(strcmp(test1.i2[2].basename(), "i2_2") == 0); 95 ASSERT(strcmp(test1.reg4[1].name(), "test1.reg4_1") == 0); 96 ASSERT(strcmp(test1.reg4[9].basename(), "reg4_9") == 0); 101 97 #endif 102 return EXIT_SUCCESS; 98 99 cout << "OK" << endl; 100 101 return EXIT_SUCCESS; 103 102 } 104 103 105 104 #undef sc_inout 105 106 /* 107 # Local Variables: 108 # tab-width: 4; 109 # c-basic-offset: 4; 110 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 111 # indent-tabs-mode: nil; 112 # End: 113 # 114 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 115 */ 116
Note: See TracChangeset
for help on using the changeset viewer.