1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-17 20:02:53 +08:00

Name change for arbiter

This commit is contained in:
Andreas Olofsson 2015-12-03 18:04:10 -05:00
parent b9107474a9
commit 16b0655151

View File

@ -1,30 +1,34 @@
/* Simple combinatorial priority arbiter /* Simple combinatorial priority arbiter
* (lowest position has highest priority) * bit[0] has highest priority
* *
*/ */
module oh_arbiter_static(/*AUTOARG*/ module oh_arbiter_static(/*AUTOARG*/
// Outputs // Outputs
grant, await, grants, waits,
// Inputs // Inputs
request requests
); );
parameter ARW=99; parameter N=99;
input [ARW-1:0] request; //request vector input [N-1:0] requests; //request vector
output [ARW-1:0] grant; //grant (one hot) output [N-1:0] grants; //grant (one hot)
output [ARW-1:0] await; //wait mask! output [N-1:0] waits; //wait mask!
genvar j; genvar j;
assign await[0] = 1'b0; wire [N-1:0] waitmask;
generate for (j=ARW-1; j>=1; j=j-1) begin : gen_arbiter
assign await[j] = |request[j-1:0]; assign waitmask[0] = 1'b0;
generate for (j=N-1; j>=1; j=j-1)
begin : gen_arbiter
assign waitmask[j] = |requests[j-1:0];
end end
endgenerate endgenerate
//grant circuit //grant circuit
assign grant[ARW-1:0] = request[ARW-1:0] & ~await[ARW-1:0]; assign grants[N-1:0] = requests[N-1:0] & ~waitmask[N-1:0];
assign waits[N-1:0] = requests[N-1:0] & ~grants[N-1:0];
endmodule // oh_arbiter_priority endmodule // oh_arbiter_priority