支持N个request 的 round robin arbiter

本文探讨了如何处理多个请求的轮询仲裁问题。传统方法的状态机随着请求增多变得复杂,提出了一种改良方案,仅需实现优先级逻辑和环形计数器。此外,还介绍了一种通用方法,利用二的补码选择下一个请求的奴隶单元。通过C语言和Verilog代码展示了具体的实现方式。
AI助手已提取文章相关产品:

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 实现

 

您可能感兴趣的与本文相关内容

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值