312asc11
Newbie
- Joined
- Dec 10, 2017
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 31
Very urgent.
I would like know that how can we code a round robin arbiter using a ring counter for token generation means if the token is with first user first priority logic 0 will be enabled and so on.Based on the person who is accessing the resource the corresponding value of the person comes as output of priority encoder and will be decoded again in order to get corresponding grant signal.
The design contains :
ring counter for token generation at every posedge of clk which will enable priority logic.
priority logic contains priority encoder and a decoder .
4 request signals are there 4 grant signals at output.
please help me with the code, i am not getting the clear idea as i m a beginner.
it's the urgent homework.. plz help me
Reset 일 때 모든 grant 신호 0
if priority=0
counter: 0 1 2 3 0 1 2 3 …
if priority=1 and priority_req =0
counter: 0 0 1 2 3 0 0 1 2 3 …
priority=1 and priority_req =1
counter: 0 1 1 2 3 0 1 1 2 3…
priority=1 and priority_req =2
counter: 0 1 2 2 3 0 1 2 2 3 …
priority=1 이고 priority_req =3 일 때
counter: 0 1 2 3 3 0 1 2 3 3…
Testbench
I would like know that how can we code a round robin arbiter using a ring counter for token generation means if the token is with first user first priority logic 0 will be enabled and so on.Based on the person who is accessing the resource the corresponding value of the person comes as output of priority encoder and will be decoded again in order to get corresponding grant signal.
The design contains :
ring counter for token generation at every posedge of clk which will enable priority logic.
priority logic contains priority encoder and a decoder .
4 request signals are there 4 grant signals at output.
please help me with the code, i am not getting the clear idea as i m a beginner.
it's the urgent homework.. plz help me
Reset 일 때 모든 grant 신호 0
if priority=0
counter: 0 1 2 3 0 1 2 3 …
if priority=1 and priority_req =0
counter: 0 0 1 2 3 0 0 1 2 3 …
priority=1 and priority_req =1
counter: 0 1 1 2 3 0 1 1 2 3…
priority=1 and priority_req =2
counter: 0 1 2 2 3 0 1 2 2 3 …
priority=1 이고 priority_req =3 일 때
counter: 0 1 2 3 3 0 1 2 3 3…
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 module rr_arbiter ( clk, // positive edge trigger reset, // negative edge trigger req0, req1, req2, req3, grant0, grant1, grant2, grant3, priority, priority_req); input clk, reset; input req0, req1, req2, req3; input priority; input [1:0] priority_req; output grant0, grant1, grant2, grant3; // your codes endmodule
Testbench
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 module rr_arbiter_tb; reg clk, reset; reg req0, req1, req2, req3; reg priority; reg [1:0] priority_req; wire grant0, grant1, grant2, grant3; rr_arbiter my_rr_arbiter (//instantiation .clk(clk), .reset(reset) .req0(req0), .req1(req1), .req2(req2), .req3(req3), .priority(priority), .priority_req(priority_req), .grant0(grant0), .grant1(grant1), .grant2(grant2), .grant3(grant3) ); initial begin clk=0; forever #20 clk=~clk; end initial begin reset=1;repeat (5) @ (posedge clock); reset=0;repeat (5) @ (posedge clock); reset=1; end initial begin // your code// end endmodule
Last edited by a moderator: