集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 1790|回复: 1

请求高手援助,

[复制链接]
jcyydys 发表于 2013-2-24 23:17:43 | 显示全部楼层 |阅读模式
源程序:library ieee;
use ieee.std_logic_1164.all;
package state_pack is
type state is(qa,qb);
end state_pack;
library ieee;
use ieee.std_logic_1164.all;
use work.state_pack.all;
entity zhukong is
port(start,clk,t:in std_logic;
      d,b:in integer range 0 to 13;
en1,en2, reset, clr,en3ut std_logic;
cut integer range 0 to 13;
diut integer range 0 to 9);
end zhukong;       
architecture a of zhukong is
signal current_state:state:=qa;
begin
process
variable var:integer range 0 to 13;
begin
wait until clk='1' and clk'event;
if start='1' then
current_state<=qa;
c<=b; en1<='0'; reset<='1';en2<='0';clr<='1';en3<='0';di<=0;
else
case current_state is
when  qa=> if d=0 then
current_state<=qa; en1<='0';en2<='1';clr<='0';c<=0;reset<='0';di<=0;
else  current_state<=qb; var:=d; en2<='0';
此段程序为售货机在初始状态时的信号输出,当d输入信号时进入对比程序。
current_state<=qa; en1<='0';en2<='1';clr<='0';c<=0;reset<='0';di<=0;
else  current_state<=qb; var:=d; en2<='0';
end if;
when qb=>
if t='0'and var<=b then
current_state<=qa;en1<='0';c<=b-var;clr<='1';reset<='1';en3<='1';di<=b-var;
elsif t='0' and b<var then
en1<='1'; c<=0 ; clr<='0'; reset<='0';en3<='0';di<=0;
elsif t='1'and b<var then
current_state<=qa;en1<='0';c<=b;clr<='1';reset<='1';en3<='0';di<=0;
elsif t='1' and b>=var then
current_state<=qa;en1<='0'; c<=b-var;clr<='1';reset<='1';en3<='1';di<=b-var;
end if;
end case;
end if;
end process;
end a;
大家看看那里出问题
fpga_feixiang 发表于 2022-5-24 20:49:46 | 显示全部楼层
6666666666666666
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2024-12-24 02:57 , Processed in 0.058782 second(s), 24 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表