8 to 1 Multiplexer Verilog HDL Code
Advertisement
This page provides the Verilog HDL code for an 8-to-1 Multiplexer.
Symbol
Below is the symbol of the 8-to-1 Multiplexer.

Truth Table
Here’s the truth table for the 8-to-1 Multiplexer:
| Sel2 | Sel1 | Sel0 | Z |
|---|---|---|---|
| 0 | 0 | 0 | A |
| 0 | 0 | 1 | B |
| 0 | 1 | 0 | C |
| 0 | 1 | 1 | D |
| 1 | 0 | 0 | E |
| 1 | 0 | 1 | F |
| 1 | 1 | 0 | G |
| 1 | 1 | 1 | H |
Verilog Code
module mux8_1 (
input [7:0] I,
input [2:0] S,
input en,
output reg y
);
always @(en, S, I, y)
begin
if (en == 1)
begin
if (S == 3'b000)
y = I[0];
else if (S == 3'b001)
y = I[1];
else if (S == 3'b010)
y = I[2];
else if (S == 3'b011)
y = I[3];
else if (S == 3'b100)
y = I[4];
else if (S == 3'b101)
y = I[5];
else if (S == 3'b110)
y = I[6];
else if (S == 3'b111)
y = I[7];
end
else
y = 0;
end
endmodule
Simulation Result
Here’s a simulation result image showing the behavior of the 8-to-1 Multiplexer:

Explore Verilog Logic Gates, Mux & Encoders
- Verilog HDL Code for All Logic Gates
- 2-to-4 Decoder (Verilog HDL Code)
- 4-to-1 Multiplexer and 1-to-4 Demultiplexer (Verilog Code)
- Verilog Code: 1-to-4 Demultiplexer
- 8-to-1 Multiplexer (Verilog HDL Code)
- 8-to-3 Encoder Without Priority (Verilog)
- 8-to-3 Priority Encoder (Verilog)
- 8-to-3 Priority Encoder (Verilog Code)
- 1-Bit and 4-Bit Comparator Design (Verilog)
Explore Verilog Flip-Flops, Counters & Registers
- T, D, SR, JK Flip Flop (Verilog HDL Code)
- D Flip Flop Synchronous Reset (Verilog)
- D Flip Flop Without Reset (Verilog)
- Verilog Code for Binary Up-Down Counter
- Verilog HDL: BCD & Gray Counters
- 4-bit Down Counter (Verilog Code Test Bench)
- 4-bit Binary Asynchronous Reset Counter (Verilog)
- 4-bit Binary Synchronous Reset Counter (Verilog)
- 4-bit BCD Asynchronous Reset Counter (Verilog)
- 4-bit BCD Synchronous Reset Counter (Verilog Code)
- 4-bit Mod-13 Counter (Verilog Code Test Bench)
- Shift Left / Shift Right Register (Verilog)
- Parallel Load Shift Left Register (Verilog Code)
- PRBS Generator (Verilog Code Test Bench)
Explore Verilog Math, Processing & Memory
- Full Adder (Verilog HDL Code)
- Verilog Code: Half Adder, Half Subtractor, Full Subtractor
- 32-Bit ALU (Verilog Code)
- RAM / ROM (Verilog Code)
- Asynchronous FIFO (Verilog Code Test Bench)
- Asynchronous FIFO Design (Verilog Code and Explanation)
- Mealy / Moore Machine (Verilog)
- Low Pass FIR Filter (Verilog Code)
- 4-bit Binary to Gray Counter Converter in Verilog
