来一个vhdl具体的实例
时间: 2024-02-20 21:00:43 浏览: 20
好的,这里给您提供一个简单的 VHDL 实例,实现一个 2-4 译码器:
```
entity decoder_2_4 is
port (
input: in std_logic_vector(1 downto 0);
output: out std_logic_vector(3 downto 0)
);
end entity;
architecture behavioral of decoder_2_4 is
begin
process(input)
begin
case input is
when "00" =>
output <= "0001";
when "01" =>
output <= "0010";
when "10" =>
output <= "0100";
when "11" =>
output <= "1000";
when others =>
output <= "0000";
end case;
end process;
end architecture;
```
这个实例中定义了一个名为 decoder_2_4 的实体,有两个端口,一个输入端口 input 和一个输出端口 output。在体架构 behavioral 中,我们使用 process 和 case 语句来实现译码器的功能。根据输入信号 input 的不同取值,分别输出对应的控制信号。