当前位置: 首页>>代码示例>>C++>>正文


C++ sc_time_stamp函数代码示例

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


在下文中一共展示了sc_time_stamp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: sc_time_stamp

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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例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


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