CS2300 Lab4
CS2300 Lab4
(CS2310)
Lab 4: Multiplexers and Demultiplexers
1 Designing a Multiplexer
Design a 16x1 MUX using 4x1 MUXes. The circuit and truth table for a 4x1
MUX is given below:
Write Verilog code that implements this 4x1 MUX and use it to create a
16x1 MUX that receives 16 inputs and a 4-bit select line to select one of the 16
inputs and redirect it to the output. The module signature should be:
module mux_16x1(output out, input [15:0] in, input [3:0]sel);
1
2 Designing a Demultiplexer
Design a 1x8 demultiplexer using 4x1 and 2x1 demultiplexers. The circuits and
truth tables for 1x2 and 1x4 DeMUXes are given below:
Write Verilog code that implements these 1x2 and 1x4 DeMUXes and use
these modules to create a 1x8 DeMUX that receives 1-bit input and a 3-bit
select line and produces an 8-bit output. The module signature should be:
module demux_1x8(output [7:0] out, input in, input [2:0] sel);
2
Figure 4: 7-segment display
You can implement the 7-segment decoder only for 2-bit inputs
(which maps to digits 0 to 3) in the lab. The implementation for
4-bit inputs (which maps to digits 0 to F) will be treated as a bonus.
Write a Verilog module that combines a 4x1 MUX and a 1x4 DeMUX along
with this binary-hexadecimal decoder module according to the block diagram
given below. This module’s inputs include four 2-bit (4-bit for bonus) data lines
(i.e., a[1:0], b[1:0], c[1:0], d[1:0]), 2-bit select line (i.e. sel[1:0]) to select from the
data for binary-hexadecimal decoder, and a 1-bit enable signal (i.e. en). The
module’s output includes one 7-bit data line for seven segments (i.e., y[6:0]) and
four 1-bit enable signals (i.e., en a, en b, en c, en d).
Note: You can use behavioral modeling for the 2-bit (4-bit for bonus)
3
MUX.
The MUX is just to select one of the 4 inputs for the 7-segment
decoder. The use of the MUX and DeMux would be relevant in a
bigger circuit (not presented here). Here, we will just focus on how
to assemble different modules together in a circuit.