Lab 6

Multiply two registered bytes using shifted additions

Use eight shifted rows to multiply unsigned bytes. Separate enables let you enter two operands through one switch bank. The four displays show a registered 16-bit product. They reveal which input values were in the registers immediately before the last clock edge.

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 registered_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 registered_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 row generated by B bit 7 when A is FF. Compare it with the row for bit 0. Inspect the eight additions and find the final connection that drops the highest partial product. 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/registered_product.v simulation/test_product.v
vvp bench

SystemVerilog

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

VHDL

nvc --std=2008 -a starter/registered_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

Explain why FF × 80 exposes an omitted row even if a small product is correct. Identify one clock edge where the LEDs already show the new B while the displays still show the product from the old B. Submit your readings, your circuit change and a sketch of the adder structure.

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