真值表:
EN | X3 | X2 | X1 | X0 | EF | Y1 | Y0 |
0 | X | X | X | X | 1 | 0 | 0 |
1 | 1 | X | X | X | 0 | 1 | 1 |
1 | 0 | 1 | X | X | 0 | 1 | 0 |
1 | 0 | 0 | 1 | X | 0 | 0 | 1 |
1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
VHDL程序:
library ieee;
use ieee.std_logic_1164.all;
entity encode 4_2 is
port(input:in std_logic_vector(3 downtown 0);
en:in std_logic;
ef:out std_logic;
output:out std_logic_vector(1