Lab 6

Balance eight partial products in an adder tree

A balanced tree adds eight partial products in three levels. Its input and output registers have the same behavior as the serial adder chain. You will test whether every row reaches the output and distinguish the number of adder levels from the number of clock edges.

Lab setup

Physical DE1-SoCCyclone V · 5CSEMA5F31C6 · camera, switches and buttons in the browser

Run the simulation on your computer with Icarus Verilog (Verilog or SystemVerilog) or NVC (VHDL). Then build your design and test it on the remote DE1-SoC.

  1. Get the starterDownload tree_product.v
  2. Open the LabsLand Online EditorOpen the lab LabsLand asks you to sign in. Use the access your course or institution provides.
  3. Follow the worksheetPredict first, then build, read the board and hand in. The build steps are below.

Starter files · Verilog · VHDL · SystemVerilog

Build

  1. In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
  2. Create tree_product, paste the design and set it as the top level.
  3. Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.

Draw the four first-level pairs, two second-level sums and final addition. Label which multiplier bits contribute to each half of the final result. Locate the starter expression that uses one of those halves twice. Write your correction without using a multiplication operator in the circuit. SW9 enables register A, SW8 enables register B, and SW7–0 supply the byte. LED7–0 read back A when SW9 is high, otherwise B when SW8 is high. With neither enabled they are dark.

Simulate

Extract the worksheet ZIP and run these commands from the folder containing activity.md.

The bench checks 65,536 operand pairs, separate and simultaneous operand loads, registered output latency and the clocked reset. It calculates expected products independently using integer multiplication. Record the first pair for which the starter fails.

test_product.v

test_product.vhd

Verilog

iverilog -g2005 -s test_product -o bench starter/tree_product.v simulation/test_product.v
vvp bench

SystemVerilog

iverilog -g2012 -s test_product -o bench starter/tree_product.sv simulation/test_product.v
vvp bench

VHDL

nvc --std=2008 -a starter/tree_product.vhd simulation/test_product.vhd
nvc --std=2008 -e test_product
nvc --std=2008 -r test_product

Take one clock edge at a time

Synthesize and upload. With both enables on and the data switches at 00, press and release KEY1 twice. This initializes both operands and then clocks their zero product into the output. In simulation also try holding the active-low KEY0 reset while a KEY1 rising edge occurs.

Work down the table in order. The first two bits are SW9 and SW8. The byte after the dot is the hexadecimal value on SW7–0. Press and release KEY1 once in each row except “No pulse”. After each action, record LED7–0 and HEX3–0 in hexadecimal. Before each pulse, predict which two stored operands the output register will multiply.

SW9–8 · SW7–0 KEY1 LED7–0 HEX3–0
10 · 12 Load A
01 · 34 Load B
00 · 34 Hold A and B
10 · FF No pulse
10 · FF Load A
01 · 80 Load B
01 · 80 Repeat
11 · FF Load A and B
00 · 00 Hold A and B
11 · 00 Load A and B
00 · 00 Hold A and B

Compare the balanced and chain versions for 12 × 34 and FF × 80. The observations should agree once both programs are repaired. Count the longest path through adders for both architectures. Explain what you would need to measure before claiming a higher clock frequency. Submit your readings, your circuit change and a sketch of the adder structure.

If you use desktop Quartus, open the Compilation Report for each repaired design. In Timing Analyzer, find the Slow 1100mV 85C Model Fmax Summary and record the Fmax for KEY[1]. Repeat for the 0C model. In Fitter Summary, record the ALMs and registers. Compare both circuits at the same temperature. Which one uses fewer resources, and which one has the higher estimated clock frequency?

Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part V. verilog PDF · vhdl PDF · MIT