Lab 08
Lab 08
Lab 09
Implementation of Multiplexer / Demultiplexer , Data flow
Level Programming in Verilog
OBJECTIVES
COMPONENTS REQUIRED
INTRODUCTION
Multiplexer:
Multiplexer (MUX), sometimes called data selector is a combinational logic circuit that selects
on of 2n inputs and route it to the output. Multiplexer means transmitting large number of
information units over smaller number of channels or lines. In a digital Multiplexer, the selection
of a particular line from 2 n inputs is controlled by n select lines of multiplexer. Fig shows the
block diagram and truth table for a 4x1 MUX.
1|P ag e
Digital Logic Design By Alishba Azam Malik
Large Multiplexers can be implemented using smaller blocks of multiplexors. For example,
consider an 8x1 MUX, this can be implemented using 2 4x1 MUXES and 1 2x1 MUX as shown
in figure.
2|P ag e
Digital Logic Design By Alishba Azam Malik
Demultiplexer:
The Demultiplexer is combinational logic circuit that performs the reverse operation of
Multiplexer. It has only one input line and select lines. For n select lines, it has 2 n output lines.
Select lines rout the input to the output line. By applying logic 1 to the input, circuits act like
typical decoder. Block diagram of 1x4 Demultiplexer and its truth table is shown in figure.
3|P ag e
Digital Logic Design By Alishba Azam Malik
Dataflow modeling describes hardware in terms of the flow of data from input to output.The
dataflow modeling style is mainly used to describe combinational circuits. For example, to
describe an AND gate using dataflow, the code will look something like this:
4|P ag e
Digital Logic Design By Alishba Azam Malik
In the above code, we executed the functionality of the AND gate with the help of the AND (&)
operator. That is what dataflow modeling is about. It utilizes operators that act on operands
and gives the desired relationship between output and input.
Nets:
Continuous Assignment
The continuous assignment statement is the main construct of dataflow modeling and is used
to drive (assign) value to the net. It starts with the keyword assign.
There are some characteristics we should keep in mind while we use dataflow modeling. They
are:
Continuous assignments are always active. That is the LHS net value changes as soon as
the value of any operand in the RHS changes.
The LHS of an assignment should be either scalar or vector nets or a concatenation of
both. Registers are not applicable on the LHS.
The RHS of the assignment can be register, net, or function calls of scalar or vector type.
Delays can be specified.
We assign a delay value in the continuous assignment statement. The delay value is specified
after the keyword assign. For example,
assign #10 out = a & b;
To get a clear understanding of how it works, let’s see how the simulated waveform looks like
for the following code:
module and_gate(a,b,out)
input a,b;
output out;
5|P ag e
Digital Logic Design By Alishba Azam Malik
endmodule
Simulation Waveform
1. a and b goes low at 5 ns, out goes low 10 time units later. That is 15 ns.
2. a and b is high at 20 ns, out goes high 10 time units later. That is 30 ns
3. a goes low at 40 ns, out goes low 10 time units later. That is 50 ns.
4. a goes high at 65 ns but becomes low at 70 ns. Therefore, at the time of re-computation
(i.e., 75 ns), a and b are low, out will be low. Thus, a pulse of width less than the
specified delay is not propagated to the output. This property is called inertial delay.
input d,
input s0,
input s1,
output y0,
output y1,
output y2,
output y3
);
6|P ag e
Digital Logic Design By Alishba Azam Malik
endmodule
initial begin
// Initialize Inputs
d = 1;
s0 = 0;
s1 = 0;
#100;
end
7|P ag e
Digital Logic Design By Alishba Azam Malik
Review Questions:
8|P ag e