I am trying to ADD two array and want output in array in verilog code. But error is occured. which is ERROR:HDLCompiler:1335: Port sum must not be declared to be an array in verilog code . can anyone tell me how to declare output array in verilog code. Thanks.
module array(clk,sum,reset);
input clk,reset;
//input [7:0] din;
//input [7:0] A[3:0];
//input [7:0] B[3:0];
output sum[3:0];
wire [7:0] sum[3:0];
reg [7:0] A[3:0];
reg [7:0] B[3:0];
integer i;
always@(posedge clk)
begin
if(reset==1'b1)
begin
A[0]<=1;
A[1]<=2;
A[2]<=3;
A[3]<=4;
B[0]<=5;
B[1]<=5;
B[2]<=5;
B[3]<=5;
sum[0]<=0;
sum[1]<=0;
sum[2]<=0;
sum[3]<=0;
end
else
begin
for(i=0;i<4;i=i+1)
begin
sum[i]=(A[i] + B[i]);
end
end
end
endmodule