作者light0617 (期待寒假)
看板Electronics
标题[问题] verilog 一个按键多重功能
时间Mon Jun 2 18:02:56 2014
各位大大打扰了
最近在实作一个按键多重功能
也就是
按一次开始 再按一次暂停
老实说 我有写出来 但是还是有点奇怪
有时候按了没反应 怀疑是没有在同一个clk中的关系
我的部份的CODE如下:
input i_start_stop;
input i_clk;
input i_rts;
reg start_ind=1'b0;
reg [28:0]cnt;
always @(negedge i_start_stop )//start_stop
begin
if(i_start_stop==0)
begin
if(start_ind==1'b1) start_ind<=1'b0;
else start_ind<=start_ind+1'b1;
end
end
always@(posedge i_clk , negedge i_rts)
begin
if(~i_rts) cnt<=29'b0;
else if(start_ind==1'b1) cnt<=cnt+1'b1;
end
若第一个改成
always @(negedge i_start_stop, i_clk )//start_stop
跑起来更奇怪
若把i_start_stop 写在always@(posedge i_clk , negedge i_rts)
又不知如何实作
麻烦各位大大了
--
推 steven0529: 小学时会有人说要烙国中生打人 05/20 12:19
→ steven0529: 国中时会有人说要烙高中生打人... 05/20 12:19
→ imanikki: 可是高中没人说要烙大学生打人 05/20 12:20
→ egg9: 因为大学生都在打魔兽吃泡面 要烙的话也只会烙赛 05/20 12:22
推 youaten0112:因为大学生认为打人不会增加经验值也不会掉宝..... 05/20 12:26
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 140.112.16.153
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/Electronics/M.1401703379.A.0B1.html