qursan Posted August 12, 2013 Report Share Posted August 12, 2013 I have a design where a producer and a consumer are connected together through a simple packet interface. The consumer thread is just executed once. I did not understand what is wrong with it. Here is the code. The second module is executed once at the beginning of the simulation and is not executed after. :::::::::::::::::: : cmMac.h : :::::::::::::::::: #ifndef CM_MAC#define CM_MACSC_MODULE(cmMac) { sc_in_clk Clk; sc_in<bool> Rst; sc_out<long> txDout; sc_out<bool> txDv; sc_out<bool> txSof; sc_out<bool> txEof; sc_out<char> txMod; sc_out<bool> txErr; SC_CTOR(cmMac) { SC_CTHREAD(cmMacSend, Clk.pos()); //reset_signal_is(Rst, false); cmMacInit(); } ifstream inFile; void cmMacInit(); void cmMacSend(); }; #endif :::::::::::::::::::::::::: : cmDutmodel.h: :::::::::::::::::::::::::: #ifndef CM_DUTMOD#define CM_DUTMOD//#include "cm_mem.h"SC_MODULE(cmDutmodel) { sc_in<bool> Reset; sc_in_clk Clk; sc_in<long> txDin; sc_in<bool> txDv; sc_in<bool> txSof; sc_in<bool> txEof; sc_in<char> txMod; sc_in<bool> txErr;// cmMem<sc_uint<70>,1024> Fifo1; bool inPkt; sc_uint<32> wrPtr; sc_uint<32> rdPtr; sc_uint<1> wEn; sc_uint<32> pktSize; SC_CTOR(cmDutmodel) { SC_CTHREAD(cmDutmodelRx, Clk.pos()); inPkt = false; wrPtr = 0; rdPtr = 0; //Fifo1.memAddrA(wrPtr); //Fifo1.memDinA(txSof,txEof,txErr,txMod,txDin); //Fifo1.memWenbA(wEn); } void cmDutmodelRx();};#endif Quote Link to comment Share on other sites More sharing options...
apfitch Posted August 12, 2013 Report Share Posted August 12, 2013 You don't have any bodies for the functions cmDutmodelRx(), cmMacSend() and cmMacInit(), which will result in a linker error. If by chance you've just forgotten to post the code of those functions, that's a pity because that's probably where the bug lies - you need infinite loops in the SC_CTHREAD function bodies, and you probably don't have them. regards Alan karandeep963 1 Quote Link to comment Share on other sites More sharing options...
qursan Posted August 13, 2013 Author Report Share Posted August 13, 2013 Thanks for the point. I actually did not post the code as I thought the issue was in the header files. However, I tried yesterday to include an infinite loop with a wait statement and everything worked. I did not know you would need an infinite loop in a CTHREAD. It should be clarified. The specs say that the method is executed everytime the clock rising edge occurs. Quote Link to comment Share on other sites More sharing options...
apfitch Posted August 13, 2013 Report Share Posted August 13, 2013 In the Language Reference Manual, IEEE 1666-2011 5.2.11 it definitely makes it clear that an SC_THREAD or SC_CTHREAD is only called once. Where did you see the statement "The specs say that the method is executed everytime the clock rising edge occurs."? kind regards Alan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.