Hello I am trying a small section of a project code where the equation is multiplying input with all values of array and then adding them up in one final output.
module arraywithinput(input in,
output reg [11:0] out0
);
reg [7:0] xin[3:0];
initial
begin
xin[0]=7;
xin[1]=6;
xin[2]=5;
xin[3]=2;
end
integer i;
always@(*)
begin
for (i=0; i<4; i=i+1)
out0<=out0+(in*xin[i]);
end
endmodule
I am getting synthesis error of Unexpected xin event in always block sensitivity list. What could I be possibly doing wrong to implement this scenario.
Initial blocks are not synthesizable constructs and are intended for test benches only. Also it is not advisable to have NBA in an always@* block. Mult/Div are compute intense and use lot of resources, better to use some algorithm like repeated addition, booth etc to implement multipication.
I have modified your code. I have used a clock signal.