Jump to content

All Activity

This stream auto-updates     

  1. Today
  2. You can access elements using array index operator like this: in2[0][1]=42.0; But you write you want to put values onto the array. You cannot write onto ports as these are only proxys and do not hold values. You need to create a similar sc_signal array and connect it to the ports. sc_signals hold values so you can put values on them using write(). A side node: you should declare your vectors as: sc_vector<sc_vector<sc_in<float>>> in2{"in2", 4, [](char const* name, size_t idx) -> sc_vector<sc_in<float>>*{ return new sc_vector<sc_in<float>>(name, 4); }}; This names your ports (very helpful when tracing values) and you don't need to call init() separately.
  3. Yesterday
  4. hello, i'm new to systemc i want to have a code that initialize 2 2D arrays and perform convolution, what i've done in the header file is sc_vector < sc_vector <sc_in < float >>> in2 sc_vector < sc_vector <sc_in < float >>> w2 in2.init(4); in2[0].init(4) ; in2[1].init(4) ; in2[2].init(4) ; in2[3].init(4) ; w2.init(2); w2[0].init(2); w2[1].init(2) ; my problem is that i want to put values for in2 and w2 2D arrays to test my mehod however i don't know the syntax for this in main.cpp file i get compile errors . Thanks in advance
  5. From the code itself, it's not obvious to me, where the unexpected overload of sc_core::wait(int) is called. Can you try attaching a debugger and break on the exception (catch throw in gdb) and check from the backtrace, where from the exception is thrown?
  6. Last week
  7. Ok find the issue. I needed to compile all the .cpp dependencies as well with g++ -I/usr/local/systemc-2.3.3/include -L/usr/local/systemc-2.3.3/lib-linux64/ -lsystemc -lm -o out counter.cpp shifter.cpp testbench.cpp main.cpp
  8. So, I'm trying to compile my main.cpp that includes three modules. For instance I got a module counter with this .h file #include <systemc.h> SC_MODULE(counter) { sc_in<bool> clk; //porta ingresso clock sc_in<bool> load; //porta ingresso load sc_in<bool> clear; //porta ingresso clear sc_in<sc_uint<8> > din; //porta ingresso dato (intero 8 bit) sc_out<sc_uint<8> > dout; //porta uscita dato (intero 8 bit) unsigned int countval; //valore del contatore (intero senza segno) void counting(); //funzione conteggio (il mio processo) SC_CTOR(counter) { //costruttore di counting() SC_METHOD(counting); //costruttore del mio processo attraverso metodo (meglio del thread) sensitive << clk.pos(); //sensibile al fronte del clock, positivo } }; now, when I run the compiler with g++ -I/usr/local/systemc-2.3.3/include -L/usr/local/systemc-2.3.3/lib-linux64/ -lsystemc -lm -o out main.cpp but I got this error /tmp/ccz92lN5.o: In function `counter::counter(sc_core::sc_module_name)': main.cpp:(.text._ZN7counterC2EN7sc_core14sc_module_nameE[_ZN7counterC5EN7sc_core14sc_module_nameE]+0xba): undefined reference to `counter::counting()' How do I fix it?
  9. what you saw in first post is called pure virtual class. It's inherited by derived class where sensitivity list is supplied.
  10. I'm forced to use whatever systemC version that comes with latest VCS version(vcs_vP-2019.06-SP2). Here is healer file: #include "systemc.h" #include "tkn.h" #include "cmod_utils.h" #include <cmod_module.h> // from Dierke model #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <math.h> //#include "global.h" //#include "ISP_Utils.h" #include "ltm.h" #include "ltm.HW_MOD_BA.h" #define CTRL LTM_Ctrl<sc_uint<14>, sc_uint<13>, sc_uint<20>, sc_uint<20> > #define TKN MDA3_tkn<sc_int<2>,unsigned int > class ltm_func: public cmod_module<TKN, unsigned int > { public: sc_fifo_in< CTRL> params_in_fifo; CTRL params; hdr_param hdr; unsigned int pxl_out; virtual bool hasBufferSpace(); virtual bool canSendTkn(); virtual void processRcvdTkn(TKN& tkn); virtual void processTknToSend(unsigned int& tkn); virtual void processParams(); SC_CTOR(ltm_func) { numTknsRcvd=0; numTknsSent=0; SC_THREAD(ingress); dont_initialize(); sensitive << tkn_in_fifo.data_written(); SC_THREAD(egress); sensitive << tkn_in_fifo.data_written() << tkn_out_fifo.data_read(); dont_initialize(); //SC_THREAD(params); //sensitive << params_in_fifo.data_written(); } }; ltm_func.cpp #include "ltm_func.h" bool ltm_func::hasBufferSpace() { return true; } bool ltm_func::canSendTkn() { return this->numTknsRcvd > this->numTknsSent; } void ltm_func::processRcvdTkn(TKN& tkn) { unsigned int Y1; ltm_debug debug; cout << "result before is::: " << pxl_out << endl; LTM_HW_func_BA(tkn.data, &hdr, &Y1, &pxl_out, &debug); cout << "result after is::: " << pxl_out << endl; } void ltm_func::processTknToSend(unsigned int& tkn) { tkn = pxl_out; } void ltm_func::processParams() { while(true){ while (! canSendTkn()) { wait(params_in_fifo.data_written_event()); } params_in_fifo.read(params); wait(); } }
  11. I suggest to move to SystemC 2.3.3, if possible. (The error message indicates, that you seem to be using SystemC 2.3.1). Secondly, can you show the derived class of the fifo as well (including its constructor)?
  12. So you say that rather than stalling in SystemC, I need to wait for a SystemC event generated by the GUI? then the SystemC thread can emit a signal, and the two guys can ping-pong with the signals? It sounds good, thank you. That is, as @David Blacksuggested, I shall use the async_request_update() method from the thread, running SystemC? Is some sample around? in the book and the examples I do not find a call like this.
  13. My case is less complex. I am aware of that this process is not that process, and this scheduler is not that scheduler. My intention is exactly just to stall SystemC at some point of execution, and just to read some variables for displaying it in the GUI. I am interested in sc_time only from the aspect to display it in the GUI. I do not want any other communication, than emitting a message that SystemC stalled, then -- after finishing the GUI update -- to resume it. A kind of breakpoint. In the same way as used in a debugger. To resume, I can ask the thread to send a message. I wonder if I can stall SystemC safely, without interfering with anything. Maybe SC_ZERO_TIME solves the problem; however the simulation itself also uses SC_ZERO_TIME in some cases; so they may interfere; I need to check. I do not want to use non-zero time as it falsifies the simulation time, which is also important.
  14. When implementing some simulation control I usually have the logic as part of a SC_THREAD. Once the thread is active it is save to access all the other data structures as -like @David Black mentioned- SystemC is cooperative multi tasking. Based on the GUI thread you can then decide to run for a certain time, until a certain event, or stop simulation entirely using sc_stop()
  15. The syntax wait(), which calls void sc_core::wait(void), assumes a static sensitivity list, but you have not setup a static sensitivity list that I can see. Also, you are sending and immediate notification, which I somehow doubt you really grasp the implication thereof. You need to learn about the fundamentals of the SystemC scheduler to get this working correctly.
  16. Keep in mind that SystemC's kernel is not threadsafe. SC_THREAD and SC_METHOD processes are completely different animals than OS threads as well. You can use the async_request_update() method to interface into SystemC from the outside. From the inside you can of course stall everything in the SystemC side because it is cooperative multitasking system. In either case, you will need to use appropriately setup mutex to protect shared resources. Due to differences in the concept of time (simulated vs real), you will also likely need to use mailboxes for communication. You might also what to consider scheduling events to happen at the end of a delta cycle (ie. event.notify(SC_ZERO_TIME) or perhaps even a non-zero time in the future.
  17. As I mentioned in a previous post, I want to display the state of the simulated object in a GUI thread, while the simulation thread is suspended. Can I do that in an elegant way? I mean, that if I am after receiving my event, the event queue is empty, so the simulation stops immediately. If I suspend it before triggering the event, then the event queue is empty again; so my waiting terminates again. If I trigger the event first, then I stop at a wait(resume-event), the simulation goes to serve the event first, I wanted to stop at; and comes back to my wait(resume-event), and since the event queue is empty, stops again. I guess I need to forcefully prevent taking out the event before the GUI thread returned a resume_event. How can I do that?
  18. I'm new to systemC. My code needs to process some data after reading it from fifo. So I created sc_event tkn_in_fifo_data_written. However compiler produces this error message: Can someone please tell me what's wrong? Also perhaps error message should say something else? template <class T, class M> class cmod_module: public sc_module { public: sc_fifo_in< T > tkn_in_fifo; sc_fifo_out< M > tkn_out_fifo; sc_event tkn_in_fifo_data_written; int numTknsRcvd; int numTknsSent; BAYER_TYPE *bayer_444; //virtual void ingress(); //get tkn in void ingress() { T tkn; while(true) { while(! hasBufferSpace() ) { // do something } tkn_in_fifo.read(tkn); processRcvdTkn(tkn); numTknsRcvd++; cout << name() << " " << numTknsRcvd << " tkns receivedd!" << endl; tkn_in_fifo_data_written.notify(); wait(); } } void egress() { M tkn; cout << name() << " " << numTknsSent << " tkns sent!" << endl; while(true){ while (! canSendTkn()) { cout << "waiting!" <<endl; //wait(tkn_in_fifo.data_written_event()); wait(tkn_in_fifo_data_written); } processTknToSend(tkn); tkn_out_fifo.write(tkn); numTknsSent++; cout << name() << " " << numTknsSent << " tkns sent!" << endl; wait(); } } virtual bool hasBufferSpace() = 0; virtual bool canSendTkn() = 0; virtual void processRcvdTkn(T& tkn) = 0; virtual void processTknToSend(M& tkn) = 0; };
  19. Hello @dave0, As suggested by @maehne use the public git repository available here: https://github.com/accellera-official/systemc Prerequisites: Working Microsoft Studio Environment Windows CMake Binary release: https://cmake.org/download/ Ensure CMake executable is available in the command line.(cmd.exe) Git Windows installation from: https://git-scm.com/ Ensure Git command is accessible from command line(cmd.exe) Here are the highlight of the steps involved: git clone https://github.com/accellera-official/systemc cd systemc mkdir buildDebug cd buildDebug CMake Configuration cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_EXTENSIONS=OFF -DCMAKE_INSTALL_PREFIX="C:\Users\<YOUR_USER_ID>\Desktop\systemc-install" .. Building SystemC Library: cmake --build . --config Debug Running Sanity tests to validate the built library is functional(optional) cmake --build . --config Debug --target examples/check This should run all the examples available with SystemC release and all of them should pass without any failures. SystemC library installation: cmake --build . --config Debug --target install Hope this helps. Let us know in case you face any issues setting it up. Note: Also, refer here for SystemC 2.3.4 public review tagged release, only use the master branch version which seems to have fixes for MSVC2017/2019. Regards, Ameya Vikram Singh
  20. Your problem is the use of POD (plain old datatype) for communication between the processes. Why? As soon as you write onto it all other processes see the update. So the behavior of your design depends on the scheduling of the processes. If Design::process is scheduled before Design::second_stage_process the second_stage_process sees the updates of process. Actually there are 2 ways out: you just have one thread and call the function from the output to the input: void Design::process() { txProcess(); intermediateProcess(); rxProcess(); } Although it will work in your case this approach will not scale. As soon as you cross sc_module boundaries you cannot control the order of calling. you use a primitive channel instead of POD. In your case you might use a sc_core::sc_fifo with a depth of one. And you should use sc_vector instead of the POD array type since they need the proper initialization. Why does it help? New values being written will be visible at the output of the fifo in the next delta cycle. So no matter in which order the threads and methods are invoked they will read the 'old' values despite 'new' values have been written. HTH
  21. Could you please be more specific and post the error messages, you are receiving when building SystemC 2.3.3 with VS 2019? Also, have you tried it with the most recent development state from the public SystemC Git repository of Accellera?
  22. I have a design.h and design.cpp as given below. I am trying to have two stages in the design. I notice that the latency is same when I had only once stage. I don't understand why the number of clock cycles required by data to pass the design can remain same if I have two stages instead of one. I think that the two stages are not correctly done. //Design.h file #include <systemc.h> #include "Buffer.h" using namespace std; SC_MODULE(Design) { sc_in_clk clock; sc_in <bool> reset; sc_in <Flit> flit_rx[DIRECTIONS + 2]; sc_out <Flit> flit_tx[DIRECTIONS + 2]; BufferBank buffer[DIRECTIONS + 2]; BufferBank intermediate_buffer[DIRECTIONS + 2]; void process(); void rxProcess(); void second_stage_process(); void intermediateProcess(); void txProcess(); SC_CTOR(Design) { SC_METHOD(process); sensitive << reset; sensitive << clock.pos(); SC_METHOD(second_stage_process); sensitive << reset; sensitive << clock.pos(); } }; The design.cpp is as follows. #include "Design.h" void Design::process() { rxProcess(); } void Design::second_stage_process() { txProcess(); intermediateProcess(); } void Design::rxProcess() { if (!reset.read()) { for (int i = 0; i < DIRECTIONS + 2; i++) { Flit received_flit = flit_rx[i].read(); int vc = received_flit.vc_id; if (!buffer[i][vc].IsFull()) { // Store the incoming flit in the circular buffer buffer[i][vc].Push(received_flit); } } } } void Design::intermediateProcess() { if (!reset.read()) { for (int i = 0; i < DIRECTIONS + 2; i++) { for (int vc = 0;vc < GlobalParams::n_virtual_channels; vc++) { if ((!buffer[i][vc].IsEmpty()) && (!intermediate_buffer[i][vc].IsFull())) { // Store the incoming flit in the circular buffer intermediate_buffer[i][vc].Push(buffer[i][vc].Front()); buffer[i][vc].Pop(); } } } } } void Design::txProcess() { if (!reset.read()) { for (int j = 0; j < DIRECTIONS + 2; j++) { int i = (start_from_port + j) % (DIRECTIONS + 2); for (int k = 0;k < GlobalParams::n_virtual_channels; k++) { int vc = (start_from_vc[i]+k)%(GlobalParams::n_virtual_channels); if (!intermediate_buffer[i][vc].IsEmpty()) { Flit flit = intermediate_buffer[i][vc].Front(); //some operations with flit } } } for (int i = 0; i < DIRECTIONS + 2; i++) { if (!intermediate_buffer[i][vc].IsEmpty()) { Flit flit = intermediate_buffer[i][vc].Front(); //some operations to get the value of o flit_tx[o].write(flit); intermediate_buffer[i][vc].Pop(); } } } } Please tell me what I am doing wrong. I want to create a second stage and that is why I am saving data from buffer to intermediate_buffer and use that buffer in txProcess. But this is not increasing the latency of the data propagation (from input receiver to output transmitter) which means the second stage is actually not getting created.
  23. The UVM field macros do not handle OOP very well, and is one of the many reason we do not recommend using them. It would be much simpler and more efficient to use the streaming operator exactly as you wrote it in a do_pack method.
  24. Esp. as educational project you should implement it in 2 threads which communicate with each other. Since they run in the same process space you can access data safely once the simulation is in paused state. But you cannot restart the simulation without restarting the process it self. SystemC uses static global variables storing the simulation state and those get only initialized at program start.
  25. Has anyone gotten SystemC 2.3.3 to work on Visual Studio 2019? If so, could you please post the steps that you followed? The problem I am hitting is that SystemC ships with a version of Boost that is so old that it is not verified on VS 2019 and throws a compile-time error. Is there any chance that the maintainers of SystemC might do a new release that updates that Boost and VS versions? That would sure be nice.
  26. I have an educational-purpose GUI that displays the results of the simulation. The simulation is started in the run() method of a Qt5 thread. 1./ At some checkpoints the simulation suspends itself (receives an event, but does not execute it until the GUI sends a resume message), and the GUI can display whatever it wants. I wonder if I need to make any special trick because the GUI and the simulation are in different threads? (As I understood, the engine is just waiting, hopefully nothing happens that would interfere with the threading. I would prefer reading some values directly, just to display them, and avoid sending messages, if not absolutely needed.) 2./ As it is a kind of debugger, it may happen that the user terminates the simulation in a way that the simulation is still waiting for a resume message, but instead a new 'start' message arrives. What is the preferred way of quietly killing the engine? Is it OK, if I terminate and re-start the Qt thread?
  27. I am trying to assemble a package from my app. I builds and executes fine. All other 'make XX' commands work OK, except that when I attempt 'make package', it throws the error message CPackDeb: - Generating dependency list CMake Error at /usr/share/cmake-3.10/Modules/CPackDeb.cmake:709 (message): CPackDeb: dpkg-shlibdeps: 'dpkg-shlibdeps: error: cannot find library libsystemc.so.2.3 needed by I do have libsystemc.so.2.3.3 in my /opt/systemc/lib, and have a libsystemc.so.2.3 to it. The message comes from if(NOT SHLIBDEPS_RESULT EQUAL 0) message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: '${SHLIBDEPS_ERROR}';\n" Given that during building and running everything works OK (i.e. the library found, I guess that it is in the right place), I have no idea whether it is my dust, or CMake/SystemC? Maybe CPackDeb is looking for it on some other place?
  28. @sas73 and @tymonx - Feel free to contact Accellera itself and try to argue your case, but the Accellera is a membership based standards organization and not subject to the whims of the general public. Large electronics and EDA companies depend on their experts who are assigned to work on those standards, and many significant tools and designs are based on their work. If your employer feels strongly about this topic, perhaps they will consider joining the Accellera organization in order to contribute to the discussions. Standards discussions are often long and drawn out with many inputs. Membership at the contributor level is not free because they want serious contributors and because the organization has funding needs to promote the standards.
  1. Load more activity
×
×
  • Create New...