求助:for...loop 急切!多谢指点!
时间:10-02
整理:3721RD
点击:
m0<='1' when (d1>hold_s) else '0';
m1<='1' when (d2>hold_s) else '0';
m2<='1' when (d3>hold_s) else '0';
m3<='1' when (d4>hold_s) else '0';
m4<='1' when (d5>hold_s) else '0';
m5<='1' when (d6>hold_s) else '0';
m6<='1' when (d7>hold_s) else '0';
m7<='1' when (d8>hold_s) else '0';
m8<='1' when (d9>hold_s) else '0';
m<=m8& m7& m6& m5& m4& m3& m2& m1& m0;
process(clk)
variable counter : integer range 0 to 4:=0 ;
variable num : integer range 0 to 8 :=0;
begin
if clk'event and clk='1' then
counter:=0;
for num in 0 to 8 loop
if (m(num)='1') then
counter:=counter+1;
else
counter:=counter;
end if;
if counter=3 then
flag_s<='1'; --flag表示光斑标志
counter:=0;
exit;
else
flag_s<='0';
counter:=counter;
end if;
end loop;
end if;
end process;
请问各位高手:我上面用的FOR LOOP语句会不会被综合掉,是否为一个clk时钟for loop执行了八次?
能否满足以上语句含义的要求?
谢谢各位不吝赐教!
m1<='1' when (d2>hold_s) else '0';
m2<='1' when (d3>hold_s) else '0';
m3<='1' when (d4>hold_s) else '0';
m4<='1' when (d5>hold_s) else '0';
m5<='1' when (d6>hold_s) else '0';
m6<='1' when (d7>hold_s) else '0';
m7<='1' when (d8>hold_s) else '0';
m8<='1' when (d9>hold_s) else '0';
m<=m8& m7& m6& m5& m4& m3& m2& m1& m0;
process(clk)
variable counter : integer range 0 to 4:=0 ;
variable num : integer range 0 to 8 :=0;
begin
if clk'event and clk='1' then
counter:=0;
for num in 0 to 8 loop
if (m(num)='1') then
counter:=counter+1;
else
counter:=counter;
end if;
if counter=3 then
flag_s<='1'; --flag表示光斑标志
counter:=0;
exit;
else
flag_s<='0';
counter:=counter;
end if;
end loop;
end if;
end process;
请问各位高手:我上面用的FOR LOOP语句会不会被综合掉,是否为一个clk时钟for loop执行了八次?
能否满足以上语句含义的要求?
谢谢各位不吝赐教!
小弟做了一个for...loop的小程序仿真,结果for..loop只被执行了一次,我用QII6.0,请高手指点
process(Aclr,Clk) --这个进程不会对q_t(0)赋值 begin if Aclr='1' then for i in 1 to Number loop q_t(i)<=(others=>'0'); end loop; elsif Clk'event and Clk='1' then for i in 1 to Number loop q_t(i)<=q_t(i-1); end loop; end if; end process; Q<=q_t(Number);
XILINX能推断正确...
for loop能否被综合,你可以试着把for loop展开看看。 如果展开能综合,那么这个for loop就能综合。
