Forum Discussion
Altera_Forum
Honored Contributor
11 years agoThe mistake was mine. I was confusing the tx_cred bus of the Stratix IV with the tx_cred_datafccp[11:0], fcnp, fcp busses on the Stratix V.
The Stratix IV version gives the credits available, so if there are credits you can send a packet. Be careful that this is only for outgoing requests. You have to make sure you do not flood your RX buffer with the responses that come back from your outgoing MRd requests. The Stratix V version instead gives you the credit limit. This is the value stated in the specification (see the Flow Control Update Loop chart in the Altera PCIE IP manual). There are two values, the consumed and the limit. For the consumed you just count the credits you send (each header is one header credit, each 16 bytes of data is one data credit). The limit is what the root lets you have. Then do like the read/write pointers of a FIFO, simply subtract the consumed from the limit even if they wrap around, and you will have the available.