. Process(clk,rst) Begin
If rst=’0’ then
Count<=(others=>’0’) ; If en=’1’ then
When ‘1’ => count<=count+1; When others =>count<=count-1;
Elsif rising_edge(clk) then
Case up is
End case;
End if;
End if;
End process;
Sum<=count;
Cout <=’1’ when en=’1’ and ((up=’1’ and count=7) or (up=’0’ and count=0)) else
‘0’; End a; 2.仔细阅读下列程序,回答问题
LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; ENTITY LED7SEG IS PORT ( A : IN STD_LOGIC_VECTOR(3 DOWNTO 0); CLK : IN STD_LOGIC; LED7S : OUT STD_LOGIC_VECTOR(6 DOWNTO 0)); END LED7SEG; ARCHITECTURE one OF LED7SEG IS SIGNAL TMP : STD_LOGIC; BEGIN SYNC : PROCESS(CLK, A) BEGIN IF CLK'EVENT AND CLK = '1' THEN TMP <= A; END IF; END PROCESS; OUTLED : PROCESS(TMP) BEGIN CASE TMP IS WHEN \
-- 1
-- 2 -- 3 -- 4 -- 5 -- 6 -- 7 -- 8 -- 9 -- 10 -- 11 -- 12 -- 13 -- 14 -- 15 -- 16 -- 17 -- 18 -- 19 -- 20
11 / 12
. WHEN \ WHEN \ WHEN \ WHEN \ WHEN \ WHEN \ WHEN \ WHEN \ WHEN \ END CASE; END PROCESS; END one; 1)在程序中存在两处错误,试指出,并说明理由: 2)修改相应行的程序:
错误1 行号: 程序改为:
错误2 行号: 程序改为: 12 / 12
-- 21 -- 22 -- 23 -- 24 -- 25 -- 26 -- 27 -- 28 -- 29 -- 30 -- 31 -- 32
(
(