Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


Everything posted by AmeyaVS

  1. Hello @vasu_c, Can you let us know what platform you are using for the AArch64 build? and also, if possible the ABI specifications of the GCC compiler as well? Thanks and Regards, Ameya Vikram Singh
  2. AmeyaVS

    clock generation in system c

    Hello @veeresh k, This example does not have a dedicated clock generator. // These statements are what driving the clock signal to with High time of 1 ns and low time of 1 ns. for (i=0;i<10;i++) { clock = 0; sc_start(1, SC_NS);// Run simulation for 1 ns. clock = 1; sc_start(1, SC_NS);// Run simulation for 1 ns. } What message you receive from the SystemC kernel refers to the timescale of 1 ps e.g.: Info: (I702) default timescale unit used for tracing: 1 ps You can get the SystemC API documentation for the sc_clock from here: SystemC sc_clock api reference. If you need a sample you can find a use-case reference here(though a little bit-dated): https://github.com/AmeyaVS/SystemC_ramblings/blob/ff1a111063842bfcd6f5de6bb3db74917dc6331c/src/03_fir/firsytemmain.cpp#L26 Hope it helps. Regards, Ameya Vikram Singh
  3. AmeyaVS

    How to create an array of sc_module objects

    Hello @Ganesan R, It seems you are trying to achieve the vector of vector instance, something like this: sc_vector < sc_vector < your module > > You can find necessary discussion on this here: http://forums.accellera.org/topic/5616-initialization-of-nested-sc_vector-sc_vector/ Without sample code it is very difficult to discern the scenario you are trying to replicate. Can you provide some minimal sample code? Regards, Ameya Vikram Singh
  4. Hi, It seems I have hit a bug in VCD tracing implementation in SystemC release 2.3.2. Here is the bracktrace captured in GDB: (minimal example available here: https://github.com/AmeyaVS/SystemC_ramblings/tree/dev) as one can observe the exception: SIGFPE in systemc-2.3.2/src/sysc/tracing/sc_trace_file_base.cpp:268 due to divide by zero error. GNU gdb (Ubuntu 8.1-0ubuntu3) Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/ameya/Documents/demo/SystemC_ramblings/src/02_adder/build/tests/AdderTest/AdderTest.run...done. (gdb) r Starting program: /home/ameya/Documents/demo/SystemC_ramblings/src/02_adder/build/tests/AdderTest/AdderTest.run [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". SystemC 2.3.2-Accellera --- May 1 2018 16:30:17 Copyright (c) 1996-2017 by all Contributors, ALL RIGHTS RESERVED At time 0 s :: (a, b, cin): 100 (sum, carry_out): 00 At time 0 s :: (a, b, cin): 010 (sum, carry_out): 00 At time 0 s :: (a, b, cin): 110 (sum, carry_out): 10 At time 0 s :: (a, b, cin): 001 (sum, carry_out): 10 At time 0 s :: (a, b, cin): 101 (sum, carry_out): 11 At time 0 s :: (a, b, cin): 011 (sum, carry_out): 10 At time 0 s :: (a, b, cin): 111 (sum, carry_out): 00 At time 0 s :: (a, b, cin): 111 (sum, carry_out): 01 Info: /OSCI/SystemC: Simulation stopped by user. Program received signal SIGFPE, Arithmetic exception. 0x00007ffff7b57799 in sc_core::sc_trace_file_base::timestamp_in_trace_units (this=this@entry=0x5555557a3730, high=@0x7fffffffc658: 93824994651128, low=@0x7fffffffc660: 140737488346560) at /home/ameya/apps/src/systemc/systemc-2.3.2/src/sysc/tracing/sc_trace_file_base.cpp:268 268 unit_type unit_divisor = trace_unit_fs / kernel_unit_fs; (gdb) bt #0 0x00007ffff7b57799 in sc_core::sc_trace_file_base::timestamp_in_trace_units (this=this@entry=0x5555557a3730, high=@0x7fffffffc658: 93824994651128, low=@0x7fffffffc660: 140737488346560) at /home/ameya/apps/src/systemc/systemc-2.3.2/src/sysc/tracing/sc_trace_file_base.cpp:268 #1 0x00007ffff7b5d8a2 in sc_core::vcd_trace_file::get_time_stamp (this=this@entry=0x5555557a3730, now_units_high=@0x7fffffffc658: 93824994651128, now_units_low=@0x7fffffffc660: 140737488346560) at /home/ameya/apps/src/systemc/systemc-2.3.2/src/sysc/tracing/sc_vcd_trace.cpp:2086 #2 0x00007ffff7b5e242 in sc_core::vcd_trace_file::~vcd_trace_file (this=0x5555557a3730, __in_chrg=<optimized out>) at /home/ameya/apps/src/systemc/systemc-2.3.2/src/sysc/tracing/sc_vcd_trace.cpp:2145 #3 0x00007ffff7b5e319 in sc_core::vcd_trace_file::~vcd_trace_file (this=0x5555557a3730, __in_chrg=<optimized out>) at /home/ameya/apps/src/systemc/systemc-2.3.2/src/sysc/tracing/sc_vcd_trace.cpp:2153 #4 0x000055555555cfc1 in sc_main (argc=1, argv=0x5555557a2bf0) at /home/ameya/Documents/demo/SystemC_ramblings/src/02_adder/tests/AdderTest/src/full_adder_main.cpp:37 #5 0x00007ffff7b32e24 in sc_core::sc_elab_and_sim (argc=1, argv=<optimized out>) at /home/ameya/apps/src/systemc/systemc-2.3.2/src/sysc/kernel/sc_main_main.cpp:87 #6 0x00007ffff7097b97 in __libc_start_main (main=0x7ffff7aa1fa0 <main(int, char**)>, argc=1, argv=0x7fffffffddb8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdda8) at ../csu/libc-start.c:310 #7 0x000055555555c08a in _start () (gdb) I seems to happen only when the simulation time is not progressing. One can apply the below patch to branch (dev) available under here for the following sub-directory: https://github.com/AmeyaVS/SystemC_ramblings/tree/dev/src/02_adder diff --git a/src/02_adder/tests/AdderTest/src/driver.cpp b/src/02_adder/tests/AdderTest/src/driver.cpp index e70aea1..26169b7 100644 --- a/src/02_adder/tests/AdderTest/src/driver.cpp +++ b/src/02_adder/tests/AdderTest/src/driver.cpp @@ -7,8 +7,14 @@ void driver::prc_driver() { d_a = pattern[0]; d_b = pattern[1]; d_cin = pattern[2]; - wait(5, sc_core::SC_NS); + //wait(5, sc_core::SC_NS); + wait(sc_core::SC_ZERO_TIME); pattern++; + if (pattern == 0) { + break; + } } + wait(sc_core::SC_ZERO_TIME); + sc_core::sc_stop(); } This behavior is not reproduced in SystemC release 2.3.1a. I will try to debug further and hopefully with probable fix. Regards, Ameya Vikram Singh
  5. AmeyaVS

    SystemC _ what is mean symbol "\" ??

    Hello @Hook, The \ character is an escape sequence in C/C++. Here is a reference https://en.m.wikipedia.org/wiki/Escape_sequences_in_C I would recommend that you brush up your skills on C++ before continuing further. I would recommend the book "The C++ Programming Language Book by Bjarne Stroustrup". Hope it helps. Regards, Ameya Vikram Singh
  6. AmeyaVS

    wait in SC_CTOR()

    Hello @SystemCInDepth, The wait() call can only be used in SC_THREAD/SC_CTHREAD registered processes in SystemC library. You are trying to call wait even before the elaboration happens and you have started the simulation. It would be better if you could go through the book: SystemC from Ground Up by David Black to have a better understanding. Hope it helps. Regards, Ameya Vikram Singh
  7. AmeyaVS

    define sc_main in VS 2017

    Hello @Aaron0127, The entry point for creating the simulation models and starting simulation is supposed to be implemented within sc_main function. This was done to support the EDA tools vendors to support extensive debugging capability with their tools. In the available open source implementation the main function is provided by the SystemC library itself. Only the sc_main function implementation has to be provided by you. Hope it helps. Regards, Ameya Vikram Singh
  8. AmeyaVS

    Debugging SystemC Code in x64 Platform

    Hello @wasim6691, Did you build the SystemC library in debug mode and installed it? On Windows using MSVC you cannot mix and match the Debug and Release Build libraries together. You would need to configure SystemC library installation in Debug build to Debug your models. Regards, Ameya Vikram Singh
  9. AmeyaVS

    thread resets and events

    Hello @fdoucet, Sorry for the late response. But the "WAIT_UNTIIL()" macro has been refactored to be "SC_WAIT_UNTIL()". You can find the reference to the changes in the "RELEASENOTES" of the SystemC 2.3.2 release: RELEASENOTES:388: - The non-standard macros WAIT, WAITN and WAIT_UNTIL have been RELEASENOTES:389: renamed to SC_WAIT, SC_WAITN, SC_WAIT_UNTIL. Hope it helps. Regards, Ameya Vikram Singh
  10. AmeyaVS

    Debugging Multi threaded program in SystemC

    Hello @ANKUR SAINI, If you are on Linux/UNIX with the Accellera release of SystemC library with the GNU toolchain, you can use the following tutorials for reference: https://sourceware.org/gdb/onlinedocs/gdb/Threads.html https://stackoverflow.com/questions/1695268/multi-threaded-debugging-tutorial-for-gdb-and-c Due to the co-operative multi-tasking implementation of the SystemC library available from Accellera as @Roman Popov has mentioned, much of the debugging tasks are easier since all threads synchronize with the main library thread. Let me know if it helps. Regards, Ameya Vikram Singh
  11. AmeyaVS


    Hello @wasim6691, With the current implementation of the SystemC library available on the Accellera website, once the simulation has been started using sc_start you cannot dynamically change the number of modules instantiated. I would once again refer the comment from @maehne, that you need to get your basics right for SystemC before continuing further on your project. Regards, Ameya Vikram Singh
  12. AmeyaVS

    Does system C support matrix of unknown size

    Hello @Ganesan R, What are the possible values of m and n?(It seems to take default value of 0) For array of SystemC objects there is a construct available for such purposes: sc_vector. Try search here in the forums to find the necessary discussions. e.g.: http://forums.accellera.org/topic/5775-vector-of-modules-errors/?tab=comments#comment-14006 Hope it helps. Regards, Ameya Vikram Singh
  13. AmeyaVS

    SystemC 2.3.2 installation error

    Hello @ANKUR SAINI, You can find a snippet of build script for SystemC library installation here: https://github.com/AmeyaVS/SystemC_ramblings/blob/master/resources/build.sh Note: You will need CMake and a C++11 enabled compiler for building the SystemC library with the script provided above. Let me know if it helps. Regards, Ameya Vikram Singh
  14. AmeyaVS

    SystemC 2.3.2 Public Review Now Open

    Hello @shanh, What compiler version are you using? Can you share the build verbose logs? Best Regards, Ameya Vikram Singh
  15. AmeyaVS

    SystemC 2.3.2 Public Review Now Open

    Hello @shanh, When you are linking your application/library to SystemC library you need to specify the C++ standard flags: // For G++ C++11 g++ -std=c++11 // For G++ C++14 g++ -std=c++14 You add these options to the build system configuration options for your application/library build. Regards, Ameya Vikram Singh
  16. AmeyaVS

    SystemC CCI Build Issues

    Hello @Philipp A Hartmann, Following is my testing development environment: Platform: Cygwin 64-Bit GCC Version: 6.4.0-5 And I have attached the verbose logs for build. I tried your suggestions for wrapping the specialization of the cci_value_converter class with the CCI namespace in the ex16_User_Defined_Data_Type and it seems to fix the issue. Also for the ex07_Parameter_Information example the following patch fixes the issue currently on Cygwin 64-bit. diff --git a/examples/ex07_Parameter_Information/ex07_Parameter_Information.cpp b/examples/ex07_Parameter_Information/ex07_Parameter_Information.cpp index 1326be0..46fa307 100644 --- a/examples/ex07_Parameter_Information/ex07_Parameter_Information.cpp +++ b/examples/ex07_Parameter_Information/ex07_Parameter_Information.cpp @@ -106,7 +106,7 @@ int sc_main(int sc_argc, char* sc_argv[]) { ex07_observer observer_class("observer"); // Simulation time - sc_core::sc_start(30.0, sc_core::SC_NS); + ::sc_core::sc_start(30.0, sc_core::SC_NS); return EXIT_SUCCESS; } // End of sc_main diff --git a/examples/ex16_User_Defined_Data_Type/ex16_user_datatype.h b/examples/ex16_User_Defined_Data_Type/ex16_user_datatype.h index 471fe41..6ec2cc8 100644 --- a/examples/ex16_User_Defined_Data_Type/ex16_user_datatype.h +++ b/examples/ex16_User_Defined_Data_Type/ex16_user_datatype.h @@ -76,8 +76,9 @@ struct route_table_ut { }; // add support for cci_value and JSON (de)serialization +CCI_OPEN_NAMESPACE_ template<> -struct cci::cci_value_converter< route_table_ut > +struct cci_value_converter< route_table_ut > { typedef route_table_ut type; static bool pack( cci_value::reference dst, type const & src ) @@ -105,6 +106,7 @@ struct cci::cci_value_converter< route_table_ut > return false; } }; +CCI_CLOSE_NAMESPACE_ // Overload stream insertion operator of C++ std::ostream& operator <<(std::ostream& os, const route_table_ut& ud) You can also have a look into the verify logs after introducing these fixes. I will also try to build and test on other environments and provide other feedback for the CCI release. Thanks and Regards, Ameya Vikram Singh verifyVerboseLogs.tar.xz verifyFixedLogs.tar.xz Update: Only for the ex16_User_Defined_Data_Type I need to make changes on Linux 64-Bit with g++(5.4.0 C++11 enabled).
  17. Hi, I tried using the SystemC CCI draft release.(cci-0.9.0_pub_rev_20171219.tgz) Currently the following examples fail to compile: ex07_Parameter_Information ex16_User_Defined_Data_Type Please find the failure logs attached. I have also noticed that the CCI source contains systemc.h (src/cci_core/systemc.h)header file, from a cursory look it looks as if a wrapper around the header file (systemc) from SystemC library. Would it cause build issues when using SystemC CCI with legacy models which includes the systemc.h header file? Thanks and Regards, Ameya Vikram Singh verifyLogs.tar.xz
  18. AmeyaVS

    thread resets and events

    Hello @fdoucet, What your are trying to do here in this specific scenario is known as dynamic sensitivity. Dynamic sensitivity replaces the default sensitivity of the registered SystemC process, once the event it triggered the default sensitivity would be restored for the corresponding process. Here is a reference to the discussion before in this forum: http://forums.accellera.org/topic/1210-static-and-dynamic-sensitivity/ Hope it helps Regards, Ameya Vikram Singh
  19. AmeyaVS

    Executing Modules More than Once

    Hello @wasim6691, I totally agree with @David Black, Can you provide a minimal example of what your are trying to achieve? From your minimal description all I could figure out are the following scenarios: You are not generating enough transactions/events in your simulation models and the simulation is exiting with the error message: Stopping simulation due to starvation You are yourself stopping the simulation with a call to sc_stop() before the next iteration can begin. Post more details about the issue you are facing so that more community members can help you figure it out faster. Regards, Ameya Vikram Singh
  20. AmeyaVS

    How to define constructor in cpp file?

    Hello @Ganesan R, Since it is usual C++ code. You just need to define it as in C++. For e.g.: #include "NAME.h" SC_HAS_PROCESS(NAME); NAME::NAME(sc_core::sc_module_name nm) //< Added sc_core namespace resolution. : sc_core::sc_module(nm) //< Added sc_core namespace resolution. {} ////////////////////////////// // Check below ///////////////////////////// NAME::~NAME() { // You Destructor body } Hope it helps. Regards, Ameya Vikram Singh
  21. AmeyaVS

    Stack Size Overflow due to recursion

    Hi @wasim6691, Here is a small set of questions if you can provide some answers it would be helpful: Can you provide details about the development environment?(Linux/Windows) How are you setting up the stack size? Can you modify your code to use dynamically allocated array just for the sake of modelling? Regards, Ameya Vikram Singh
  22. AmeyaVS

    Mingw Compile Issue

    Hello @Matthias Jung, Can you post the version of the g++ compiler? Also using the bash shell of the MinGW environment post the output of the following command: # Note provide the full path to SystemC static library nm -C <full_path_to_libsystemc.a> | grep sc_api_version Regards, Ameya Vikram Singh
  23. AmeyaVS

    Mingw Compile Issue

    Hi @Matthias Jung, You should use cmake generator provided from MinGW package manager. In-case you are using the version from CMake official release then you would need to add the MinGW utilities to the system PATH environment variable. set MINGW_HOME=<PATH to MINGWROOT> set PATH=%PATH%:%MINGW_HOME%/bin # Check if you have make available on the cmd.exe make --version # Check if gcc/g++ is available on the cmd.exe gcc --version g++ --version # Configure CMake to use the make file generator on the configuer step in SystemC build directory. cmake -G "MinGW Makefiles" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. # or in-case the previous one doesn't work. cmake -G "MSYS Makefiles" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. Note: To find the list of supported generator from CMake you can use this command: cmake -G --help Update: Here is the official documentation on the CMake Makefile Generator: https://cmake.org/cmake/help/latest/generator/MinGW Makefiles.html#generator:MinGW Makefiles Regards, Ameya Vikram Singh
  24. AmeyaVS

    Mingw Compile Issue

    Hello @Matthias Jung, It seems you are missing some of the compiler definition flags for the build: -DSC_BUILD ... etc. You can get the set of compiler flags for the SystemC library from the CMake generator(Only works with Makefile generator). # Using CMake to create compile_commands.json # SYSTEMC_SRC: SystemC source directory. cd $<SYSTEMC_SRC> # Create a build directory mkdir build cd build # Run CMake configuration for Make file generator. cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. Note: Also the quick thread library for user space thread support will not work on Windows since it is compatible only on Linux systems. Regards, Ameya Vikram Singh
  25. AmeyaVS

    Errors in code

    Hello @Uzmeed, You are assigning multiple values in the PS_reg in the same delta cycle in SC_METHOD. It is better that you refer for SystemC LRM (refer: here) sections: 5.2.9, 5.2.10, 5.2.11 specifically to know about the differences in different processes in SystemC. Regards, Ameya Vikram Singh