Ignore:
Timestamp:
May 28, 2013, 11:17:14 AM (11 years ago)
Author:
meunier
Message:

Tried to clean the test_regression directory:

  • Code formatting
  • Supressed warnings
  • Made comprehensible outputs
  • Factorized Makefiles

There's still a lot to do (many tests don't pass for either good or bad reasons)

Location:
sources/test_regression/07052005
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sources/test_regression/07052005/Makefile

    r15 r55  
     1
    12include ../env.mk
     3include ../Makefile.common
    24
    3 SYSTEM    = system.cpp
    4 EXE_SCASS = $(SYSTEM:.cpp=_systemcass.x)
    5 EXE_SC    = $(SYSTEM:.cpp=_systemc.x)
    6 EXE       = ${EXE_SCASS} ${EXE_SC}
    7 LOG       = $(SYSTEM:.cpp=.log)
    8 OBJECTS   = $(EXE:.x=.o)
    9 LINKS     = $(OBJECTS:.o=.cpp)
     5test: 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 ;
    1013
    11 .SECONDARY:
    12 
    13 main : $(EXE)
    14 
    15 test : ${LOG}
    16         @echo Test OK.
    17 
    18 %.log : %_systemcass.x %_systemc.x
    19         ./$*_systemcass.x
    20         touch $*.log
    21 
    22 %.gif : %.dot
    23         dot -Tgif -o $*.gif $*.dot
    24 
    25 %_systemc.x : %_systemc.o $(SYSTEMC_LIB)
    26         $(CXX) -o $@ $*_systemc.o $(LFLAGS_SYSTEMC) 2>&1 | $(CPPFILT)
    27 
    28 %_systemcass.x : %_systemcass.o  $(SYSTEMCASS_LIB)
    29         $(CXX) -o $@ $*_systemcass.o $(LFLAGS_SYSTEMCASS) 2>&1 | $(CPPFILT)
    30 
    31 -include Makefile.deps
    32 
    33 %_systemc.cpp : %.cpp
    34         ln -s $*.cpp $*_systemc.cpp
    35 
    36 %_systemcass.cpp : %.cpp
    37         ln -s $*.cpp $*_systemcass.cpp
    38 
    39 %_systemc.o : %_systemc.cpp
    40         $(CXX) $(CFLAGS_SYSTEMC) -MM $*_systemc.cpp >> Makefile.deps
    41         $(CXX) $(CFLAGS_SYSTEMC) -c $*_systemc.cpp -o $*_systemc.o
    42 
    43 %_systemcass.o : %_systemcass.cpp
    44         $(CXX) $(CFLAGS_SYSTEMCASS) -MM $*_systemcass.cpp >> Makefile.deps
    45         $(CXX) $(CFLAGS_SYSTEMCASS) -c $*_systemcass.cpp -o $*_systemcass.o
    46 
    47 clean :
    48         rm -f Makefile.deps
    49         -rm -f *.o gmon.out *~
    50         -rm -f ${LOG}
    51         -rm -f signal_order.txt module_order.dot signal_graph.dot
    52         -rm -f module_order.gif signal_graph.gif
    53         -rm -f $(EXE) $(OBJECTS)
    54         -for i in $(LINKS) ; do unlink $$i ; done 2> /dev/null
    55         -rm -f core*
    56         -rm -rf system_systemcass.x.vcd system_systemc.x.vcd
    57         -rm -rf generated_by_systemcass
    58        
  • sources/test_regression/07052005/system.cpp

    r1 r55  
    1 #include <systemc.h>
     1
     2
    23#include <iostream>
     4
     5#include "systemc.h"
     6#include "test.h"
    37
    48
     
    610
    711
    8 int
    9 sc_main (int argc, char ** argv)
    10 {
    11   int errnum = 0;
    12  
    13   sc_uint<17> a;
    14   sc_uint<3>  b;
    15   sc_uint<2>  c1;
    16   sc_uint<2>  c2;
    17   sc_uint<5>  d;
    18   sc_uint<7>  e;
    19   sc_uint<1>  f;
    20   sc_uint<16> g;
    21   sc_uint<8>  h;
     12int sc_main (int argc, char ** argv) {
    2213
    23   b  = 0x7;
    24   c1 = 0x3;
    25   c2 = 0x1;
    26   d  = 0xA0;
    27   e  = 0x11;
    28   g  = 0xabcd;
     14    sc_uint<17> a;
     15    sc_uint<3>  b;
     16    sc_uint<2>  c1;
     17    sc_uint<2>  c2;
     18    sc_uint<5>  d;
     19    sc_uint<7>  e;
     20    sc_uint<1>  f;
     21    sc_uint<16> g;
     22    sc_uint<8>  h;
    2923
    30   // bit vector concatenation and boolean concatenation
    31   a = (b,
    32        (c1 | c2),
    33        d & (b,c1),
    34        e);
    35  
    36   f = b.range (0,0);
     24    b  = 0x7;
     25    c1 = 0x3;
     26    c2 = 0x1;
     27    d  = 0xA0;
     28    e  = 0x11;
     29    g  = 0xabcd;
    3730
    38   h = g.range (11,4);
     31    // bit vector concatenation and boolean concatenation
     32    a = (b, (c1 | c2), d & (b, c1), e);
    3933
    40   errnum++;
    41   cerr << "a = 0x" << hex << (unsigned int)a << " = " << a.to_string (SC_BIN) << "\n";
    42   if (a.to_string (SC_BIN) != "0b000000111100010001")
    43   {
    44     exit (errnum);
    45   }
     34    f = b.range (0, 0);
    4635
    47   errnum++;
    48   cerr << "f = 0x" << hex << (unsigned int)f << " = " << f.to_string (SC_BIN) << "\n";
    49   if (f.to_string (SC_BIN) != "0b01")
    50   {
    51     exit (errnum);
    52   }
     36    h = g.range (11, 4);
    5337
    54   errnum++;
    55   cerr << "h = 0x" << hex << (unsigned int)h << " = " << h.to_string (SC_BIN) << "\n";
    56   if (h.to_string (SC_BIN) != "0b010111100")
    57   {
    58     exit (errnum);
    59   }
     38    cout << "a = 0x" << hex << (unsigned int) a << " = " << a.to_string(SC_BIN) << "\n";
     39    //ASSERT(a.to_string(SC_BIN) == "0b000000111100010001");
    6040
    61   cerr << "Test OK.\n";
    62   return 0;
     41    cout << "f = 0x" << hex << (unsigned int) f << " = " << f.to_string(SC_BIN) << "\n";
     42    //ASSERT(f.to_string(SC_BIN) == "0b01");
     43
     44    cout << "h = 0x" << hex << (unsigned int) h << " = " << h.to_string(SC_BIN) << "\n";
     45    //ASSERT(h.to_string(SC_BIN) == "0b010111100");
     46
     47    cout << "Test OK.\n";
     48
     49    return 0;
    6350}
    6451
     52
     53/*
     54# Local Variables:
     55# tab-width: 4;
     56# c-basic-offset: 4;
     57# c-file-offsets:((innamespace . 0)(inline-open . 0));
     58# indent-tabs-mode: nil;
     59# End:
     60#
     61# vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
     62*/
     63
Note: See TracChangeset for help on using the changeset viewer.