for loop in always block?????

Status
Not open for further replies.

pinkyvidya

Member level 2
Joined
Sep 9, 2009
Messages
49
Helped
5
Reputation
10
Reaction score
4
Trophy points
1,288
Location
kerala
Activity points
1,655
error 10170 in verilog

is it possible to write for loop in always block in verilog???
the piece of code i tried is given below...

always @(posedge clk)

begin
a=1'b0;
l=1'b0;
yout(l)=8'b0;
for(j=0;j<=3;j=j+1)
begin
b=1'b0;
for(i=0;i<=3;i=i+1)
begin
for(k=0;k<=3;k=k+1)
begin
n=a;
m=b;
z=xin*cin(m);
n=n+1;
m=m+4;
yout(l)=yout(l)+z;
l=l+1;
end
b=b+1;
end
a=a+1;
end
end


this is showing error like
"Error (10170): Verilog HDL syntax error at matmul.v(17) near text "="; expecting ";" "
"Error (10170): Verilog HDL syntax error at matmul.v(30) near text "="; expecting ";" "


v(17) is yout(l)=8'b0;
v(30) is yout(l)=yout(l)+z;

kindly anyone clarify my doubt....iwill be very thankful
 

verilog for loop

Hi,

Verilog uses [ ] for indexing in an array, so change yout(l) into yout[l].

Devas
 

thanks for the clarification........i didn't noticed that.....
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…