• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ sc_time_stamp函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中sc_time_stamp函数的典型用法代码示例。如果您正苦于以下问题:C++ sc_time_stamp函数的具体用法?C++ sc_time_stamp怎么用?C++ sc_time_stamp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sc_time_stamp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: id2Coord

NoximPacket NoximProcessingElement::trafficTranspose2()
{
    NoximPacket p;
    p.src_id = local_id;
    NoximCoord src, dst;
    
    // Transpose 2 destination distribution
    src   = id2Coord(p.src_id);
    dst.x = src.y;
    dst.y = src.x;
    dst.z = src.z;
    fixRanges(src, dst);
    p.dst_id = coord2Id(dst);
    
    p.timestamp = sc_time_stamp().to_double() / 1000;
    p.size = p.flit_left = getRandomSize();
    
//    if (p.src_id == p.dst_id)
//        cout << "Traffic generator has generated a packet is sent from a node to itself !!! \n";

    return p;
}
开发者ID:bniazmand,项目名称:Noxim_Elevator_first,代码行数:22,代码来源:NoximProcessingElement.cpp


示例2: log2ceil

Packet ProcessingElement::trafficButterfly()
{

    int nbits =
        (int)
        log2ceil((double)
                 (GlobalParams::mesh_dim_x *
                  GlobalParams::mesh_dim_y));
    int dnode = 0;
    for (int i = 1; i < nbits - 1; i++)
        setBit(dnode, i, getBit(local_id, i));
    setBit(dnode, 0, getBit(local_id, nbits - 1));
    setBit(dnode, nbits - 1, getBit(local_id, 0));

    Packet p;
    p.src_id = local_id;
    p.dst_id = dnode;

    p.timestamp = sc_time_stamp().to_double() / GlobalParams::clock_period_ps;
    p.size = p.flit_left = getRandomSize();

    return p;
}
开发者ID:victorisildur,项目名称:noxim,代码行数:23,代码来源:ProcessingElement.cpp


示例3: while

void simple_bus_master_direct::main_action()
{
 

  int mydata[4];
  while (true)
    {


      bus_port->direct_read(&mydata[0], m_address);
      bus_port->direct_read(&mydata[1], m_address+4);
      bus_port->direct_read(&mydata[2], m_address+8);
      bus_port->direct_read(&mydata[3], m_address+12);

      if (m_verbose)
      	sb_fprintf(stdout, "%g %s : mem[%x:%x] = (%x, %x, %x, %x)\n",
		      sc_time_stamp().to_double(), name(), m_address, 
		      m_address+15, 
		      mydata[0], mydata[1], mydata[2], mydata[3]);

      wait(m_timeout, SC_NS);
    }
}
开发者ID:davito0203,项目名称:Undecimo_Semestre,代码行数:23,代码来源:simple_bus_master_direct.cpp


示例4: for

NoximPacket NoximProcessingElement::trafficShuffle()
{
    int nbits = (int)log2ceil(
                              (double)(NoximGlobalParams::mesh_dim_x *
                                       NoximGlobalParams::mesh_dim_y *
                                       NoximGlobalParams::mesh_dim_z  ));
    int dnode = 0;
    for   (int i = 0; i < nbits - 1; i++)
        setBit(dnode, i + 1, getBit(local_id, i        ));
    setBit(dnode, 0    , getBit(local_id, nbits - 1));
    
    NoximPacket p;
    p.src_id = local_id;
    p.dst_id = dnode   ;
    
    p.timestamp = sc_time_stamp().to_double() / 1000;
    p.size      = p.flit_left = getRandomSize();
    
//    if (p.src_id == p.dst_id)
//        cout << "Traffic generator has generated a packet is sent from a node to itself !!! \n";

    return p;
}
开发者ID:bniazmand,项目名称:Noxim_Elevator_first,代码行数:23,代码来源:NoximProcessingElement.cpp


示例5: while

