回覆列表
  • 1 # nurfy31163

    library IEEE;use IEEE.std_logic_1164.all;entity encoder4_16 isport ( d: in STD_LOGIC_VECTOR (3downto0);q: out STD_LOGIC_VECTOR (15downto0));end encoder4_16;architecture encoder_if of encoder4_16 isbeginprocess(d)beginif d="0000" then q"1",others=>"0");elsifd="0001" then q"1",others=>"0");elsifd="0010" then q"1",others=>"0");……elsifd="1111" then q"1",others=>"0");else q"0");end if;end process;endencoderif;library ieee;use ieee.std_logic_1164.all;entity decoder4_16 isport(data:in std_logic_vector(3 downto 0);en :in std_logic;y:out std_logic_vector(15 downto 0));end entity decoder4_16;architecture arch1 of decoder4_16 is beginprocess(en,data)beginif en="1" thencase data is when "0000"=> y(15 downto 0) y(15 downto 0) y(15 downto 0) y(15 downto 0) y(15 downto 0) y(15 downto 0) y(15 downto 0) y(15 downto 0) y(15 downto 0) y(15 downto 0) y(15 downto 0) y(15 downto 0) y(15 downto 0) y(15 downto 0) y(15 downto 0) y(15 downto 0)y(15 downto 0)

  • 2 # 使用者8262151785062

    library IEEE;

    use IEEE.std_logic_1164.all;

    entity encoder4_16 is

    port ( d: in STD_LOGIC_VECTOR (3downto0);

    q: out STD_LOGIC_VECTOR (15downto0));

    end encoder4_16;

    architecture encoder_if of encoder4_16 is

    begin

    process(d)

    begin

    if d="0000" then q"1",others=>"0");

    elsifd="0001" then q"1",others=>"0");

    elsifd="0010" then q"1",others=>"0");

    ……

    elsifd="1111" then q"1",others=>"0");

    else q"0");

    end if;

    end process;

    endencoderif;

    library ieee;

    use ieee.std_logic_1164.all;

    entity decoder4_16 is

    port(data:in std_logic_vector(3 downto 0);

    en :in std_logic;

    y:out std_logic_vector(15 downto 0));

    end entity decoder4_16;

    architecture arch1 of decoder4_16 is

    begin

    process(en,data)

    begin

    if en="1" then

    case data is

    when "0000"=> y(15 downto 0)

    when "0001"=> y(15 downto 0)

    when "0010"=> y(15 downto 0)

    when "0011"=> y(15 downto 0)

    when "0100"=> y(15 downto 0)

    when "0101"=> y(15 downto 0)

    when "0110"=> y(15 downto 0)

    when "0111"=> y(15 downto 0)

    when "1000"=> y(15 downto 0)

    when "1001"=> y(15 downto 0)

    when "1010"=> y(15 downto 0)

    when "1011"=> y(15 downto 0)

    when "1100"=> y(15 downto 0)

    when "1101"=> y(15 downto 0)

    when "1110"=> y(15 downto 0)

    when "1111"=> y(15 downto 0)

    when others =>y(15 downto 0)

    end case;

    end if;

    end process;

    end architecture;

  • 中秋節和大豐收的關聯?
  • 心腦血管疾病患者飲食需注意哪些?