- 2076 Baisakh · 2+6 marks
Use of VHDL; decoder design
Short answer
VHDL describes digital hardware for simulation, synthesis to FPGA/ASIC, and hardware/software co-design; it creates custom peripherals and parallel processors. A 3-to-8 decoder with enable has inputs en and a(2:0), output y(7:0); behavioral VHDL uses a process with case statement to set one-hot y when en='1', else all zeros.
What is the use of VHDL code in embedded system? Design and write a code for Decoder using VHDL.
Use of VHDL in embedded systems
VHDL (VHSIC Hardware Description Language) describes the structure and behaviour of digital hardware as text. In embedded systems it is used to:
- design custom single-purpose processors and peripherals (UART, timer, PWM, display controller) to run in parallel with the CPU;
- program FPGAs/CPLDs, or generate the layout of ASICs after synthesis;
- simulate and test the design before building hardware (test benches);
- reuse, document and port designs between devices and vendors;
- build hardware/software co-designs (soft-core processors with custom accelerators).
3-to-8 decoder
A decoder with enable has 3 input lines a(2:0) and 8 outputs y(7:0); when en = 1 exactly one output, selected by the binary value of a, is high.
| en | a2 a1 a0 | y7 ... y0 |
|---|---|---|
| 0 | x x x | 00000000 |
| 1 | 0 0 0 | 00000001 |
| 1 | 0 0 1 | 00000010 |
| 1 | 0 1 0 | 00000100 |
| 1 | 0 1 1 | 00001000 |
| 1 | 1 0 0 | 00010000 |
| 1 | 1 0 1 | 00100000 |
| 1 | 1 1 0 | 01000000 |
| 1 | 1 1 1 | 10000000 |
library ieee;
use ieee.std_logic_1164.all;
entity decoder3to8 is
port (
en : in std_logic; -- enable
a : in std_logic_vector(2 downto 0); -- binary input
y : out std_logic_vector(7 downto 0) -- one-hot output
);
end entity decoder3to8;
architecture behavioral of decoder3to8 is
begin
process (en, a)
begin
y <= (others => '0'); -- default: all outputs low
if en = '1' then
case a is
when "000" => y <= "00000001";
when "001" => y <= "00000010";
when "010" => y <= "00000100";
when "011" => y <= "00001000";
when "100" => y <= "00010000";
when "101" => y <= "00100000";
when "110" => y <= "01000000";
when "111" => y <= "10000000";
when others => y <= (others => '0');
end case;
end if;
end process;
end architecture behavioral;
The code was analysed and simulated with GHDL; for all 8 input values the correct one-hot output appears, and with en = 0 all outputs are 0.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Design metrics of embedded system · Embedded System, chapter 1 · asked 3×
- VHDL architectures; elevator controller · Embedded System, chapter 9
- GCD processor algorithm and VHDL · Embedded System, chapter 9 · asked 3×
- LCM processor algorithm and VHDL · Embedded System, chapter 9 · asked 2×
- VHDL entity, architecture; D flip-flop · Embedded System, chapter 9
- VHDL dataflow/behavioural models; JK flip-flop · Embedded System, chapter 9
- KUKL customer system design and code · Object Oriented Analysis and Design, chapter 4
- Design a (6,3) block code word · Data Communication, chapter 8 · asked 3×
- Development process and mapping design to code · Object Oriented Analysis and Design, chapter 4
- Design a C(8,4) linear block code · Data Communication, chapter 8