void bios::entry()
{
 unsigned address;

 while (true) {
    	do { wait(); } while ( !(cs == true) ); 
    	address = addr.read();
	if (address < BOOT_LENGTH) {		// in BOOTING STAGE
    		if (we.read() == true) { // Write operation
      			wait(wait_cycles-1);
      			imemory[address] = datain.read();
    		}
    		else { // Read operation
      			if (wait_cycles > 2)
				wait(wait_cycles-2); // Introduce delay needed
        			dataout.write(imemory[address]);

				if (PRINT_BIOS) {
					printf("------------------------\n");
					printf("BIOS: fetching mem[%d]\n", address);
					printf("BIOS: (%0x)", imemory[address]);
 					cout.setf(ios::dec,ios::basefield);
   					cout << " at CSIM " << sc_time_stamp() << endl;
					printf("------------------------\n");
				}

				bios_valid.write(true);
      				wait();
				bios_valid.write(false);
				wait();
    		}    
	} else {
				bios_valid.write(false);
				wait();
	}
 }
} // end of entry function
开发者ID:Fzzb,项目名称:ExpandableNoxim,代码行数:37,代码来源:bios.cpp


示例6: nextFlit

void TProcessingElement::txProcess()
{
  if(reset.read())
  {
    req_tx.write(0);
    current_level_tx = 0;
    transmittedAtPreviousCycle = false;
  }
  else
  {
    TPacket packet;

    if (canShot(packet))
    {
      packet_queue.push(packet);
      transmittedAtPreviousCycle = true;
    }
    else
      transmittedAtPreviousCycle = false;


    if(ack_tx.read() == current_level_tx)
    {
      if(!packet_queue.empty())
      {
        TFlit flit = nextFlit();                  // Generate a new flit
        if(TGlobalParams::verbose_mode > VERBOSE_OFF)
        {
          cout << sc_time_stamp().to_double()/1000 << ": ProcessingElement[" << local_id << "] \033[22;31mSENDING\033[22;30m " << flit << endl;
        }
	flit_tx->write(flit);                     // Send the generated flit
	current_level_tx = 1-current_level_tx;    // Negate the old value for Alternating Bit Protocol (ABP)
	req_tx.write(current_level_tx);
      }
    }
  }
}
开发者ID:iasonas,项目名称:iasonas,代码行数:37,代码来源:TProcessingElement.cpp


示例7: dynamic_method

 void dynamic_method()
 {
     static int state = 0;
     switch ( state )
     {
       case 0:
         m_dynamic_method = sc_get_current_process_handle();
         next_trigger( m_clk.posedge_event() );
         cout << sc_time_stamp() << ":      dynamic method (" << __LINE__ 
              << "," << state << ") initialization call " << endl;
         break;
       case 1:
         next_trigger( m_clk.posedge_event() );
         cout << sc_time_stamp() << ":      dynamic method (" << __LINE__ 
              << "," << state << ") after wait on m_clk.posedge_event() " 
              << endl;
         break;
       case 2:
         next_trigger( m_clk.negedge_event() );
         cout << sc_time_stamp() << ":      dynamic method (" << __LINE__ 
              << "," << state << ") after wait on m_clk.posedge_event() " 
              << endl;
         break;
       case 3:
         next_trigger( m_event1 & m_event2 );
         cout << sc_time_stamp() << ":      dynamic method (" << __LINE__ 
              << "," << state << ") after wait on m_clk.negedge() " << endl;
         break;
       case 4:
         next_trigger( m_clk.posedge_event() );
         cout << sc_time_stamp() << ":      dynamic method (" << __LINE__ 
              << "," << state << ") after wait on m_event1 & m_event2 " 
              << endl;
         break;
       default:
         next_trigger( m_clk.posedge_event() );
         cout << sc_time_stamp() << ":      dynamic method (" << __LINE__ 
              << "," << state << ") after wait on m_clk.posedge_event() " 
              << endl;
         break;
     }
     state = state + 1;
     if ( state == 5 ) state = 1;
 }
开发者ID:ansonn,项目名称:esl_systemc,代码行数:44,代码来源:test01.cpp


示例8: t3_fun

void t3_fun() {

	char  in_var;

	fifo_buffer<char> *in1;
	
	if(fifo_buffer_char.find("fifo2")==fifo_buffer_char.end()) {
		cout << "T3: Error retrieving fifo2 reference" << endl;
		exit(-1);
	}
	
	in1 = fifo_buffer_char["fifo2"];

	while(true) {
		
		in1->read(in_var);
				
		cout << "T3: recv: " << in_var << " at time " << sc_time_stamp() << endl;
		
		CONSUME_T;
		
		yield();
	}
}
开发者ID:nandohca,项目名称:kista,代码行数:24,代码来源:t3_fun.cpp


