- 2072 Magh · 2+6 marks
Behavioral modeling; 2-input multiplexer
Short answer
Behavioral modeling describes function with a process and sequential statements, not gates. A 2-to-1 multiplexer: process(d0,d1,sel) checks sel; if sel='0' then y<=d0 else y<=d1.
What is behavioral modeling? Write VHDL code for 2-input multiplexer.
Behavioral modeling
Behavioral modeling describes the circuit by its function or algorithm, using a process with sequential statements (if, case, loop), without stating gates or connections. The designer writes what output should result for given inputs and the synthesis tool decides the structure. It is closest to high-level programming, quick to write and good for sequential circuits and FSMs.
2-input (2:1) multiplexer
A 2-to-1 multiplexer selects one of two data inputs d0, d1 using the select line sel: y = d0 when sel = 0 and y = d1 when sel = 1.
| sel | y |
|---|---|
| 0 | d0 |
| 1 | d1 |
library ieee;
use ieee.std_logic_1164.all;
entity mux2 is
port (
d0, d1 : in std_logic; -- data inputs
sel : in std_logic; -- select line
y : out std_logic -- output
);
end entity mux2;
architecture behavioral of mux2 is
begin
process (d0, d1, sel)
begin
if sel = '0' then
y <= d0;
else
y <= d1;
end if;
end process;
end architecture behavioral;
The process is sensitive to d0, d1 and sel, so y updates whenever any input changes. The code was analysed and simulated with GHDL.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- VHDL entity declaration; T flip-flops circuit · 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×
- Use of VHDL; decoder design · Embedded System, chapter 9
- VHDL architectures; elevator controller · Embedded System, chapter 9
- VHDL entity, architecture; D flip-flop · Embedded System, chapter 9
- Convolutional encoder c(3,1,3), input 00110 · Data Communication, chapter 8
- Convolutional encoder c(3,1,3), input 111011 · Data Communication, chapter 8
- TTL voltage profile and noise margin; Gray code · Digital Logic, chapter 10