1 //----------------------------------------------------
2 // A four level, round-robin arbiter. This was
3 // orginally coded by WD Peterson in VHDL.
4 //----------------------------------------------------
17 // --------------Port Declaration-----------------------
29 //--------------Internal Registers----------------------
44 //--------------Code Starts Here-----------------------
45 always @ (posedge clk)
52 lgnt0 <=(~lcomreq & ~lmask1 & ~lmask0 & ~req3 & ~req2 & ~req1 & req0)
53 | (~lcomreq & ~lmask1 & lmask0 & ~req3 & ~req2 & req0)
54 | (~lcomreq & lmask1 & ~lmask0 & ~req3 & req0)
55 | (~lcomreq & lmask1 & lmask0 & req0 )
56 | ( lcomreq & lgnt0 );
57 lgnt1 <=(~lcomreq & ~lmask1 & ~lmask0 & req1)
58 | (~lcomreq & ~lmask1 & lmask0 & ~req3 & ~req2 & req1 & ~req0)
59 | (~lcomreq & lmask1 & ~lmask0 & ~req3 & req1 & ~req0)
60 | (~lcomreq & lmask1 & lmask0 & req1 & ~req0)
62 lgnt2 <=(~lcomreq & ~lmask1 & ~lmask0 & req2 & ~req1)
63 | (~lcomreq & ~lmask1 & lmask0 & req2)
64 | (~lcomreq & lmask1 & ~lmask0 & ~req3 & req2 & ~req1 & ~req0)
65 | (~lcomreq & lmask1 & lmask0 & req2 & ~req1 & ~req0)
67 lgnt3 <=(~lcomreq & ~lmask1 & ~lmask0 & req3 & ~req2 & ~req1)
68 | (~lcomreq & ~lmask1 & lmask0 & req3 & ~req2)
69 | (~lcomreq & lmask1 & ~lmask0 & req3)
70 | (~lcomreq & lmask1 & lmask0 & req3 & ~req2 & ~req1 & ~req0)
74 //----------------------------------------------------
75 // lasmask state machine.
76 //----------------------------------------------------
77 assign beg = (req3 | req2 | req1 | req0) & ~lcomreq;
78 always @ (posedge clk)
80 lasmask <= (beg & ~ledge & ~lasmask);
81 ledge <= (beg & ~ledge & lasmask)
82 | (beg & ledge & ~lasmask);
85 //----------------------------------------------------
87 //----------------------------------------------------
88 assign lcomreq = ( req3 & lgnt3 )
93 //----------------------------------------------------
95 //----------------------------------------------------
96 assign lgnt = {(lgnt3 | lgnt2),(lgnt3 | lgnt1)};
98 //----------------------------------------------------
100 //----------------------------------------------------
101 always @ (posedge clk )
105 end else if(lasmask) begin
113 assign comreq = lcomreq;
115 //----------------------------------------------------
117 //----------------------------------------------------