示例9: sb_fprintf

simple_bus_request * simple_bus::get_next_request()
{
    // the slave is done with its action, m_current_request is
    // empty, so go over the bag of request-forms and compose
    // a set of likely requests. Pass it to the arbiter for the
    // final selection
    simple_bus_request_vec Q;
    for (int i = 0; i < m_requests.size(); ++i)
    {
        simple_bus_request *request = m_requests[i];
        if ((request->status == SIMPLE_BUS_REQUEST) ||
                (request->status == SIMPLE_BUS_WAIT))
        {
            if (m_verbose)
                sb_fprintf(stdout, "%g %s : request (%d) [%s]\n",
                           sc_time_stamp().to_double(), name(),
                           request->priority, simple_bus_status_str[request->status]);
            Q.push_back(request);
        }
    }
    if (Q.size() > 0)
        return arbiter_port->arbitrate(Q);
    return (simple_bus_request *)0;
}
开发者ID:joelbarca,项目名称:nirgam,代码行数:24,代码来源:simple_bus.cpp


示例10: while

NoximPacket NoximProcessingElement::trafficOneDest()
{
    NoximPacket p;
    p.src_id = local_id;
//    double rnd = rand() / (double) RAND_MAX;
//    double range_start = 0.0;

    // Destination Set to id=20
    do {
	p.dst_id = 20;

	// check for hotspot destination

//////// commented the hotspot mehanism

/*	for (uint i = 0; i < NoximGlobalParams::hotspots.size(); i++) {
	    //cout << sc_time_stamp().to_double()/1000 << " PE " << local_id << " Checking node " << NoximGlobalParams::hotspots[i].first << " with P = " << NoximGlobalParams::hotspots[i].second << endl;

	    if (rnd >= range_start
		&& rnd <
		range_start + NoximGlobalParams::hotspots[i].second) {
		if (local_id != NoximGlobalParams::hotspots[i].first) {
		    //cout << sc_time_stamp().to_double()/1000 << " PE " << local_id <<" That is ! " << endl;
		    p.dst_id = NoximGlobalParams::hotspots[i].first;
		}
		break;
	    } else
		range_start += NoximGlobalParams::hotspots[i].second;	// try next
	}  */
    } while (p.dst_id == p.src_id);

    p.timestamp = sc_time_stamp().to_double() / 1000;
    p.size = p.flit_left = getRandomSize();

    return p;   
}
开发者ID:vineeth001,项目名称:NoximMod,代码行数:36,代码来源:NoximProcessingElement.cpp


示例11: RecvMsg_schPush

void
CPersSch::PersSch()
{
    //sch_thr_idx_t wcid = (sch_thr_idx_t)RecvMsg_schPush().m_connId;
    // UDP must go through the same queue based on pConn index
    uint16_t nxtCid = RecvMsg_schPush().m_connId;
    sch_thr_idx_t wcid = cid2que(nxtCid);
    sch_que_idx_t wadr = S_queWrIdx[wcid];

	m_queDat.write_addr(wcid, wadr);

	if (!RecvMsgBusy_schPush()) {
		m_queDat.write_mem(RecvMsg_schPush());
        S_queWrIdx[wcid] += 1;
	}

	//
	// Stage 1
	//

	sch_que_idx_t radr = S_queRdIdx[PR1_htId];
	m_queDat.read_addr(PR1_htId, radr);

	T1_bEmpty = SR_queWrIdx[PR1_htId] == SR_queRdIdx[PR1_htId];

	//
	// Stage 2
	//

	if (PR2_htValid) {
		switch (PR2_htInst) {
		case SCH_SPIN: {
			if (SendCallBusy_ProcessPkt()
			    || SendMsgBusy_schPop()
			    || TR2_bEmpty) {
				HtRetry();
				break;
			}

			uint16_t cid = S_queDat.read_mem().m_connId;
            conn_addr_t cidAddr = cid2addr(cid);

#ifndef _HTV
            extern FILE *tfp;
            if (tfp)
                fprintf(tfp, "SCH: Calling Pkt cid=0x%04x blkIdx=%d @ %lld\n",
                        (int)cid, (int)S_queDat.read_mem().m_info.m_blkIndex,
                        (long long)sc_time_stamp().value() / 10000);
#endif
			SendCall_ProcessPkt(SCH_RETURN,
					S_queDat.read_mem().m_info,
                    cid, cidAddr);

			S_queRdIdx[PR2_htId] += 1;
			SendMsg_schPop(PR2_htId);
		}
		break;
		case SCH_RETURN: {
			HtContinue(SCH_SPIN);
		}
		break;
		default:
			if (SendReturnBusy_sch()) {
				HtRetry();
				break;
			}
			SendReturn_sch();
			assert(0);
		}
	}

        if (GR_htReset) {
		for (int i=0; i<16; i++) {
			S_queWrIdx[i] = 0;
			S_queRdIdx[i] = 0;
		}
	}
}
开发者ID:CarlEbeling,项目名称:OpenHT,代码行数:78,代码来源:PersSch_src.cpp


