Hi all,
I'm struggling to figure out the difference between peqs. I wrote my own codes but I don't see any usage case difference.
Let me to show a simple example for a Target (not a real code but some portions).
PEQ WITH GET:
In this case along fw path, transaction is inserted in the peq, triggers an event at delay_time.
struct Target : sc_module {
// DEFINE A PEQ
peq_with_get<tlm_generic_payload> peq_target;
// DEFINE A THREAD TO TRIGGER PEQ EVENTS
void target_thread();
};
tlm_sync_enum Target::nb_transport_fw(tlm_generic_payload& trans, tlm_phase& phase, sc_time& delay) {
// GET TRANSACTION
// ANNOTATE DELAY TIME REGARDING PROTOCOL
delay_time=...
// INSERT IN THE PEQ
peq_target.notify(trans, delay_time);
...
...
return TLM_UPDATE;
};
void Target::target_thread(.....) {
while(true) {
wait(peq_target.get_event());
// GET TRANSACTION!
trans = peq_target.get_next_transaction();
// PROCESS TRANSACTION
// send response, wait........
}
};
peq_with_cb_and_phase:
In this case along fw path, transaction is inserted in the peq and after a delay_time triggers a cb.
struct Target : sc_module {
// DEFINE A PEQ
peq_with_cb_and_phase<Target,tlm_generic_payload> peq_target;
// DEFINE A THREAD TO TRIGGER PEQ EVENTS
void target_cb();
};
// Constructor connect peq to cb
Target::Target (......) : peq_target("peq_target", this, &Target::target_cb()) {
}
tlm_sync_enum Target::nb_transport_fw(tlm_generic_payload& trans, tlm_phase& phase, sc_time& delay) {
// GET TRANSACTION
// ANNOTATE DELAY/PHASE TIME REGARDING PROTOCOL
delay_time=...
// INSERT IN THE PEQ
peq_target.notify(trans, phase,delay_time);
...
...
return TLM_UPDATE;
};
void Target::target_cb(.......)
{
// Triggered from peq calling target_cb at delay_time
// Manage Transaction and response
return TLM.....
}
What is the difference ? Can you show me or indicate an example of what can be do with one and can not be do with other ?
Sincerely I don't understand.
Thank you in advance.