|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
目标计数为24位的位宽。
假设初始状态为0,
在状态0时,收到请求,则从0x300开始,每次请求计数减1,
当计到0x200时进入状态2;
计到0x100是进入状态3;
计到0x0是进入状态4。
用VHDL这样描述可否:
process(rst,clk,req)
begin
if(rst = '1') then
cs <= "000";
elsif(posedge(clk)) then
case cs is
when "000" =>
if(req = '1') then -- startup
cntr <= 0x300;
---- and output
cs <= "001";
else
cntr <= 0x000;
cs <= "000";
end if;
when "001" =>
if(req = '1')
cntr <= cntr - 1;
if(cntr = 0x200) then
cs <= "010";
---- and output
else
cs <= "001";
end if;
end if;
when "010" =>
........
[ 本帖最后由 wusite 于 2006-10-18 10:15 编辑 ] |
|