示例12: uvm_ml_run_test

 void uvm_ml_run_test(const std::vector<std::string>& tops, const char * test) {
     uvm_ml_run_test(tops, test, sc_time(~sc_dt::UINT64_ZERO, false) - sc_time_stamp());
 }
开发者ID:csikydody,项目名称:combinator-uvm,代码行数:3,代码来源:uvm_ml_adapter_imp_spec.cpp


示例13: sc_time_stamp

const sc_time&
sc_clock::time_stamp()
{
    return sc_time_stamp();
}
开发者ID:HenriqueChamorra,项目名称:systemc-2.2.0,代码行数:5,代码来源:sc_clock.cpp


示例14: sc_main

int sc_main (int argc, char *argv[]) {
  sc_signal<bool> clk, reset, clear;

  wait();
  wait (clk.posedge_event());
  wait (reset.negedge_event());

  // negedge_event() and posedge_event() methods can
  // be applied to a signal or a port to identify the
  // specific event.
  wait (clk.posedge_event() | reset.negedge_event() | clear.value_changed_event());

  // A value_changed_event() method is true when any
  // value change occu
  sc_signal<sc_uint<4> > ready;
  sc_signal<bool> data;

  wait (clk.value_changed_event() & data.posedge_event() & ready.value_changed_event());

  // The events can span over multiple simulation 
  // cycles. For example, if clk changes at 5ns, 
  // a positive edge on data occurs at 8ns and ready
  // changes at 10ns, then the wait is triggered at
  // time 10ns.

  wait (20, SC_NS); 

  // does NOT work with sc_bit or sc_logic:
  sc_signal<bool> speed_ctrl;

  wait (10, SC_NS, speed_ctrl.posedge_event());

  // Waits for positive edge to occur on speed_ctrl
  // for 10ns and then times out.
  wait (SC_ZERO_TIME);
  wait (0, SC_NS);

  sc_signal<sc_logic> sac;
  // sc_in<sc_logic> sync_reset;
  sc_signal<sc_logic> sync_reset;

  wait (sac.posedge_event());
  wait (sync_reset.negedge_event());

  sc_event write_back;

  // sensitive << write_back;
  wait (write_back);

  write_back.notify();
  write_back.notify (20, SC_NS);
  write_back.notify(SC_ZERO_TIME);

  // Trigger event in next delta cycle.
  write_back.cancel(); // Cancels a delayed notification.

  sc_out<bool> out_port;

  out_port.initialize(0);

  sc_time t_res;

  t_res = sc_get_time_resolution();
  cout << "The time resolution is " << sc_get_time_resolution() << endl;

  double time_in_dbl;
  sc_time time_res = sc_get_time_resolution();
  sc_time curr_time = sc_time_stamp();

  time_in_dbl = curr_time / time_res;
  cout << "Time as a double value is " << time_in_dbl << endl;

  time_in_dbl = sc_simulation_time();
  cout << "Time is " << time_in_dbl;

  sc_set_default_time_unit (100, SC_PS);
  sc_time t_unit (10, SC_NS);

  // NOT WORKING:
  // sc_set_default_time_unit (t_unit);
  sc_set_default_time_unit (100, SC_PS);

  sc_time tf_unit;

  tf_unit = sc_get_default_time_unit();

  // Wake up SC_METHOD process after 10ns:
  next_trigger (10, SC_NS);

  // Wake up SC_METHOD process on a rising edge 
  // of reset:
  next_trigger (reset.posedge_event());

  return 0;
}
开发者ID:HkQi,项目名称:Study_Demos,代码行数:95,代码来源:test.cpp


