1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-30 02:32:53 +08:00
oh/common/hdl/oh_arbiter.v
Andreas Olofsson fd7aff5dd8 Fixing warning messages in chip synthesis tool
- Don't fight the tools
- No way to remove these warnings and I don't want to have to tell everyone to include maging "don't output this kind of warning flags" that are global to a project...that's just bad practice.
- Didn't take many minutes to remove these warnings and now synthesis runs through with 0 warnings ... much cleaner.. inspires more confidence
2016-02-12 11:04:52 -05:00

43 lines
871 B
Verilog

/* Simple combinatorial priority arbiter
* bit[0] has highest priority
*
*/
module oh_arbiter(/*AUTOARG*/
// Outputs
grants,
// Inputs
requests
);
parameter N = 99;
parameter TYPE = "FIXED"; //arbiter type
//"FIXED"
//"ROUNDROBIN"
//"FAIR"
input [N-1:0] requests; //request vector
output [N-1:0] grants; //grant (one hot)
wire [N-1:0] waitmask;
genvar j;
generate
if(TYPE=="FIXED")
begin : arbiter_fixed
assign waitmask[0] = 1'b0;
for (j=N-1; j>=1; j=j-1)
begin : gen_arbiter
assign waitmask[j] = |requests[j-1:0];
end
end
endgenerate
//grant circuit
assign grants[N-1:0] = requests[N-1:0] & ~waitmask[N-1:0];
endmodule // oh_arbiter