Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by sosarkar

  1. Hi, I have been trying to dynamically load the systemc shared object "systemc.so", but so far without success. Intention is to virtually simulate the systemc kernel within another application. The systemc simulation of the Top module works fine on this own, with the OSCI or questa simulator. I checked the dependencies using ldd, and I see (the following...). Correct me if I am missing some dependencies? Can someone provide an example in this regard. I tried the example at (http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html) and was successful. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ldd ../lib_work/_sc/linux_x86_64_gcc-4.3.3/systemc.so linux-vdso.so.1 => (0x00007fff7ebf1000) libstdc++.so.6 => /edatools/mentor/questasim/10.0c/questasim/gcc-4.3.3-linux_x86_64/lib64/libstdc++.so.6 (0x00002affcfcd3000) libm.so.6 => /lib64/libm.so.6 (0x00002affcffea000) libgcc_s.so.1 => /edatools/mentor/questasim/10.0c/questasim/gcc-4.3.3-linux_x86_64/lib64/libgcc_s.so.1 (0x00002affd026d000) libc.so.6 => /lib64/libc.so.6 (0x00002affd0484000) /lib64/ld-linux-x86-64.so.2 (0x0000003f5a000000) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- As a test case, I wrote up the following code to see the dynamic loading. #include <stdio.h> #include <stdlib.h> #include <dlfcn.h> #include <systemc> //#include "libtesttop.h" #include "top.h" int main(int argc, char **argv) { void* lib_handle; char* error; lib_handle = dlopen("../scripts/lib_work/_sc/linux_x86_64_gcc-4.3.3/systemc.so", RTLD_LAZY); if (!lib_handle) { fprintf(stderr, "%s\n", dlerror()); exit(1); } //create_t* create_abc = (create_t*) dlsym(lib_handle, "create"); //destroy_t* destroy_abc = (destroy_t*) dlsym(lib_handle, "destroy"); Top* (*create)(); void (*destroy)(Top*); create = (Top* (*)())dlsym(lib_handle, "create_object"); destroy = (void (*)(Top*))dlsym(lib_handle, "destroy_object"); Top* myCosim = (Top*)create(); myCosim->DoSomething(); destroy( myCosim ); return 0; }
  2. Hello, I am somewhat new to SystemC and I am interested in converting ASCII string to sc_bv and vice versa. I tried static casting the string without success. I am trying with stringstream; first convert the string to a stream and then stream into sc_bv. Any comments and suggestions are welcome. Thanks for your kind attention. ~S
  3. sosarkar

    ASCII string to sc_bv and vice versa

    Thanks Ralph.