示例15: stop

void DebugConnector::connection()
{
    int rv;
    stop();

    int m_listenfd;
    struct sockaddr_in m_servaddr, m_cliaddr;

    m_listenfd = socket(AF_INET, SOCK_STREAM, 0);

    int on = 1;
    rv = setsockopt(m_listenfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));

    bzero(&m_servaddr, sizeof(m_servaddr));
    m_servaddr.sin_family = AF_INET;
    m_servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
    m_servaddr.sin_port = htons(m_port);

    if (bind(m_listenfd, (sockaddr *) &m_servaddr, sizeof(m_servaddr)) == -1) {
        cerr << "Cannot bind" << endl;
        return;
    }

    while (true) {
        if (listen(m_listenfd, 1) == -1) {
            cerr << "Listen error" << endl;
            return;
        }

        cout << "Listening on port " << m_port << endl;

        socklen_t clilen = sizeof(m_cliaddr);
        m_connectionfd = accept(m_listenfd, (struct sockaddr *) &m_cliaddr,
                                &clilen);
        if (m_connectionfd < 0) {
            cerr << "Error on accept" << endl;
            return;
        }

        cout << "Connected" << endl;

        while (1) {
            char headerbuf[2];

            rv = recv(m_connectionfd, headerbuf, 2, MSG_DONTWAIT);
            if (rv == -1) {
                wait(1, SC_US);
                continue;
            } else if (rv == 0) {
                cout << sc_time_stamp() << " Connection closed or error (rv="
                     << rv << ")" << endl;
                break;
            }

            int size = headerbuf[0];
            int type = headerbuf[1];

            uint8_t *payload;
            unsigned int paylen = size - 2;
            payload = (uint8_t*) malloc(paylen);
            assert(read(m_connectionfd, payload, paylen) == paylen);
            handleMessage(type, payload, paylen);

            free(payload);
        }
        close(m_connectionfd);

        stop();
    }
}
开发者ID:TUM-LIS,项目名称:optimsoc,代码行数:70,代码来源:DebugConnector.cpp


示例16: sc_main

int sc_main(int argc, char* argv[])
{
	// signal declaration
	sc_clock		clk("clk", 1, SC_US, 0.5);
	sc_signal<sc_logic>	reset;

	sc_signal<sc_lv<32> >	instruction;
	sc_signal<sc_logic> overflow;

	// module declaration
	top		top0("top0");

	// signal connection
	top0.clock(clk);
	top0.reset(reset);
	top0.instruction(instruction);
	top0.overflow(overflow);

	// Open VCD file
  	sc_trace_file *wf = sc_create_vcd_trace_file("test_DM_wave");
  	wf->set_time_unit(1, SC_NS);

	// error counter for tb
	int tb_error = 0;
    	
	// set signal to .vcd wave file
	sc_trace(wf,clk,"clk");
	sc_trace(wf,instruction,"instruction");
	sc_trace(wf,overflow,"overflow");
	sc_trace(wf,reset,"reset");	
	sc_trace(wf,top0.r1_data,"r1_data");
	sc_trace(wf,top0.r2_data,"r2_data");
	sc_trace(wf,top0.r3_data,"r3_data");
	sc_trace(wf,top0.out_data,"mem_output");
	sc_trace(wf,top0.alu_output,"alu_output");
	sc_trace(wf,top0.m31out,"rw_data");


	// init
	reset = sc_logic('0');
	instruction = sc_lv<32>("00000000000000000000000000000000");

	// run simulation
	sc_start(0,SC_US);
  	instruction = sc_lv<32>("01000100000000000000001111111111");
  	sc_start(1,SC_US);
  	
  	cout << "@" << sc_time_stamp() << endl
		<<	"instruction : " << instruction << endl
		<< "reset : " << reset << endl
		<< "r1data :" << top0.r1_data << endl
		<< "r2data :" << top0.r2_data << endl
		<< "r3data :" << top0.r3_data << endl
		<< "mem_output :" << top0.out_data << endl
		<< "alu_output :" << top0.alu_output << endl
		<< "rw_data :" << top0.m31out << endl

		<< endl;
  	/*
	// start testing here
	for(int i=0 ; i<SIZE_OF_TEST ; i++)
	{
		instruction = sc_lv<32>(in_data_list[i]);

		// add simulation time	
		sc_start(1,SC_US);

		cout << "@" << sc_time_stamp() <<" ,instruction : " << instruction << " ,reset : " << reset
		     << endl;

		// error check!
		
		temp_output = out_data_list[i];
		if(out_data.read() != temp_output){
			tb_error++;
#ifdef REG_DEBUG
			cout << " error! " << endl;
#endif
		}
		
	}
	*/
	if(tb_error != 0)
		cout << tb_error << " errors!" << endl;
	else
		cout << "pass!" << endl;

	sc_start(2,SC_NS);
	sc_close_vcd_trace_file(wf);
	
	return 0;
}
开发者ID:cdfq152313,项目名称:systemC_CPU,代码行数:92,代码来源:main.cpp


