1. Objectives
-
Learn more about sequential circuits.
-
Find the proper library components for the design of a simple 4x4 multiplier circuit.
-
Implement and verify the operation of the multiplier circuit.
-
Learn how to use buses and bus taps.
-
Learn how to use a seven-segment display.
2. Materials Required
-
An FPGA prototyping board.
-
Design and simulation software tools.
-
A seven-segment display interface module.
3. Background
In this experiment, we would like to design and build a circuit that performs the computation:
3.1. Approach
P is computed by adding A to itself x times. For example, if
A = 4 and x = 3, then P is computed by adding 4 to itself 3
times, i.e. P = 4 + 4 + 4. Alternatively, if A = 3 and x = 4,
then P is computed by adding 3 to itself 4 times, i.e. P = 3 + 3
3 + 3. Basically, P is computed according to the following
pseudocode:
P <- 0 while x ≠ 0 do { P <- P + A x <- x – 1 } done <- 1 return P
3.2. Inputs
x |
The first operand (multiplier); a 4-bit unsigned number. |
A |
The second operand (multiplicand); a 4-bit unsigned number. |
start |
Start signal; initializes the circuit:
|
clk |
Clock signal connected to a debounced push button. Each time the push button is pressed, a clk pulse is produced, decrementing the counter by 1 and storing a new value (P + A) into P. |
3.4. Multiplier Circuit
The multiplier circuit is shown in The 4x4 Multiplier Circuit figure. It consists of the following:
- A-register
-
A 4-bit register which holds the multiplicand (A).
- P-register
-
An m-bit register (you need to specify the value of m). The final product, P, is accumulated in this register.
- Counter C
-
A 4-bit down counter used to control the number of additions to be performed. The counter counts from an initial value of x down to 0. The operation is stopped when the count reaches 0. This zero condition (zero) is detected using a 4-input OR gate.
- Adder
-
A k-bit adder (you need to specify the value of k)
3.5. Buses and Bus Taps
A group of two or more signals that carry closely related values is considered a bus. A bus is usually used to wire multiple bits of signals. Buses are used to add clarity to a schematic drawing, and to conveniently name multiple wires.
Creating a Bus in Xilinx Schematic Entry
In Xilinx schematic design entry tools, a bus can be created by simply renaming a wire:
For example, the name |
Bus taps represent branches of a bus, which can be used to wire a specific signal from a bus to a destination.
Creating Bus Taps in Xilinx Schematic Entry
To select which signal this wire would represent, use the same
procedure of Creating a Bus in Xilinx Schematic Entry, while replacing the |
In order for the bus taps to work correctly, it must be connected to the bus, and the name of the wire and the name of the bus must match exactly (case sensitive). For example, if we need bit 2 of the bus |
Bus taps is Xilinx-specific terminology. |
3.6. Using the Seven-Segment Display
You can use a seven-segment display to show numeric values, such as the result of the multiplication computation.
Seven-Segment Interface Module and UCF File
A seven-segment interface Verilog module is provided for you for use in this experiment, along with the required pin assignments (UCF file). Study the module’s ports in order to determine the appropriate connections for using it. For example, there are seven outputs of this module that represent the seven inputs of the seven-segment display that control its seven segments. |
For the purpose of this experiment:
-
Use the seven-segment displays to show the output of the multiplier (the product) in hexadecimal form.
-
use the left-most decimal point on the seven-segment display panel to reflect the value of the done signal in the multiplier circuit.
4. Tasks
4.1. Planning Your Implementation
-
Determine the sizes of the P register and the adder (m and k in The 4x4 Multiplier Circuit figure).
-
From the Xilinx library, select the proper elements needed to build the above circuit.
-
Determine how you will connect your outputs to the FPGA board indicators, e.g. LEDs or seven-segment display.
-
Determine how you will apply the inputs, e.g. through switches and/or push buttons. Justify your choice of the specific board input device for each input signal.
4.2. Testing the Circuit
-
Determine the proper sequence in which you can apply inputs, and the the input values, in order to test the circuit.
For any inputs to take effect, you need to pulse the clock.
-
What happens if you keep pulsing the clock after getting the multiplication result? Record and explain your observations.
-
Try different values of A and x (including 0 for each of A and x).