Jump to content

Elvis Shera

Members
  • Content Count

    25
  • Joined

  • Last visited

About Elvis Shera

  • Rank
    Member

Profile Information

  • Gender
    Male
  • Location
    Stuttgart Area, Germany

Recent Profile Visitors

425 profile views
  1. Elvis Shera

    Drive SCModel from a C-Shell

    @Eyck, "you don't assign anything to adata->sdata in sc_main In your if branch testing the pointer for NULL and create the design but then you throw away the pointer". I missed this. Thanks for pointing out. The issue I have in putting the loop inside sc_main is that I would be assuming how the external application will want to use the mode.? Think about the schenariou where you want to ship this model to a costumer. The only think they should care is the API interface exposed to them... data and methods eventually. In general I am not proud of this approach but I seem comming regularly into problems. A guideline on how to do this is missing. Maybe the folks in the working group can write a documetn/guideline to this. How would you approach this kind of problem if what you want is to pass an input vector to SC + timing and read yn output vector? the data can be from logic, int, string and reals. Yes. sc_elab_and_sim() will create peprfomance issues but cannot call sc_start() outside sc_main (like sc_stop) and i do not know anyother way of doing it. @David, Thanks for your inputs. Is clear but as you said... would need to play around on how to do this seems not trivial.
  2. Elvis Shera

    Drive SCModel from a C-Shell

    Hello, I am trying to drive an SC model via a C-shell. My C-Shell program: the SC model is exposed to the c-shell via an API declared as: the main.cpp of my SC model is: the DUT is modeled as a short... where the output = input every time the input is changing. The main program is compiled and I am generating a shared library out of it. Such library is then linked while creating an executable for the c-shell program. By playing around... I either get a core-dump or an error message telling me that it could not insret primitive channel. Does anyone see something wrong in my code ? Thanks Elvis
  3. Elvis Shera

    What is SystemC library special in?

    🙂 🙂 I have not notice this. Thank you Ameya
  4. Elvis Shera

    What is SystemC library special in?

    g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04) nm -C $SYSTEMC_HOME/lib-linux64/libsystemc.so | grep api_version 00000000000bef70 T sc_core::sc_api_version_2_3_3_cxx201402L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_3_cxx201402L(sc_core::sc_writer_policy) 00000000000bef70 T sc_core::sc_api_version_2_3_3_cxx201402L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_3_cxx201402L(sc_core::sc_writer_policy) 00000000003fb440 b sc_core::sc_api_version_2_3_3_cxx201402L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_3_cxx201402L(sc_core::sc_writer_policy)::default_writer_policy_config 00000000003fb444 b sc_core::sc_api_version_2_3_3_cxx201402L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_3_cxx201402L(sc_core::sc_writer_policy)::default_writer_policy_config_seen Thanks for looking at this, Elvis
  5. Elvis Shera

    What is SystemC library special in?

    I did that and it has at least improved the messaging. I also added the following lines: add_library(systemc SHARED IMPORTED) set_property(TARGET systemc PROPERTY IMPORTED_LOCATION "/home/Tools/SystemC/systemc-2.3.3/lib-linux64/libsystemc.so") now the problem i am seeing is the following: [100%] Linking CXX executable scapp CMakeFiles/scapp.dir/src/main.cpp.o: In function `__static_initialization_and_destruction_0(int, int)': /home/Tools/SystemC/systemc-2.3.3/include/sysc/kernel/sc_ver.h:182: undefined reference to `sc_core::sc_api_version_2_3_3_cxx201103L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_3_cxx201103L(sc_core::sc_writer_policy)' maybe for the more SystemC experts? Maybe the setup is not there yet as my sc project runs ok with the conventional make approach.
  6. Elvis Shera

    What is SystemC library special in?

    Hi Ameya, here is my file: ========================================================== cmake_minimum_required(VERSION 3.1) # setting this is required project(xor) # this sets the project name SET(TARGET_ARCH "linux64") set(CMAKE_PREFIX_PATH $ENV{SYSTEMC_HOME}) SET(SYSTEMC_INC_DIR "${CMAKE_PREFIX_PATH}/include") SET(SYSTEMC_LIB_DIR "${CMAKE_PREFIX_PATH}/lib-${TARGET_ARCH}") include_directories(${PROJECT_SOURCE_DIR}/inc ${SYSTEMC_INC_DIR}) file(GLOB SOURCES "src/*.cpp") set(CMAKE_CXX_STANDARD 11) # enable C++11 standard set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -c -Wall") add_executable(scapp ${SOURCES}) link_directories(${SYSTEMC_LIB_DIR}) target_link_libraries(scapp systemc) ========================================================== compilation works and it is finding the systemc include files but the linking not yet. As you can see from the error i get. c++: warning: CMakeFiles/scapp.dir/src/monitor.cpp.o: linker input file unused because linking not done you are using find_package in your example which suggest your entire installation of the systemc libraries has been done via cmake. In my case I have not followed the cmake approach hence the find_package is not working in my case.
  7. Elvis Shera

    What is SystemC library special in?

    Thanks Philipp, I already use Makefiles and these are ok. I also understand that via cmake build/install the cmake related configuration are generates so is easier then. My question goes in the direction of: If I don't use cmake to install systemC, how can I still use cmake for a systemc project ? I think I am almost done but the linking part is failing. The Makefile example I reported is already in use and working so the question is how do I translate that information for the Linker in an equivalent description for CMakeLists.txt? It should be trivial but it seems I am missing some steps..
  8. Elvis Shera

    What is SystemC library special in?

    in a manually made Makefile i have the following: # target architecture TARGET_ARCH = linux64 # specify paths SYSTEMC_INC_DIR = $(SYSTEMC_HOME)/include SYSTEMC_LIB_DIR = $(SYSTEMC_HOME)/lib-$(TARGET_ARCH) LDFLAGS = "-Wl,-rpath,$(SYSTEMC_LIB_DIR)" -L$(SYSTEMC_LIB_DIR) -lsystemc -lm the last taking care of the linking phase... I am new to cmake and I can see that is a nice build system but I am having a mental time to specify the same things in the CMakeLists.txt
  9. Elvis Shera

    What is SystemC library special in?

    What if the SystemC installation has not been done via Cmake? There must be a way to locate the libraries (given that systemc has been installed in a local directory) for the linking process. In that case what are the instruction to achieve this ?
  10. Elvis Shera

    SC_THREADS not starting?

    Ok. yes you are right... If I port the code back into the .h file it works... It also seems to be something wrong with the Makefile which is not compiling all the c sources. Maybe this is the real reason. Thanks for your help.
  11. Elvis Shera

    SC_THREADS not starting?

    why 2 declarations? I have a declaration inside the *.h file and the implementation in the .cpp file
  12. Elvis Shera

    SC_THREADS not starting?

    =============================================================================== #include <systemc.h> #include "stimuli.h" int sc_main(int argc, char* argv[]) { // signal connectivity sc_signal<bool> ASig, BSig; // clock signal is generated from the main in this case sc_clock clk("clk", 10, SC_NS, 0.5); // instance of stimuli block stimuli i_stim("Stimulus"); i_stim.A(ASig); i_stim.B(BSig); i_stim.clk(clk); // Tracing Waveforms sc_trace_file *Tf = sc_create_vcd_trace_file("traces"); Tf->set_time_unit(1, SC_NS); sc_trace(Tf, ASig , "A" ); sc_trace(Tf, BSig , "B" ); sc_trace(Tf, clk , "clk" ); // start simulation and run forever (until an sc_stop is called from some processes) sc_start(); // close tracefile sc_close_vcd_trace_file(Tf); // return 0 in case all is OK return 0; } =============================================================================== #include <systemc.h> #include <iostream> using namespace std; SC_MODULE(stimuli) { sc_out<bool> A, B; sc_in<bool> clk; void StimGen(void) {} SC_CTOR(stimuli) { cout << "Constructing Stimuli " << name() << endl; // indication of getting into elaboration phase SC_THREAD(StimGen); // this is like initial process in verilog and is invoked only once sensitive << clk.pos(); } }; =============================================================================== #include "stimuli.h" void stimuli::StimGen() { cout << "Stimuli check point - O" << endl; A.write(false); B.write(false); wait(); // wait() will suspend the proces, SC_THREAD in this case, save the sate and when the simulator will // resume the process it will continue execution after the wait statement. A.write(false); B.write(true); wait(); // wait 1 clock cycle - this is because the clock edge will resume the thread again A.write(true); B.write(false); wait(); // wait 1 clock cycle A.write(true); B.write(true); wait(); // wait 1 clock cycle sc_stop(); // stop the simulation } I am expecting that at least the checkpoint is displayed. Thanks for looking at this.
  13. Elvis Shera

    SC_THREADS not starting?

    This example is very close to the one in the Duolos website.: https://www.doulos.com/knowhow/systemc/tutorial/modules_and_processes/ For me it does not run either. I have tried to compile with --enable_pthread but still it does not compile. I am using SystemC-2.3.3 on ubuntu 18.04. my installation seems good. make check does give all test passing. Instead of SC_METHOD I am using SC_THREAD which is sensitive to the pos-edge of the clock. tracing the waveform I can see the clock is OK. However the SC_THREAD is not executed at all while I expect to at lest execute once. I have wait() statements in the StimGen() function but actually it does not matter as the first instruction is not print something which is not printed at all. Fundamental question here is: Are there reasons for a SC_THREAD to not be executed at all ? Elvis
  14. Ok, that solves the problem of compiling the sources. It is interesting that the same PoC would compile in one machine (RH6) and not compile (compile after the suggestions) in an ubuntu. The only thing which is different is the version of the g++ compiler which in RH6 is older. Are there other things to take into consideration? In addition, at the moment I am running an example which is working in RH6 but is not working on the newer Ubuntu (Simple low-pass filter).
  15. I will try that. Thank you. Question more for the @COSEDA folks. Any idea when we can download the new PoC?
×