示例17: task1_functionality

// task 1 specified simply as a void(void) C-function
void task1_functionality()
{
  cout << "task 1 " << " t_begin=" << sc_time_stamp() << endl; // function body
}
开发者ID:nandohca,项目名称:kista,代码行数:5,代码来源:two_ptasks_and_static_prio.cpp


示例18: sc_main

int sc_main (int, char *[]) {
  
   // Definition of a task set (set to be assigned to a processor)
   // with the kista::taskset_by_name_t and task_info_t classes
   
   taskset_by_name_t task_set1;
   
   task_info_t task_info_t1("task1",task1);
   task_info_t task_info_t2("task2",task2);
   
   task_set1["task1"] = &task_info_t1;
   task_set1["task2"] = &task_info_t2;

//   gs->tasks_assigned["task1"] = task_info_t("task1",task1, gs);
//   gs->tasks_assigned["task2"] = task_info_t("task2",task2, gs);

   // Declaration of an scheduler and assignation of the task set
   // with the kista::scheduler class
   scheduler scheduler1(&task_set1, "scheduler1"); 
   
   // Equivalently, the scheduler can be declared...
//   scheduler *scheduler1;
	// ... and assigned the task set afterwards
//   scheduler1 = new scheduler(&task_set1, "scheduler1"); // by default, non-preemptive, one processor
   
   // configuring the scheduler
	// enabling time slicing
#ifdef _SET_ROUND_ROBIN
#ifdef _COMPACT_STYLE
   scheduler1.set_Round_Robin();
#else   
   scheduler1.set_preemptive();
   scheduler1.enable_time_slicing();
#endif   
#endif

#ifdef _SET_COOPERATIVE
   scheduler1.set_preemptive();
#endif

   // Tracing of the tasks and scheduler ocupation signals
   // with the kista::trace method of the kista::scheduler class
   scheduler1.trace_utilizations();

   set_global_simulation_time_limit(sc_time(1,SC_SEC));

#ifdef _SET_ROUND_ROBIN   
   sc_start(); // here simulation ends through the simulation limit enabled by default by KisTA library
               // That limit can be changed through the set_global_simulation_time_limit function
               // The end of the simulation might not exactly end at the time fixed by the global_time_limit,
               // since this limit is checked by the schedulers (so it is done at the time the first scheduling 
               // performed at a time over the global time limit
#else   
   // sc_start()		// in this case, an sc_start would involve a neverending simulation, since the scheduler never gets
                        // the controls and no detection to check if it is over the simulation time limit is done.
   sc_start(1,SC_SEC); // This way, simulation is "abruptly" terminated
						// ("abruptly" in the sense that it can happenm in the middle of the execution of a task
						// not necessary in the execution of 
                         
#endif  
   
   sc_stop(); // to ensure call to call backs (end_of_simulation),
              //  this is required for a right accounting of execution times, and starvation assesment

   taskset_by_name_t::iterator ts_it;

   cout << "-------------------------" << endl;   
   cout << "Simulation reports" << endl;
   cout << "-------------------------" << endl;
   
   for(ts_it = task_set1.begin(); ts_it != task_set1.end(); ts_it++) {
	      cout << ts_it->first << " task utilization : (after simulation): " << (float)(scheduler1.get_task_utilization(ts_it->first)*100.0) << "%" << endl;
   }
   
   cout << "Task Set utilization :  (after simulation) " << (float)(scheduler1.get_tasks_utilization()*100.0) << "%" << endl;
         
   cout << scheduler1.name() << " (sim) number of schedulings: " << (unsigned int)scheduler1.get_number_of_schedulings() << endl;
   cout << scheduler1.name() << " (sim) number of context switches: " << (unsigned int)scheduler1.get_number_of_context_switches() << endl;
   cout << scheduler1.name() << " (sim) scheduler utilization: " << (float)(scheduler1.get_scheduler_utilization()*100.0) << "%" << endl;   
   cout << scheduler1.name() << " (sim) platform utilization : " << (float)(scheduler1.get_platform_utilization()*100.0) << "%" << endl;
   cout << "last simulation time: " << sc_time_stamp() << endl;

   if(scheduler1.assess_starvation()!=true) {
	   cout << scheduler1.name() << " scheduler: No starvation detected. All tasks had chance to execute." << endl;
   }
   
   return 0;
     
}
开发者ID:nandohca,项目名称:kista,代码行数:89,代码来源:twotasks.cpp


