12-to-4 Multiplexer
Design Specifications
The following figure shows the block diagram for this design. The multiplexer
selects one set of inputs and routes that set to the output. The inputs are
a0-a3, b0-b3, and c0-c3. The outputs are y0-y3.
The select lines, s0 and s1, control the decoding that determines which set is
routed to the output.
Design Method
The following figure shows the same multiplexer after sets have been used to
group the signals. All of the inputs have been grouped into the sets a, b, and
c. The outputs are grouped into set y and the select lines are grouped into set
select. The grouping of signals into sets takes place in the declaration
section of the source file.
When the sets have been declared, specification of the design is made with the
following four equations:
In the first equation, this expression is then ANDed with the set a which
contains the four bits, a0-a3, and could be written as:
The other product terms in the equation work in the same manner. Because
select takes only one value at a time, only one of the product terms pass the value
of an input set along to the output set. The others contribute 0 bits to the OR
gates.
Test Vectors
The test vectors for this design are specified in terms of the input, output,
and select sets. Note that the values for a set can be specified by decimal
numbers and by other sets. The constants H and L, used in the test vectors, were
declared as four bit sets containing all ones or all zeros.
12-to-4 Multiplexer Source File
title `12 to 4 multiplexer`
a0..a3 pin;
b0..b3 pin;
c0..c3 pin;
s1,s0 pin;
y0..3 pin;
H = [1,1,1,1];
L = [0,0,0,0];
select = .X. ;
y = [y3..y0];
a = [a3..a0];
b = [b3..b0];
c = [c3..c0];
equations
when (select == 0) then y = a;
when (select == 1) then y = b;
when (select == 2) then y = c;
when (select == 3) then y = c;
test_vectors ([select, a, b, c] -> y)
[ 0 , 1, X, X] -> 1;
[ 0 ,10, H, L] -> 10;
[ 0 , 5, H, L] -> 5;
[ 1 , H, 3, H] -> 3;
[ 1 ,10, 7, H] -> 7;
[ 1 , L,15, L] -> 15;
[ 2 , L, L, 8] -> 8;
[ 2 , H, H, 9] -> 9;
[ 2 , L, L, 1] -> 1;
[ 3 , H, H, 0] -> 0;
[ 3 , L, L, 9] -> 9;
[ 3 , H, L, 0] -> 0;
end
when (select == 1) then y = b;
when (select == 2) then y = c;
when (select == 3) then y = c;