|
|
1 -------------------------------------------------------
2 -- Design Name : decoder_using_with
3 -- File Name : decoder_using_with.vhd
4 -- Function : decoder using with-select
5 -- Coder : Deepak Kumar Tala (Verilog)
6 -- Translator : Alexander H Pham (VHDL)
7 -------------------------------------------------------
8 library ieee;
9 use ieee.std_logic_1164.all;
10
11 entity decoder_using_select is
12 port (
13 enable :in std_logic; -- Enable for the decoder
14 binary_in :in std_logic_vector (3 downto 0);-- 4-bit input
15 decoder_out :out std_logic_vector (15 downto 0)-- 16-bit output
16
17 );
18 end entity;
19
20 architecture behavior of decoder_using_select is
21
22 begin
23 with (binary_in) select
24 decoder_out <= X"0001" when X"0",
25 X"0002" when X"1",
26 X"0004" when X"2",
27 X"0008" when X"3",
28 X"0010" when X"4",
29 X"0020" when X"5",
30 X"0040" when X"6",
31 X"0080" when X"7",
32 X"0100" when X"8",
33 X"0200" when X"9",
34 X"0400" when X"A",
35 X"0800" when X"B",
36 X"1000" when X"C",
37 X"2000" when X"D",
38 X"4000" when X"E",
39 X"8000" when X"F",
40 X"0000" when others;
41
42 end architecture;
You could download file vhdl_examples here
|