示例19: t3_fun

void t3_fun() {
    cout << "T3: exec. at time " << sc_time_stamp() << endl;
}
开发者ID:nandohca,项目名称:kista,代码行数:3,代码来源:t3_fun.cpp


示例20: switch

bool TProcessingElement::canShot(TPacket& packet)
{
  bool   shot;
  double threshold;

  if (TGlobalParams::traffic_distribution != TRAFFIC_TABLE_BASED)
    {
      if (!transmittedAtPreviousCycle)
	threshold = TGlobalParams::packet_injection_rate;
      else
	threshold = TGlobalParams::probability_of_retransmission;

      shot = (((double)rand())/RAND_MAX < threshold);
      if (shot)
	{
	  switch(TGlobalParams::traffic_distribution)
	    {
	    case TRAFFIC_RANDOM:
	      packet = trafficRandom();
	      break;
	      
	    case TRAFFIC_TRANSPOSE1:
	      packet = trafficTranspose1();
	      break;
	      
	    case TRAFFIC_TRANSPOSE2:
	      packet = trafficTranspose2();
	      break;
	      
	    case TRAFFIC_BIT_REVERSAL:
	      packet = trafficBitReversal();
	      break;

	    case TRAFFIC_SHUFFLE:
	      packet = trafficShuffle();
	      break;

	    case TRAFFIC_BUTTERFLY:
	      packet = trafficButterfly();
	      break;

	    default:
	      assert(false);
	    }
	}
    }
  else
    { // Table based communication traffic
      if (never_transmit)
	return false;

      double now         = sc_time_stamp().to_double()/1000;
      bool   use_pir     = (transmittedAtPreviousCycle == false);
      vector<pair<int,double> > dst_prob;
      double threshold = traffic_table->getCumulativePirPor(local_id, (int)now, use_pir, dst_prob);

      double prob = (double)rand()/RAND_MAX;
      shot = (prob < threshold);
      if (shot)
	{
	  for (unsigned int i=0; i<dst_prob.size(); i++)
	    {
	      if (prob < dst_prob[i].second) 
		{
		  packet.make(local_id, dst_prob[i].first, now, getRandomSize());
		  break;
		}
	    }
	}
    }

  return shot;
}
开发者ID:iasonas,项目名称:iasonas,代码行数:73,代码来源:TProcessingElement.cpp



注:本文中的sc_time_stamp函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sc_trace函数代码示例发布时间:2022-05-30
下一篇:
C++ sc_strerror函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap