3 reset , // Active high reset
4 req_0 , // Active high request from agent 0
5 req_1 , // Active high request from agent 1
6 req_2 , // Active high request from agent 2
7 req_3 , // Active high request from agent 3
8 gnt_0 , // Active high grant to agent 0
9 gnt_1 , // Active high grant to agent 1
10 gnt_2 , // Active high grant to agent 2
11 gnt_3 // Active high grant to agent 3
13 // Port declaration here
14 input clock ; // Clock
15 input reset ; // Active high reset
16 input req_0 ; // Active high request from agent 0
17 input req_1 ; // Active high request from agent 1
18 input req_2 ; // Active high request from agent 2
19 input req_3 ; // Active high request from agent 3
20 output gnt_0 ; // Active high grant to agent 0
21 output gnt_1 ; // Active high grant to agent 1
22 output gnt_2 ; // Active high grant to agent 2
23 output gnt_3 ; // Active high grant to agent
26 reg gnt_0 ; // Active high grant to agent 0
27 reg gnt_1 ; // Active high grant to agent 1
28 reg gnt_2 ; // Active high grant to agent 2
29 reg gnt_3 ; // Active high grant to agent
31 parameter [2:0] IDLE = 3'b000;
32 parameter [2:0] GNT0 = 3'b001;
33 parameter [2:0] GNT1 = 3'b010;
34 parameter [2:0] GNT2 = 3'b011;
35 parameter [2:0] GNT3 = 3'b100;
37 reg [2:0] state, next_state;
39 always @ (state or req_0 or req_1 or req_2 or req_3)
43 IDLE : if (req_0 == 1'b1) begin
45 end else if (req_1 == 1'b1) begin
47 end else if (req_2 == 1'b1) begin
49 end else if (req_3 == 1'b1) begin
54 GNT0 : if (req_0 == 1'b0) begin
59 GNT1 : if (req_1 == 1'b0) begin
64 GNT2 : if (req_2 == 1'b0) begin
69 GNT3 : if (req_3 == 1'b0) begin
74 default : next_state = IDLE;
78 always @ (posedge clock)