Lab 3

Capture an operand and add a live byte

How can eight switches enter two different numbers? Store the first byte in a register. The switches can then supply the second byte while the register holds the first. Read the six displays in pairs from left to right: sum, stored byte, live byte. Each pair is hexadecimal. LEDR0 shows the ninth bit of the sum.

Lab setup

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

  1. Get the starterDownload stored_sum.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

Predict the edge

The buttons idle high. Pressing KEY1 makes its input low and releasing it makes the input high. Sketch the stored byte while KEY1 is pressed and then released. What should happen if you change the switches without touching KEY1? What should KEY0 do before another clock edge arrives?

Build

Open the stored_sum starter for your HDL in the Standard Online Editor. The active-low display decoder and the nine-bit adder are supplied. Implement the assignment that captures SW7…0 on the rising edge of KEY1. KEY0 clears the stored byte asynchronously while pressed. Synthesize the design, upload it, and wait for the board camera.

Collect evidence

Pulse a button by pressing and releasing it. Settle the switches before touching KEY1. Fill in your predictions before each observation.

Action Predicted sum / stored / live Camera reading LEDR0
Set the switches to 24 hex, then pulse KEY0
Pulse KEY1 with 24 still selected
Move the switches to 13 without pressing a button
Set F6, pulse KEY1, then set 1B
Pulse KEY0 while the switches still read 1B

Explain how the last two rows distinguish an arithmetic overflow from a register reset. For one intermediate switch setting of your choice, show how you calculated all six displayed digits. Return the switches to zero and pulse KEY0 before leaving.

Source

Original LabsLand activity following FPGAcademy Digital Logic Lab 3, Part V. Verilog handout · VHDL handout · MIT