LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY QIANGDAQI IS PORT(CLK,CLK2,S0,S1,S2,S3,S4,S5,S6,STOP,RST:IN STD_LOGIC; N,K,Q_OUT:OUT STD_LOGIC; M:OUT STD_LOGIC_VECTOR(1 DOWNTO 0); A,B,C,D,E,F,G:OUT STD_LOGIC); END QIANGDAQI; ARCHITECTURE BHV OF QIANGDAQI IS COMPONENT QDJB IS PORT(CLK2,RST:IN STD_LOGIC; S0,S1,S2,S3,S4,S5:IN STD_LOGIC; TMP:OUT STD_LOGIC; STATES:OUT STD_LOGIC_VECTOR(5 DOWNTO 0)); END COMPONENT; COMPONENT JFQ IS PORT( CLK,RST,STOP,S:IN STD_LOGIC; WARN:OUT STD_LOGIC; TA,TB:BUFFER STD_LOGIC_VECTOR(5 DOWNTO 0)); END COMPONENT; COMPONENT SJXZ IS PORT(CLK2,RST:IN STD_LOGIC; S:in STD_LOGIC_VECTOR(1 DOWNTO 0); A,B,C:IN STD_LOGIC_VECTOR(3 DOWNTO 0); Y:OUT STD_LOGIC_VECTOR(3 DOWNTO 0)); END COMPONENT; COMPONENT YMQ IS PORT(AIN4: IN STD_LOGIC_VECTOR (3 DOWNTO 0); DOUT7: OUT STD_LOGIC_VECTOR (6 DOWNTO 0)); END COMPONENT; COMPONENT ALARM IS PORT(CLK,I:IN STD_LOGIC; Q:OUT STD_LOGIC); END COMPONENT; SIGNAL STATES_OUT,TA_OUT,TB_OUT,Y_OUT:Std_LOGIC_VECTOR(6 downto 0); SIGNAL LEDOUT:STD_LOGIC_VECTOR(6 DOWNTO 0); SIGNAL S:STD_LOGIC_VECTOR(1 DOWNTO 0); BEGIN A<=LEDOUT(6); B<=LEDOUT(5); C<=LEDOUT(4); D<=LEDOUT(3); E<=LEDOUT(2); F<=LEDOUT(1); G<=LEDOUT(0); U1:QDJB PORT MAP(CLK2,RST,S0,S1,S2,S3,S4,S5,TMP=>K,STATES=>STATES_OUT); U2:JFQ PORT MAP(CLK,RST,S,STOP,WARN=>N,TA=>TA_OUT,TB=>TB_OUT); U3:SJXZ PORT MAP(CLK2=>CLK2,RST=>RST,S=>S,A=>STATES_OUT,B=>TA_OUT, C=>TB_OUT,Y=>Y_OUT); U4:YMQ PORT MAP(AIN4=>Y_OUT,DOUT7=>LEDOUT); U5:ALARM PORT MAP(CLK,I,Q_OUT); END BHV;
时间: 2024-03-15 16:42:56 浏览: 13
PID.rar_PID控制IEEE文章_VHDL PID_logic_pid vhdl
这是一个 VHDL 代码,描述了一个六路抢答器的实现。它包括多个组件,如 QDJB、JFQ、SJXZ、YMQ 和 ALARM,它们分别实现了不同的功能。其中 QDJB 组件负责状态机的实现,JFQ 组件负责计时器的实现,SJXZ 组件负责输入输出的逻辑,YMQ 组件负责将输出转换为七段数码管的显示,ALARM 组件负责控制蜂鸣器的响声。整个抢答器的操作流程由这些组件协同完成。
阅读全文