# FPGA Lab 01: Switches, LEDs, and Multiplexers

## Objectives

The purpose of this exercise is to learn how to connect simple input and output devices to an FPGA chip and implement a circuit that uses these devices. We will use the switches on the DE10-Lite board as inputs to the circuit. We will use light-emitting diodes (LEDs) as output devices.

## Background Information

### DE10-Lite FPGA Board Switches and LEDs

The Intel DE10-Lite FPGA board has ten switches and LEDs. The connections between the switches and LEDs are shown in the following Figures:  Figure 1: The Connections of Switches and LEDs on the DE10-Lite FPGA Board

### Multiplexers (MUX)

In digital circuits, a multiplexer (or MUX) is a device that selects one of several digital input signals and forwards the selected input into a single line. A multiplexer of 2n inputs has n select lines, which are used to select which input line to send to the output.

• A 2n-to-1 multiplexer sends one of the 2n input lines to a single output line.
• A multiplexer has two sets of inputs:
• 2n data input lines
• n select lines to pick one of the 2n data inputs
• The mux output is a single bit, which is one of the 2n data inputs.

#### 2-to-1 1-bit MUX

Figure 2 (b) shows a sum-of-products circuit that implements a 2-to-1 multiplexer with a select input s. If s = 0, the output of the multiplexer (out) is equal to the input in0; if s = 1, the output is equal to in1. Part (a) of the figure gives a function table for this multiplexer, and part (c) shows its circuit symbol. Figure 2: A 2-to-1 Multiplexer

#### 2-to-1 4-bit MUX

Write a Verilog module with four assignment statements like the one shown above to describe the circuit given in Figure 3 (a). This circuit has two four-bit inputs, In0 and In1, and produces the four-bit output Out. If S = 0 then Out = In0, while if S = 1 then Out = In1. We refer to this circuit as a four-bit wide 2-to-1 multiplexer, and its circuit symbol shows in Figure 3(b), in which In0, In1, and Out depict as four-bit wires. Figure 3: A four-bit wide 2-to-1 Multiplexer

#### 4-to1 1-bit MUX

A 4-to-1 MUX takes four inputs and directs a single selected input to output. A 2-bits selection input controls the selection of input. The characteristic table of 4-to-1 MUX is shown below: Select LinesOutput
S1 S0 Out
0 0 In0
0 1 In1
1 0 In2
1 1 In3

Figure 4: A 4-to-1 Multiplexer

The logic schematic diagram of 4-to-1 MUX is shown in the following Figure: Figure 5: 4-to-1 1-bit MUX Logic Circuit