Home › Practice › RTL Design › Credits: never overflow the receiver

Credits: never overflow the receiver

EasyRTLsequentialarchitecture

A sender pushes messages into a receiver that has only four buffer slots. If the sender talks too fast, messages are lost. How does the sender know when it is safe to send?

Concept first. In credit-based flow control the sender keeps a count of how many free slots the receiver has: the credits. Sending a message uses one credit. When the receiver frees a slot, it sends one credit back. The sender may only send while the count is above 0, so the receiver can never overflow and nothing is dropped. The count starts equal to the size of the receiver's buffer. Think about what happens when a send and a returned credit arrive in the same cycle, and what happens to requests that should not be counted at all (a send with no credits, a returned credit when the count is already full).

What to build.

Solve in your browser →

No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.

More in this track

← Count the leading zerosALU flags: N, Z, C, V →