Email: bknpk@hotmail.com Phone: +972-54-7649119


V

 

This page describes the script used in the systemc parameterized CRC module.

  1. The following compilation / simulation options exists:

  2. option name

    Description

    (none)

    Skips compilation, checks if executable exists:yes run it without debugger. no shows first error using less command.

    comp

    Compiles, checks if executable was created:yes run it without debugger. no shows first error using less command.

    comp gdb

    Compiles, checks if executable was created:yes run it with GDB debugger. no shows first error using less command.

    gdb

    Checks if executable was created:yes run it with GDB debugger. no shows first error using less command.


  3. Note that you can not run the systemc executable from the script. Since the script does not globally set the environment variable, namely, LD_LIBRARY_PATH, you can not run it from terminal, unless you set it manually.

  4. The script measures the time, in seconds, that the compilation takes to run. It prints it and in case of error, appends it to the compilation log file: log.txt.
    The way it is done is shown below:

    1. #!/bin/bash

    2. LD_LIBRARY_PATH=.:/mnt/Home/pini/Home_1/pini/systemc_2.2.0/include:/mnt/Home/pini/Home_1/pini/systemc_2.2.0/lib-linux:${LD_LIBRARY_PATH}
    3. export LD_LIBRARY_PATH

    4. if [ "$1" = "comp" ] ; then #allows to skip compilation
    5.   time_start=`date +%s`

    6.   clear
    7.   \rm -f run.x *.o

    8.   time_start=`date +%s`

    9.   echo "compilation started"
    10.   make linux >& log.txt
    11.   echo "compilation ended"

    12.   time_end=`date +%s`
    13.   time_tot=$(($time_end - $time_start))
    14.   echo "it took "${time_tot}" seconds for compilation to end"
    15. fi

  5. To enable debug, I have made slight changes in the make file. I removed optimizations and add the debug switches:
    g++ -I${SYSC_INC_PREFIX} -I${includedir} -fPIC -c -g -Wall -O2 ${SOURCE_FILES}; \
    g++ -g Wno-deprecated -fno-default-inline -fno-inline -gstabs -I${SYSC_INC_PREFIX} -I${includedir} -fPIC -c -g -Wall ${SOURCE_FILES}; \

    Put a break point, decide what commands gdb will execute, when it breaks at the break point and run.
    1. ./run_test.unx comp gdb
    2. break crc_auto_inst.cpp:67
    3. command 1
    4. p data_t
    5. p u_name
    6. end
    7. r

    8. p (char *)inst_buf
    9. $1 = 0xbfc0e192 "u_0"
    10. p name
    11. $1 = (sc_module_name &) @0xbf929854: {m_name = 0x80f34a7 "u_dut",
    12. m_module_p = 0xbf9295b8, m_next = 0x0, m_simc = 0x8125558, m_pushed = true}

      1. Another debug option is to instruct g++ to generate dependencies (in .d files). In the Makefile.rules add the MMD switch:
        g++ -MMD -g Wno-deprecated

        This will create the file crc_auto_inst.d:
        1. crc_auto_inst.o: crc_auto_inst.cpp \
        2.   /mnt/Home/pini/Home_1/pini/systemc_2.2.0/include/systemc.h \
        3.   /mnt/Home/pini/Home_1/pini/systemc_2.2.0/include/systemc \
        4.   /mnt/Home/pini/Home_1/pini/systemc_2.2.0/include/sysc/kernel/sc_cmnhdr.h \
        5.   /mnt/Home/pini/Home_1/pini/systemc_2.2.0/include/sysc/kernel/sc_externs.h \
        6. ...
        7.   /mnt/Home/pini/Home_1/pini/systemc_2.2.0/include/scv/scv_tr.h \
        8.   /mnt/Home/pini/Home_1/pini/systemc_2.2.0/include/scv/scv_kit_date.h

      2. The second part of the script starts simulation, optionally with debugger invocation, if it finds the executable file: run.x . If does not find it, then it shows the first error, using less command.
        This part of the script is listed below:
        1. #checks if okay; if so run ; otherwise display errors
        2. if [ -e "run.x" ]
        3. then
        4.   if [ "$1" = "gdb" ] || [ "$2" = "gdb" ] ; then
        5.     gdb ./run.x
        6.   else
        7.     ./run.x
        8.   fi
        9. else
        10.   echo "it took "${time_tot}" seconds for compilation to end" >> log.txt
        11.   less -p "crc_auto_inst.*error.*" log.txt
        12. fi
        13. echo "script end"




          1. To go to main project page: systemc parameterized CRC module .
  ...


Home

some memory VHDL models

Download Area






Search This Site


Feedback This Site




new pages on this site