예제 #1
0
void Or1ksimJtagSC::jtagHandler(tlm_generic_payload & inpPayload,
		sc_time & inpDelay) {
	// Retrieve the extension.
	JtagExtensionSC * localJtagExtension;
	inpPayload.get_extension(localJtagExtension);

	// Check if the extension exists. Set up the access type and bit size as
	// appropriate.
	JtagExtensionSC::AccessType localAccessType;
	int localBitSize;

	if(NULL == localJtagExtension) {
		unsigned int addr = static_cast<unsigned int>(inpPayload.get_address());

		localAccessType = ((ADDR_SHIFT_IR == addr) ? JtagExtensionSC::SHIFT_IR :
				(ADDR_SHIFT_DR == addr) ? JtagExtensionSC::SHIFT_DR :
						JtagExtensionSC::RESET);
		localBitSize = 8 * static_cast<int>(inpPayload.get_data_length());
	}
	else {
		localAccessType = localJtagExtension->getType();
		localBitSize = localJtagExtension->getBitSize();
	}

	// Behavior depends on the type
	switch (localAccessType) {
		case JtagExtensionSC::RESET:
			myOr1ksimMutex.lock();
				inpDelay += sc_time(or1ksim_jtag_reset(), SC_SEC);
			myOr1ksimMutex.unlock();
			inpPayload.set_response_status(tlm::TLM_OK_RESPONSE);

			return;

		case JtagExtensionSC::SHIFT_IR:
			myOr1ksimMutex.lock();
				inpDelay += sc_time (or1ksim_jtag_shift_ir(inpPayload.
						get_data_ptr(), localBitSize), SC_SEC);
			myOr1ksimMutex.unlock();
			inpPayload.set_response_status(tlm::TLM_OK_RESPONSE);

			return;

		case JtagExtensionSC::SHIFT_DR:
			myOr1ksimMutex.lock ();
				inpDelay += sc_time(or1ksim_jtag_shift_dr(
						inpPayload.get_data_ptr(), localBitSize), SC_SEC);
			myOr1ksimMutex.unlock ();
			inpPayload.set_response_status (tlm::TLM_OK_RESPONSE);

			return;

		default:
			cerr << "ERROR: Unrecognized JTAG transaction type." << endl;
			inpPayload.set_response_status(tlm::TLM_GENERIC_ERROR_RESPONSE);

			return;
	}
}
예제 #2
0
tlm_sync_enum LisNoCAdapter::nb_transport_bw(tlm_generic_payload &trans, tlm_phase &phase, sc_time &delay) {
    LISNoCExtension *ext;
    ext = new LISNoCExtension();
    trans.get_extension(ext);
#ifdef DEBUG
    cout << sc_time_stamp() << " Node:" << local_id << " VC0=" << virtual_channel[0] << " VC1=" << virtual_channel[1] << endl;
#endif
    virtual_channel[ext->get_vchannel()] = false;
#ifdef DEBUG
    cout << sc_time_stamp() << " Node:" << local_id << " VC0=" << virtual_channel[0] << " VC1=" << virtual_channel[1] << endl;
#endif
    can_send.notify(SC_ZERO_TIME);

    phase = END_REQ;
    trans.set_response_status(TLM_OK_RESPONSE);
    return TLM_COMPLETED;
}