130 likes | 412 Views
Decoders. Discussion D9.5 Example 25. Decoders. 3-to-8 Decoder. decoder38.vhd. library IEEE; use IEEE.STD_LOGIC_1164. all ; use IEEE.STD_LOGIC_unsigned. all ; entity decoder38 is port ( a : in STD_LOGIC_VECTOR(2 downto 0); y : out STD_LOGIC_VECTOR(0 to 7) );
E N D
Decoders Discussion D9.5 Example 25
3-to-8 Decoder decoder38.vhd library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.STD_LOGIC_unsigned.all; entity decoder38 is port( a : in STD_LOGIC_VECTOR(2 downto 0); y : out STD_LOGIC_VECTOR(0 to 7) ); end decoder38;
architecture decoder38 of decoder38 is begin process(a) variable j: integer; begin j := conv_integer(a); for i in 0 to 7 loop if(i = j) then y(i) <= '1'; else y(i) <= '0'; end if; end loop; end process; end decoder38;
1 16 1G Vcc 2 15 1A 2G 3 14 2A 1B 4 13 1Y0 2B 5 12 1Y1 2Y0 6 11 1Y2 2Y1 7 10 1Y3 2Y2 8 9 GND 2Y3 74LS139 TTL Decoders B A Y0 Y1 Y2 Y3 G 1 X X 1 1 1 1 0 0 0 0 1 1 1 0 0 1 1 0 1 1 0 1 0 1 1 0 1 0 1 1 1 1 1 0 Dual 2-4 Decoder
1 16 A Vcc 2 15 B Y0 3 14 C Y1 4 13 !G2A Y2 5 12 !G2B Y3 6 11 G1 Y4 7 10 Y7 Y5 8 9 GND Y6 74LS138 TTL Decoders G1 G2 C B A Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 X 1 X X X 1 1 1 1 1 1 1 1 0 X X X X 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 0 1 1 1 1 0 1 1 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 G2 = G2A # G2B 3-to-8 Decoder X = don't care