1. 传统方法
状态机如下(三个request)

显然随着request增加,状态机会变得异常复杂,难于管理。
针对这种情况,提出了一种改良的方法:
从定义开始: 在每个cycle,只有一个master拥有最高优先权,如果这个拥有token的master没有request,则他的下一个master发出的request可以被ack。如下图

这样我们只需要实现priority logic 和ring counter两个部分就行了。各个request和priority logic的连接顺序有所调整变化,请务必注意。这种方法适合于4-8个master 的request。
下面我们来介绍一种更加通用的方法(主要利用二的补码)
Consider the following problem. You have a bit-string that represents the current scheduled slave in one-hot encoding. For example, "00000100" (with the leftmost bit being #7 and rightmost #0) means that slave #2 is scheduled.
Now, I want to pick the next scheduled slave in a round-robin scheduling scheme, with a twist. I have a "request mask" which says which slaves actually want to be scheduled. The next slave will be picked only from those that want to.
Some examples (assume round-robin scheduling is done by rotating left). Example1:
current : 当前拿到token的slave号。
mask: requests
next: 下一个拿到token的slave号。
- Current: "00000100"
- Mask: "01100000"
- Next schedule: "00100000" - in normal round-robin, #3 and then #4 should come after #2, but they don't request, so #5 is picked.
Example2:
- Current: "01000000"
- Mask: "00001010"
- Next: "00000010" - because scheduling is done by cycling left, and #1 is the first requesting slave in that order.
C语言实现代码:
verilog 实现
本文探讨了如何处理多个请求的轮询仲裁问题。传统方法的状态机随着请求增多变得复杂,提出了一种改良方案,仅需实现优先级逻辑和环形计数器。此外,还介绍了一种通用方法,利用二的补码选择下一个请求的奴隶单元。通过C语言和Verilog代码展示了具体的实现方式。
4816

被折叠的 条评论
为什么被折叠?



