Search the Community
Showing results for tags 'sc_thread'.
-
Hello, I would like to create an arbitrary (random) number of processes, of the same module. So I tried with sc_vector. I can instantiate sc_module but not when there is a SC_THREAD in the module. I have the following code in my header "nodes.h" struct CNodes : sc_core::sc_module { CNodes(sc_core::sc_module_name instance); ~CNodes(void) = default; void CNodes::Init_node(int, float, float); SC_HAS_PROCESS(CNodes); private: int id = 0; // Processes and overrides void Thread_node(void); }; And the cpp files is : #include "Nodes.h" CNodes::CN
-
Hi How can I count the number of SC_THREAD/SC_METHOD in a given simulation of a SystemC platform ? Is it possible ? Thanks Khushi
-
Hello, I'm writing a module in SystemC which basically works as follows: it receives a string of bytes through a port p_in and a control signal through the port h. The module must save the bytes within a matrix matrix just if the h signal is true. Within the SC_THREAD I'm using I implemented this: void MY_MODULE::my_method(){ if(!rst){ //put all the output ports to 0 } while(1){ //The module waits while the signal h is false while(!h) wait(); //The iterations to fill in the matrix begin //The iterations must work just if h = true for(i=0; i<100
-
Good Day All, I am a complete noob in SystemC. I am however, working on a simulator which utilizes a few concepts from SystemC. Kernel is picking up on either the Sc_Method or the Sc_Thread. I am aware of the wait command. It can only be used in the sc_thread. But in my code, (excerpt) I am currently using SC_thread and sc_method simultaneously. I wanted to introduce a delay in simulation time in the sc_thread (using the wait command). Is there a way to forward the simulation time in SC_METHOD that is analogous to wait() in SC_Thread. I did change one of the functions to SC_Thread, and
- 3 replies
-
- delaysystemc
- SC_METHOD
- (and 4 more)
-
Hello, I am having an SC_THREAD as follows // // SC_THREAD(my_proc); sensitive << event_1; dont_initialize(); // // // void my_proc() { while(1) { wait(10,SC_NS); cout << " Display ok"; wait(event_1); } } My question is i am having an situation where this event get triggered repetedly in short instance of time, lets say at time t=2 ns it get triggered then SC_THREAD starts, then again it get triggered at t=4ns, but this triggerring of event goes unnoticed. I saw some post and from them i got to know that i cant even use sc_event
- 2 replies
-
- systemc
- sc_event_queue
-
(and 2 more)
Tagged with:
-
Hi all If I have something like follows: SC_MODULE(Test) { ... int t1; // Want this variable to be shared void tesst() { t1 = t1 +2; } SC_CTOR(Test) { SC_THREAD(tesst) } And then I create two instances of Test as Test *t1 = new ....; Test *t2 = new ... Then , how can make the varible "t1"shared by both the instances/ threads? In other words, I want this variable to be updated by both the threads. Thanks
-
Hi Guys, It is my first day to read SystemC tutorial, forgive me if the questions are silly. I debugged following code in Visual Studio 2008 (64 bit) by setting break point at the start of do_test1 and do_test2, to my suprise, the code is running in the same thread of the sc_main function. I didn't debug in Linux environment. However, by searching the source code, I found the "pthread.h" was included by some SystemC library source code. Question 1: In Windows, will the SC_THREAD create a real thread? Or it is always in the same thread of sc_main? If this is the case, m
-
Hi All, I have a case using "diamond inheritance" sc_module as below figure base / \ A B \ / top base=> struct to share A and B A => a systemc module (virtual public sc_module) B => a systemc module (virtual public sc_module) top=> a systemc module (virtual public A, virtual public B ) it work fine. But when I using SC_THREAD. the compiler shows error, "pointer to member conversion via virtual base". is it possible to fix the error? Thanks
-
Hi, everyone, I am a starter of SystemC. I wrote a simple example with using SC_THREAD following the example in systemc source. I have two classes which boot two threads, bootMAC and respondDrv. However, when I simulate this program, I observed that only bootMAC is running, respondDrv did not print anything. Are there anything I still need to add? Thanks so much for you guys' help. The code is follows. class SYSCMAC : public sc_core::sc_module { public: SC_HAS_PROCESS(SYSCMAC); SYSCMAC(sc_module_name name) : sc_core::sc_module(name) { SC_THREAD(bootMAC); } void bootMAC()
-
Hi everyone, I'm met some problem. In box below you can see my code. struct Some_stuct { int data; float data_f; }; class payload_t { public: unsigned char *data; unsigned lenght; inline friend ostream& operator << ( ostream& os, payload_t const & v ) { os << "(" << v.data << "," << std::boolalpha << "," << v.lenght << ")"; return os; } }; SC_MODULE(tx) { sc_port<sc_fifo_out_if<payload_t> > out_port; void process() { Some_stuct data; payload_t out_data; while(true) { data.data = 5;
-
Hello everyone, I have successfuly compiled SystemC-2.3.0 under VS2012. Compilation: For a system description and compilation, I had to enable static linking the following way, aside from configuring the include and library directories and the library name. Properties->configuration properties->C/C++->Code Generation Runtime Library set to Multi-threaded Debug (\MTd) After that, I was able to compile the simulation project. Execution: During execution, Windows throws an exception for the DCAST of line 359 on sc_thread_process.cpp. This is executed by the call to SC_THREAD(run)