I'm trying to get the maximum of an input vector. I'm assuming all inputs are unsigned and that it should work on a range of bitwidths and array lengths.
I have to keep the parameters and input and output logic the way they are. Here is what I have, but I get a syntax error at the if statement:
module max
#(parameter int bW=16,
parameter int eC=8)
(input logic [bW-1:0] a[eC-1:0],
output logic [bW-1:0] z);
logic i=0;
always @* begin
for (i=0; i<size; i++) {
if (a[i] >z)
z = a[i];
}
end
endmodule
Maybe using a case statement would be better? I dont know.