Esempio n. 1
0
void ProcessingElement::txProcess()
{
    if (reset.read()) {
        req_tx.write(0);
        current_level_tx = 0;
        transmittedAtPreviousCycle = false;
    } 
    else {
        Packet packet;
        if (canShot(packet)) {
            packet_queue.push(packet);
            transmittedAtPreviousCycle = true;
        } else {
            transmittedAtPreviousCycle = false;
        }

        if (ack_tx.read() == current_level_tx) {
            if (!packet_queue.empty()) {
                Flit flit = nextFlit();        // Generate a new flit
                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);
            }
        } else {
            //std::cout << "Oops, pe[" << local_id << "] tx encoutered ABP error" << endl;
        }
    }
}
void NoximProcessingElement::txProcess()
{
    if (reset.read()) {
	req_tx.write(0);
	current_level_tx = 0;
	transmittedAtPreviousCycle = false;
    } else {
	NoximPacket packet;

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


	if (ack_tx.read() == current_level_tx) {
	    if (!packet_queue.empty()) {
		NoximFlit flit = nextFlit();	// Generate a new flit
		if (NoximGlobalParams::verbose_mode > VERBOSE_OFF) {
		    cout << sc_time_stamp().to_double() /
			1000 << ": ProcessingElement[" << local_id <<
			"] SENDING " << 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);
	    }
	}
    }
}