多路抢答器设计_eda课程设计(编辑修改稿)内容摘要:

位信号 rst;警报信号 tmp。 (二)计时模块 VHDL 源程序 library ieee。 use。 use。 entity js is port(clk,rst,s,stop:in std_logic。 warn:out std_logic。 ta,tb:buffer std_logic_vector(3 downto 0))。 end js。 architecture one of js is signal co:std_logic。 begin p1:process(clk,rst,s,stop,ta) begin 8 if rst=39。 039。 or stop=39。 139。 then ta=0000。 elsif clk39。 event and clk=39。 139。 then co=39。 039。 if s=39。 139。 then if ta=0000 then ta=1001。 co=39。 139。 else ta=ta1。 end if。 end if。 end if。 end process p1。 p2:process(co,rst,s,stop,tb) begin if rst=39。 039。 or stop=39。 139。 then tb=0010。 elsif co39。 event and co=39。 139。 then if s=39。 139。 then if tb=0000 then tb=0011。 else tb=tb1。 end if。 end if。 end if。 end process p2。 end one。 仿真图 9 计时模块图 在这个模块中主要实现抢答过程中的计时功能,在有抢答开始后进行 30 秒的倒计时,并且在 30 秒倒计时后无人抢答显示超时并报警。 其中有抢答时钟信号 clk2;系统复位信号 rst;抢答使能信号 s;抢答状态显示信号 states;无人抢答警报信号 warn;计时中止信号 stop;计时十位和个位信号 tb, ta。 (三)数据选择模块 VHDL 源程序 library ieee。 use。 use。 use。 entity sjxz is port (a,b,c: in std_logic_vector(3 downto 0)。 clk2,rst: in std_logic。 s: out std_logic_vector(1 downto 0)。 10 y: out std_logic_vector(3 downto 0) )。 end sjxz。 architecture body_chooser of sjxz is signal count: std_logic_vector (1 downto 0)。 begin s=count。 process(clk2,rst) begin if(rst=39。 039。 )then count=00。 elsif(clk239。 event and clk2=39。 139。 )then if(count=10)then count=00。 else count=count+1。 end if。 end if。 case count is when 00=y=a。 when 01=y=b。 when 10=y=c。 when others=null。 end case。 end PROCESS。 end body_chooser。 仿真图 11 数据选择模块图 在这个模块中主要实现抢答过程中的数据输入功能,输入信号 a[3..0]、 b[3..0]、 c[3..0];计数输出信号 s;数据输出信号 y;计数脉冲 clk2,实现 a、 b、 c 按脉冲轮流选通,在数码管上显示。 (四)报警模块 VHDL 源程序 LIBRARY IEEE。 USE。 USE。 ENTITY ALARM IS PORT(CLK,I:IN STD_LOGIC。 Q:OUT STD_LOGIC)。 END ALARM。 12 ARCHITECTURE BEHAVE OF ALARM IS SIGNAL WARN:STD_LOGIC。 SIGNAL N:INTEGER RANGE 0 TO 20。 BEGIN Q= WARN。 PROCESS(CLK) BEGIN IF CLK39。 EVENT AND CLK=39。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。