Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won

  1. biplab77

    All SC_METHOD() not running parallely

    My Tx methods are like as follows :- void NoximRouter::txProcess_mode1() { if( buffer_snd.Size()!=0) //Going with just one buffer(may be corresponding to the router,... but actually forthe processing element) { NoximPacket packet = buffer_snd.Front(); NoximRouteData route_data; route_data.current_id = local_id; route_data.src_id = packet.src_id; route_data.dst_id = packet.dst_id; const vector < vector<int> > o = Route(route_data); //stats.power.Arbitration(o.size()); int src= packet.src_id; vector <int> path; int col =0; // checking in the global table the channels which are free and writhing to the res[ective channels path.push_back(src); packet.dir=checkdir(o); if(checkmode1(path,o,src,col,packet)==1) { buffer_snd.Pop(); // cout<<"Mode1\n"; packet.seq_no=path; packet.mode_tx=1; flit_tx.write(packet); mode1_traffic++; stats.pkthist.push_back(makePacketHist(packet)); for(int i=0;i<path.size();i++){ MappingTable[path[i]].channel_status_neighbor.available =0; } } } } //Checkmode function........................... int NoximRouter::checkmode1( vector <int> &path,const vector < vector<int> > &o, int src,int col, const NoximPacket &packet) { for(int i=0;i<o.size()-1;i++) { src = getNeighborId(src, o.at(i).at(col)); if(MappingTable[src].channel_status_neighbor.available ==0) path.push_back(src); else { if ((i != o.size()-2) && (col ==0)) { path.clear(); src=packet.src_id; path.push_back(src); i=-1; col=1; } else { if(col == 1) return 0; } }//else }//end of for loop /***************UPDATING MAP*****************/ path.push_back(packet.dst_id); //cout<<"Path details:"; for(int j=0;j<path.size();j++) { MappingTable[path[j]].channel_status_neighbor.available =1; } return 1; } Similar to above i have implemented all other tx methods... Lemme know if u guys need any more details.... Another Information :- When i rearrange the sequence of registering methods inside SC_CTOR , the tx process which starts getting executed changes...... At one time it is txProcess_mode1.... If i change the ordering then only txProcess_mode4 gets executed..... But in both cases rxProcess_local gets executed regardless as it gets stimuli from other signals... Another Interesting Observation :- If change the placement of rxProcess_local inside the constructor then the execution of txProcess_mode processes change. i.e if i do the following inside SC_CTOR SC_METHOD(txProcess_mode2); sensitive << reset; sensitive << clock.pos(); SC_METHOD(rxProcess_local); sensitive << reset; sensitive << clock.pos(); Only rxProcess_local and txProcess_mode2 gets executed... & if i do SC_METHOD(txProcess_mode3); sensitive << reset; sensitive << clock.pos(); SC_METHOD(rxProcess_local); sensitive << reset; sensitive << clock.pos(); Then only rxProcess_local and txProcess_mode3 gets executed
  2. Hi All, I am a novice in systemC. I am having some doubts in using SC_METHOD(). I am building a network simulator in systemC. And from each node there are about four channels. I want the four channels to work simultaneously. The four channels get data from a common buffer in receiver and then transmit. So i declared a SC_Module and declared 4 SC_METHOD processes in it corresponding to each channel. SC_MODULE(NoximRouter) { SC_CTOR(NoximRouter) { //Recieving process SC_METHOD(rxProcess_local); sensitive << reset; sensitive << clock.pos(); ////Transmission processes SC_METHOD(txProcess_mode4); sensitive << reset; sensitive << clock.pos(); SC_METHOD(txProcess_mode1); sensitive << reset; sensitive << clock.pos(); SC_METHOD(txProcess_mode2); sensitive << reset; sensitive << clock.pos(); SC_METHOD(txProcess_mode3); sensitive << reset; sensitive << clock.pos(); } }; But when i try printing sth inside all the methods... I can see for a given simulation time only the receiver method and one of the txprocess method is running....i want everythimng to run parallely... 'kindly help me out.
  3. I will be using SC_THREAD and will let you know.. Than you very much. You guys have been of much help
  4. @Sumit :- Thank you very much !!! Well i had another question. Whats the way to suspend a method for some time?? Like equivalent to sleep(). i mean i want to suspend the execution of that specific module(or if process) for some time. And then start executing from there after itself. I cant use sleep as it will take system time into account rather than the simulation time. Next_trigger() starts executing the whole process again. and wait() is used in threads... So i am in a fix. Sorry for asking such basic questions... In a learning phase..
  5. biplab77

    end_of_simulation is not triggered

    @apfitch and @ david, i understood the concept of end of simulation... But i had the query that is there a way to stop the simulation at any point under some conditions?? Can i use sc_stop() any where in the code or it is mandatory to use it in main(). WellThe LRM (section 4.4.4) specifies that end_of_simulation() will be called either after sc_stop(), or if sc_main is not used. Can i use sc_stop at any part of my program??
  6. Hi All, I have built a simulator which uses system C library. Its a network simulator and i am planning to run some traces. Well earlier when i was running my own generated traffic i was specifying the simulation time in cycles and used to achieve results. Now when i am running traces, i am not sure how much time will be enough. i want to ask that is there any way to stop the simulation at any part of the code apart from main(). If yes then how?? I will like to stop the simulation as soon as i am finished processing the last line of my trace file OR i don't receive any more packets in the receiving module designed in my network simulator in a certain time. Well to be honest i am a novice in system C. I took an introductory class and started building this as it ensured parallel processing. Thank You Regards Biplab