下面代码中的for循环在一个后边沿时钟中开始执行。我希望每次迭代都发生在一个时钟边沿,这样在第五个时钟边沿时,我的if将被激活。
begin
temp_number3=contact;
for(i3=0;i3<10;i3=i3+1)
begin //for loop beign
count3=i3;
if(count3==5)
begin //beign for if
message=1;
contact_num=temp_number3;
end// end for if
end // end of for loop
end发布于 2014-04-21 03:52:26
您不需要for-loop,而是在时钟的posedge上激活的always块,即:
begin
always@(posedge clk)
begin
if(count3 == 5) begin
message <= 1;
contact_num <= temp_number3;
count3 <= count3 + 1;
end else if(count 3 == 9) begin
count3 <= 0;
stopFlag <= 1;
end else if(~stopFlag)
count3 <= count3 + 1;
end
endhttps://stackoverflow.com/questions/23186292
复制相似问题