Jump to content

All Activity

This stream auto-updates     

  1. Last week
  2. I would like to know what is the recommended place to implement functional coverage 1) non temporal functional coverage - coverpoints I understand these can be implemented in monitors, scoreboards, subscribers, coverage collectors (though I don't know what the last 2 really are) 2) temporal functional coverage - cover directives I understand these can be implemented in interfaces, modules or programs
  3. Notify() Using Event Between Two modules

    Use pointers, references, or write your sc_interface and then use ports/exports. Example with references: #include <systemc.h> struct recv_mod : sc_module { sc_event &write_event; sc_event &recv_event; int &value ; recv_mod(::sc_core::sc_module_name, sc_event &write_event, sc_event &recv_event, int &value ) : write_event(write_event), recv_event(recv_event), value(value) { SC_HAS_PROCESS(recv_mod); SC_THREAD(receiver_thread); } void receiver_thread() { while (1) { wait(write_event); cout << "Read " << value << " at delta: " << sc_delta_count() << endl; recv_event.notify(); } } }; struct trans_mod : sc_module { SC_CTOR(trans_mod) { SC_THREAD(transmitter_thread); } sc_event write_event{"write_event"}; sc_event recv_event{"recv_event"}; int value = 0; recv_mod recv{"recv", write_event, recv_event, value}; void transmitter_thread() { wait(SC_ZERO_TIME); // need to wait to guarantee that reciever is waiting for event for (int i = 0; i < 4; i++) { cout << "Write " << i << " at delta: " << sc_delta_count() << endl; value = i; write_event.notify(); wait(recv_event); } sc_stop(); } }; int sc_main (int argc, char** argv) { trans_mod t{"t"}; sc_start(); } Simulation result: Write 0 at delta: 1 Read 0 at delta: 1 Write 1 at delta: 1 Read 1 at delta: 1 Write 2 at delta: 1 Read 2 at delta: 1 Write 3 at delta: 1 Read 3 at delta: 1
  4. Notify() Using Event Between Two modules

    And The MODULE-1(producer) and MODULE-2(consumer) are different Classes in my code. they are not the processes within one MODULE
  5. Notify() Using Event Between Two modules

    Yes I want to read the new ( 42) value in the MODULE_2. Can You help me how to modify the above code to read the value immediately. If I use wait() then console keeps on running towards other processes or the next module which i do not want. thanks
  6. Notify() Using Event Between Two modules

    Do you want to write something like this ?: Producer process: out1.write(42); sig_written.notify(); Consumer process: wait(sig_written); out1.read(); In that case you will read current value of signal, not new one (42). If you want to transfer data immediately between processes, use plain C++ variables.
  7. // MODULE 1 WRITING THE OUT1 to Value 1 SC_MODULE(MODULE_1){ public: //-------------PORTS DECLARATIONS--------------------------- sc_in<bool> reset; sc_out<bool> out1 ; // ---event sc_event sig_written; public: void Process(); public: SC_CTOR(MODULE_1){ SC_METHOD(Process); sensitive << reset; } void Process() { if (reset == 1) out1.write(1); sig_written.notify(); // to make it runnable within the execution phase and not in the Next delta cycle } }; //---------------------------------------------------------------------------------------------------------- // MODULE 2 READING OUTPUT VALUE FROM MODULE_1 SC_MODULE(MODULE_2){ public: //-------------PORTS DECLARATIONS--------------------------- sc_in<bool> input1; sc_out<bool> out2 ; public: // HOW TO DEFINE EVENT HERE ? // PROCESS void Process(); public: SC_CTOR(MODULE_2){ SC_METHOD(Process); sensitive << input1; } void Process() { bool x; x = input1.read(); // reading the Output Value from Module 1. I want to read here 1 because of output // written in the MODULE_1 is 1 if (x == 1) out2.write(1); // HOW TO USE EVENT HERE ? SHARED EVENT } }; Hi I am outputting One value from MODULE 1 and notifying it through sig_written.notify() event to make it detectable in the same execution phase and not in the next delta cycle. Can You tell me How to use the event in the MODULE_2 to detect this event and read the value immediately without going into next delta cycle. thanks
  8. Stack Size Overflow due to recursion

    Do not put large arrays on process stack. Put them into Module instead, and allocate module in heap. Example: Large array on stack: SC_MODULE(top) { SC_CTOR(top){ SC_THREAD(thread); } void thread() { int large_array[1000000000]; // will be allocated on sc_thread stack } }; int sc_main(int , char**) { top top_inst{"top_inst"}; sc_start(); } After refactoring: SC_MODULE(top) { SC_CTOR(top){ SC_THREAD(thread); int large_array[1000000000]; // inside module body } void thread() { } }; int sc_main(int , char**) { auto top_inst = std::make_unique<top>{"top_inst"}; // allocated on heap sc_start(); }
  9. Stack Size Overflow due to recursion

    Hi 1) my Development Environment is Windows with Visual Studio 2013 for Desktop 2) In Visual Studio, You have the option in the Linker--- System--- Setting for Stack and Heap Size 3) Yes, This is the only option to use Dynamically Allocated. But Can You suggest me some other option to get out of this Stack over flow Problem. ? Thanks. RECURSION: By recursion I mean that If I am sending input from Module-1 to Module-2 and then I am expecting a result from Module-1 to Module-2 (Here in their processes I am using sig.value_changed_event()) and then after getting the result from Module-1, Module-2 send the input to Module-3.
  10. 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
  11. Stack Size Overflow due to recursion

    Don't use recursion? Remember that the stack size applies to each process (SC_THREAD and SC_METHOD), and the machine you are running on needs to have enough memory to accommodate this. If you have 16 threads running with 1G stack, then you need a machine with 16G just for your threads.
  12. Hi I have 3 to 4 modules and they have 3 to 4 inputs but to synchronize the timing of inputs as they all have to have specific value only then my THREAD PROCESS should run, I am using value_changed_event inside the THREAD PROCESS of the MODULE by using wait(sig.value_changed_event()). But In some MODULES, I am initializing large arrays and due to this when the value changes then it rerun from the 1st Module to the Last and stops in the mid-way displaying the stack over flow as the exception. What Should be the possible solution for this ? I have Increase the Stack size upto 1Giga but still does not work. Thanks
  13. Mingw Compile Issue

    C:\<...>\main.cpp:-1: error: undefined reference to `sc_core::sc_api_version_2_3_2_cxx201103L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_2_cxx201103L(sc_core::sc_writer_policy)' This error suggests that you are building your application with cxx201103L = C++11. But SystemC library was build with C++98. So you either have to rebuild SystemC library with C++11, or use C++98 for your application. Here is an example how to build SystemC and Applications using CMake (with option to enable C++11): https://stackoverflow.com/a/46880679/1503413 If you are using CMake, you can configure your application to use same C++ standard you were using for library build automatically: find_package(SystemCLanguage CONFIG REQUIRED) set (CMAKE_CXX_STANDARD ${SystemC_CXX_STANDARD}) Btw, g++ 5.3 you are using supports C++14, so you can use it instead of C++11. Just pass -DCMAKE_CXX_STANDARD=14 when generating Makefile using CMake.
  14. I want to run examples under scv-2.0.0 I prefer to run compile(g++) in command line
  15. 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
  16. Mingw Compile Issue

    So I can build sucessfully SystemC with QtCreator under Windows with MinGW that is provided with QtCreator using CMake. So it should now be pretty save that the SystemC compiling process is correct. However, when I use the SystemC Library withing one of my projects, I have again this error: C:/<...>/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Release mingw32-make[1]: Entering directory 'C:/<...>/Programming/SCVP.artifacts/build-tlm_at_1-Desktop_Qt_5_10_0_MinGW_32bit-Release' g++ -Wl,-s -Wl,-subsystem,console -mthreads -o release\tlm_at_1.exe release/main.o release/memory_manager.o -LC:\Users\jung\Programming\systemc-2.3.2\build-systemc-2.3.2-Desktop_Qt_5_10_0_MinGW_32bit-Default\src -lsystemc C:\<...>\main.cpp:-1: error: undefined reference to `sc_core::sc_api_version_2_3_2_cxx201103L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_2_cxx201103L(sc_core::sc_writer_policy)' This are the Flags used by CMake [ { "directory": "C:/<...>/Programming/systemc-2.3.2/build-systemc-2.3.2-Desktop_Qt_5_10_0_MinGW_32bit-Default/src", "command": "C:\\<...>\\Qt\\Tools\\mingw530_32\\bin\\g++.exe -DSC_BUILD -DSC_ENABLE_ASSERTIONS -DSC_ENABLE_EARLY_MAXTIME_CREATION -DSC_ENABLE_SIMULATION_PHASE_CALLBACKS_TRACING -DSC_INCLUDE_FX -DWIN32 @CMakeFiles/systemc.dir/includes_CXX.rsp -O3 -DNDEBUG -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -std=gnu++98 -o CMakeFiles\\systemc.dir\\sysc\\communication\\sc_clock.cpp.obj -c C:\\<...>\\Programming\\systemc-2.3.2\\systemc-2.3.2\\src\\sysc\\communication\\sc_clock.cpp", "file": "C:/<...>/Programming/systemc-2.3.2/systemc-2.3.2/src/sysc/communication/sc_clock.cpp" }, ... ] Here is the qmake project example: TARGET = tlm_at_1 TEMPLATE = app CONFIG += console CONFIG -= app_bundle CONFIG -= qt INCLUDEPATH += C:\<...>\Programming\systemc-2.3.2\systemc-2.3.2\src LIBS += -LC:\<...>\Programming\systemc-2.3.2\build-systemc-2.3.2-Desktop_Qt_5_10_0_MinGW_32bit-Default\src -lsystemc HEADERS += ../tlm_memory_manager/memory_manager.h HEADERS += initiator.h HEADERS += target.h HEADERS += util.h SOURCES += main.cpp SOURCES += ../tlm_memory_manager/memory_manager.cpp It seams that Systemc was build with -std=gnu++98 also adding this flag to the qt-project does not help to solve the issue.
  17. Mingw Compile Issue

    I tried that before and it was not working. However, now its working thanks for the hint! Regards Matthias
  18. Mingw Compile Issue

    Oh, and after reading the full compiler error, I see that @AmeyaVS is absolute right about the missing SC_BUILD define.
  19. Mingw Compile Issue

    If you want to build SystemC inside QtCreator you can use CMake project bundled with systemc 2.3.2 ( Open Project, select CMakeLists.txt) . There is no need to create a qmake project.
  20. Mingw Compile Issue

    You need to make sure to select the C++ standard (C++03, C++11, C++14) consistently. See this thread for a detailed explanation: Hope that helps, Philipp
  21. 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
  22. Mingw Compile Issue

    When I start this, cmake uses MSVC for compiling, how can i force it to use MinGW? -DCMAKE_CXX_COMPILER -DCMAKE_CC_COMPILER Seems to be ignored
  23. 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
  24. Mingw Compile Issue

    Im setting up SystemC with qmake: TARGET = systemc TEMPLATE = lib CONFIG += staticlib CONFIG -= qt QMAKE_CXXFLAGS = -Wall -O3 #-std=c++11 QMAKE_CFLAGS = -Wall -O3 INCLUDEPATH += src/ SOURCES += $$files(src/sysc/communication/*.cpp, true) SOURCES += $$files(src/sysc/datatypes/bit/*.cpp, true) SOURCES += $$files(src/sysc/datatypes/fx/*.cpp, true) SOURCES += $$files(src/sysc/datatypes/int/*.cpp, true) SOURCES += $$files(src/sysc/datatypes/misc/*.cpp, true) SOURCES += $$files(src/sysc/kernel/*.cpp, true) SOURCES += $$files(src/sysc/tracing/*.cpp, true) SOURCES += $$files(src/sysc/utils/*.cpp, true) HEADERS += $$files(src/sysc/communication/*.h, true) HEADERS += $$files(src/sysc/datatypes/bit/*.h, true) HEADERS += $$files(src/sysc/datatypes/fx/*.h, true) HEADERS += $$files(src/sysc/datatypes/int/*.h, true) HEADERS += $$files(src/sysc/datatypes/misc/*.h, true) HEADERS += $$files(src/sysc/kernel/*.h, true) HEADERS += $$files(src/sysc/packages/boost/*.hpp, true) HEADERS += $$files(src/sysc/packages/boost/bind/*.hpp, true) HEADERS += $$files(src/sysc/packages/boost/config/*.hpp, true) HEADERS += $$files(src/sysc/packages/boost/config/compiler/*.hpp, true) HEADERS += $$files(src/sysc/packages/boost/config/platform/*.hpp, true) HEADERS += $$files(src/sysc/packages/boost/config/stdlib/*.hpp, true) HEADERS += $$files(src/sysc/packages/boost/detail/*.hpp, true) HEADERS += $$files(src/sysc/packages/boost/mpl/*.hpp, true) HEADERS += $$files(src/sysc/packages/boost/mpl/aux_/*.hpp, true) HEADERS += $$files(src/sysc/packages/boost/mpl/aux_/config/*.hpp, true) HEADERS += $$files(src/sysc/packages/boost/utility/*.hpp, true) HEADERS += $$files(src/sysc/tracing/*.h, true) HEADERS += $$files(src/sysc/utils/*.h, true) HEADERS += $$files(src/sysc/qt/qt.h, true) SOURCES += $$files(src/sysc/qt/qt.c, true) !contains(QMAKE_TARGET.arch, x86_64) { message("x86 build") SOURCES += $$files(src/sysc/qt/md/i386.s, true) } else { message("x86_64 build") SOURCES += $$files(src/sysc/qt/md/iX86_64.s, true) } Under Windows I have this compilation issue when I use Mingw as compiler: ..\systemc-2.3.2-qmake\src\sysc\kernel\sc_ver.cpp:166:1: error: specialization of 'sc_core::sc_api_version_2_3_2_cxx201103L<DisableVirtualBind>::sc_api_version_2_3_2_cxx201103L(sc_core::sc_writer_policy) [with const int* DisableVirtualBind = (& sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_)]' after instantiation ) ^ Has somebody an idea whats going on here? I assume that it has something to do with the order of the building?
  25. Hi experts, I have the following question about vertical reusability and null sequencers. I have a sequence that stimulates a sub block inside a TOP block. I have verified first the separated sub block. Therefore, i had a testbench for the sub block that has of course VC interfaces and registers. I would like to have a clear way of coding to allow vertical reusability of the sequence that test the sub block. In other words, i would like how to code the sub sequence so that i can start that sequence from a TOP module afterwards. I see the following problems 1)The TOP test bench will not have the interfaces (VCs) for the sub block. 2)The registers will be accessed through the TOP interface but not the sub interface. I can solve the 2 point by creating a new register model and connecting the predictor/adapter of the top. At the same time, i can overwrite the register model used in the sub block sequence so that it uses the new register TOP block handler correctly.---:OK However for the point one, it is more difficult. Theoretically, the sequence should ignore all the VCs of the sub block that are not used anymore. Now the sub block is driven by the TOP DUT and not by a test bench VC. How should a write the sequence so that these VC accesses are ignored in case a TOP sequence calling the old subsequence?. I though that any uvm_do macro that is performed to a VC that is not declared would be ignored but that is not the case... The only idea it comes to me is to code the sub-sequence with an if asking if the VC exists (not null). If it exists, then go ahead, but if it doesn´t assume that this access will be done by a TOP DUT and ignore it! Is this the right way to do this? How can you reuse your old sub sequence from the top sequence? Is there any methodology? Any link? Thanks in advance Jonathan
  26. Yes, of course. An example would be modeling interrupts, which is often done with an sc_signal<bool>.
  1. Load more activity
×