The PACKET_FC method allocates blocks of credit in finer granularities
than LIMIT_FC, using the receive completion space more efficiently with a small increase
in user logic. Start with two registers, CPLH_PENDING and CPLD_PENDING, (loaded with
zero at reset), and then perform these steps:
- When the user application needs to send an NP request, determine the potential number of
CplH and CplD credits it might require:
- NP_CplH = ceiling[((Start_Address mod RCB) + Request_Size) / RCB]
- NP_CplD = ceiling[((Start_Address mod 16 bytes) + Request_Size) /16 bytes] (except I/O Write, which returns zero data) [(req_size + 15)/16]
The modulo and ceiling functions ensure that any fractional RCB or credit blocks are rounded up. For example, if a memory read requests 8 bytes of data from address 7Ch, the returned data can potentially be returned over two completion packets (7Ch-7Fh, followed by 80h-83h). This would require two RCB blocks and two data credits.
- Check these:
- CPLH_PENDING + NP_CplH < Total_CplH
- CPLD_PENDING + NP_CplD < Total_CplD
- If both inequalities are true, transmit the non-posted request, and increase CPLH_PENDING by NP_CplH and CPLD_PENDING by NP_CplD. For each non-posted request transmitted, keep NP_CplH and NP_CplD for later use.
- When all completion data is returned for an non-posted request, decrease CPLH_PENDING and CPLD_PENDING accordingly.
This method is less wasteful than LIMIT_FC but still ties up all of an non-posted request completion space until the entire request is satisfied. RCB_FC and DATA_FC provide finer de-allocation granularity at the expense of more logic.