Multiplexers

A 2x1 MPX

An MxN multiplexer (MPX) has 2N M-bit inputs: data0, data1, ... an N-bit input called control, and an M-bit output called result.

The value of result is datacontrol.

Build and test a 1x1 multiplexer.

A Simple 4-bit ALU

In this lab we build an ALU capable of adding, subtracting, multiplying, and dividing two 4-bit arguments. The answer is 4-bits, the status (carry out, remainder, borrow in) is also 4 bits. A control input connected to two multiplexers determines which operation is routed to the output pins.

Definitions

The 4-bit ALU has three inputs:

arg1 (4 bits)

arg2 (4 bits)

control (2 bits)

The 4-bit ALU has two outputs:

result (4 bits)

status (4 bits)

Here is how it is defined:

control     result      status
00       arg1 + arg2      cout
01       arg1 – arg2      bout
10       arg1 * arg2      cout (this can be 4-bits)
11       arg1/arg2        rem (this can be 3-bits)

Steps

Load the built-in Arithmetic and Plexers libraries.

Create to 4-bit inputs called arg1 and arg2

Create a 2-bit input called control

Create a 4-bit output called result.

Create a 4-bit output called status.

Add a 4-bit adder, subtractor, multiplier, and divider to your circuit.

Use a bus architecture to connect arg1 to the first input of each arithmetic component and arg2 to the second.

Add two 2x4 multiplexers to your circuit. The control input should be connected to select input of each.

The output of the first multiplexer is connected to result, the second goes to status.

The output of each arithmetic unit should be connected to one input for the first multiplexer.

The cout/remainder/bout output of each arithmetic circuit should be connected to the input pins of the second multiplexer. In the case of the 1-bit outputs of the adder and subtractor, you will have to use a splitter with constant 0 values on the other 3 branches: