Note that there are some explanatory texts on larger screens.

plurals
  1. POFinding the next in round-robin scheduling by bit twiddling
    text
    copied!<p>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. </p> <p>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.</p> <p>Some examples (assume round-robin scheduling is done by rotating left). Example1:</p> <ul> <li>Current: "00000100"</li> <li>Mask: "01100000"</li> <li>Next schedule: "00100000" - in normal round-robin, #3 and then #4 should come after #2, but they don't request, so #5 is picked.</li> </ul> <p>Example2:</p> <ul> <li>Current: "01000000"</li> <li>Mask: "00001010"</li> <li>Next: "00000010" - because scheduling is done by cycling left, and #1 is the first requesting slave in that order.</li> </ul> <hr> <p>Now, this can be easily coded in a loop, I know. But I actually want to get my result by a bit-twiddling operation, without loops. The motivation: I want to implement this in hardware (in an FPGA) in VHDL/Verilog.</p> <p>A bonus is to make up an algorithm that's generic for any amount of slaves N.</p> <p>By the way, this is not a homework question. It's an important problem whenever one wants to schedule slaves in some manner, and condition the scheduling by the slaves' requests. My current solution is somewhat "heavy" and I wanted to know if I'm missing something obvious.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload