【正文】
到軟件中的 File中 ” BlockDiagram/Schematic File” ,又去查英語字典,原來要先建立空白的原理圖再到工程中添加已生成的模塊圖,覺的書本寫的很簡潔,但 實際操作起來卻是另外一種感覺,真是“紙上得到終覺淺, 絕 知此事要躬行” 這句話的含義。 u2:js port map(clk,rst,s,stop,warn=n,ta=ta_out,tb=tb_out)。 begin a=ledout(6)。 dout7: out std_logic_vector (6 downto 0))。 ta,tb:buffer std_logic_vector(3 downto 0))。 end qiangdaqi。 (七)頂層文件 VHDL 源程序 library ieee。139。 ELSE Count = count +1。 ENTITY clkdiv IS PORT(clk2 : IN STD_LOGIC。 END CASE。 2 WHEN 0011=DOUT7=1111001。 USE 。 ELSE WARN =39。 THEN IF I=39。 Q:OUT STD_LOGIC)。 end case。)then if(count=10)then count=00。 architecture body_chooser of sjxz is signal count: std_logic_vector (1 downto 0)。 use 。 end if。 then tb=0010。 end if。 then co=39。 begin p1:process(clk,rst,s,stop,ta) begin 8 if rst=39。 (二)計時模塊 VHDL 源程序 library ieee。 elsif (st=0010) then states=0010。 ) then st(3)=39。 or st(3)=39。139。 end if 。)and not( st(0)=39。139。139。039。 use 。 3 搶答器的設(shè)計分析 按照要求,我們可以將整個系統(tǒng)分為四個主要模塊:搶答鑒別模塊;搶答計時模塊;搶答計分模塊;譯碼顯示模塊。其中有四個搶答信號 s0、 s ss3;搶答使能信號 s;搶答狀態(tài)顯示信號 states; 搶答與 警報時鐘信號 clk2;系統(tǒng)復(fù)位信號 rst;警報信號 tmp。 數(shù)據(jù)選擇模塊: 在這個模塊中主要實現(xiàn)搶答過程中的數(shù)據(jù)輸入功能, 輸入信號 a[3..0]、 b[3..0]、c[3..0];計數(shù)輸出信號 s;數(shù)據(jù)輸出信號 y; 計數(shù)脈沖 clk2,實現(xiàn) a、 b、 c 按脈沖輪流選通,在數(shù)碼管上顯示。整個系統(tǒng)的大致組成框圖如圖 所示。 states:buffer std_logic_vector(3 downto 0)。st=0000。)and not( st(1)=39。 end if 。139。 or st(2)=39。 ) then st(2)=39。139。 tmp=s0 or s1 or s2 or s3。 end if。 entity js is port(clk,rst,s,stop:in std_logic。139。139。 end process p1。139。 end process p2。 entity sjxz is port (a,b,c: in std_logic_vector(3 downto 0)。039。 end if。 仿真圖 11 數(shù)據(jù)選擇模塊圖 在這個模塊中主要實現(xiàn)搶答過程中的數(shù)據(jù)輸入功能,輸入信號 a[3..0]、 b[3..0]、 c[3..0];計數(shù)輸出信號 s;數(shù)據(jù)輸出信號 y;計數(shù)脈沖 clk2,實現(xiàn) a、 b、 c 按脈沖輪流選通,在數(shù)碼管上顯示。 SIGNAL N:INTEGER RANGE 0 TO 20。039。 END IF。 DOUT7: OUT STD_LOGIC_VECTOR(6 DOWNTO 0))。 5 14 WHEN 0110=DOUT7=1011111。 仿真圖 譯碼模塊圖 在這個模塊中主要實現(xiàn)搶答過程中將 BCD 碼轉(zhuǎn)換成 7 段的功能。 ARCHITECTURE rtl OF clkdiv IS SIGNAL count : STD_LOGIC_VECTOR(3 DOWNTO 0)。 END PROCESS。 END IF 。 use 。 17 tmp:out std_logic。 s:out std_logic_vector(1 downto 0)。 q:out std_logic)。d=ledout(3)。 u5:alarm port map(clk2,s,q_ou