decoders
are used to decode the position of the output line: to each input code
corresponds one output line
truth table
for an 2-4 binary decoder:
inputs (a)
a1 a0 |
outputs(x)
=> x3 x2 x1 x0 |
0..0
0..1 1..0 1..1 |
=> 0..0..0..1
=> 0..0..1..0 => 0..1..0..0 => 1..0..0..0 |
library IEEE;
use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; entity dec_2to4 is
|
architecture
process_dec_1 of
dec_2to4 is
begin process(a) variable int_a: integer range 0 to 3; begin
when 1 => x <= "0010"; when 2 => x <= "0100"; when 3 => x <= "1000"; end process_dec_1; |
architecture
process_dec_2 of
dec_2to4 is
begin process(a) variable int_a: integer range 0 to 3; begin
for i in 0 to 3 loop
else x(i) <= '0'; end process_dec_2; |
architecture
flow_dec_1 of
dec_2to4 is
signal int_a: integer range 0 to 3; begin
"0100" when 2, "1000" when 3, "0000" when others; |
Exercise: