2019-03-25 09:09发布
stop 作为使能信号,用来控制计数器
start_reg<=start;
stop_reg<=stop;
if (start='1') and (start_reg='0') then
start_flag<='1';
cnt<=0;
elsif (stop='1') and (stop_reg='0') then
start_flag<='0';
bus<=cnt;
elsif (start_flag='1') then
cnt<=cnt+1;
end if;
在原程序上修改一下即可!
if(reset='0') then
bus<=0;
elsif clk'event and clk='1' then
最多设置5个标签!
stop 作为使能信号,用来控制计数器
start_reg<=start;
stop_reg<=stop;
if (start='1') and (start_reg='0') then
start_flag<='1';
cnt<=0;
elsif (stop='1') and (stop_reg='0') then
start_flag<='0';
bus<=cnt;
elsif (start_flag='1') then
cnt<=cnt+1;
end if;
在原程序上修改一下即可!
if(reset='0') then
cnt<=0;
bus<=0;
elsif clk'event and clk='1' then
start_reg<=start;
stop_reg<=stop;
if (start='1') and (start_reg='0') then
start_flag<='1';
cnt<=0;
elsif (stop='1') and (stop_reg='0') then
start_flag<='0';
bus<=cnt;
elsif (start_flag='1') then
cnt<=cnt+1;
end if;
end if;
一周热门 更多>