分别使用Process语句、when-else语句和case-when语句完成3-8译码器的设计。
本人初学,希望大家帮我看下,我写的程序- Library ieee
- Use ieee.std_logic_1164.all
- Entity decoder3_8 is
- Port( a,b,c:in std_logic;
- y:out std logic_vector(7 down to 0);
- );
- Architecture art of decoder3_8 is
- Signal s:std_logic_vector(2 down to 0);
- S<=a&b&c;
- Begin
- Process(a,b,c) is
-
- Begin
- If s=”000 “ then
- y<=”00000001”;
- Elseif s=”001” then
- Y<=”00000010”;
- Elseif s=”010” then
- Y<=”00000100”;
- Elseif s=”011” then
- Y<=”00001000”;
- Elseif s=”100” then
- Y<=”00010000”;
-
- Elseif s=”101” then
- Y<=”00100000”;
- Elseif s=”110” then
- Y<=”01000000”;
- Elseif s=”111” then
- Y<=”10000000”;
- Else
- Y=”00000000”;
- End if;
- End process;
- End architecture art ;
- //
- Library ieee
- Use ieee.std_logic_1164.all
- Entity decoder3_8 is
- Port( a,b,c:in std_logic;
- y:out std logic_vector(7 down to 0);
- );
- Architecture art of decoder3_8 is
- Signal s:std_logic_vector(2 down to 0);
- S<=a&b&c;
- Begin
- Y(7 down to 0)<=”00000001” When s=”001” else
- ”00000010” When s=”001” else
- ”00000100” When s=”001” else
- ”00001000” When s=”001” else
- ”00010000” When s=”001” else
- ”00100000” When s=”001” else
- ”0100000” When s=”001” else
- ”10000000” When s=”001” else
- “00000000”;
- End architecture art;
- // Library ieee
- Use ieee.std_logic_1164.all
- Entity decoder3_8 is
- Port( a,b,c:in std_logic;
- y:out std logic_vector(7 down to 0);
- );
- Architecture art of decoder3_8 is
- Signal s:std_logic_vector(2 down to 0);
- S<=a&b&c;
- Case s is
- When "000"=> y<="00000001";
- When "001"=> y<="00000010";
- When "010"=> y<="00000100";
- When "011"=> y<="00001000";
- When "100"=> y<="00010000";
- When "101"=> y<="00100000";
- When "110"=> y<="01000000";
- When "111"=> y<="10000000";
- When others=> y<="00000000";
- End case;
- End architecture art ;
复制代码
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>