Lab 8

Read and write four-bit words on the DE1-SoC

Connect a single-port RAM to four hexadecimal digits. Use two pairs of addresses to test whether separate words remain independent after successive writes.

Lab setup

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

Use desktop Quartus to generate the RAM component in its IP Catalog. Build the project, then upload the bitstream to the remote board.

  1. Install Quartus Prime Lite with Cyclone V supportSkip this if it is already installed.
  2. Download the activityDownload worksheet and Quartus project Includes the worksheet, the Quartus project and the simulation files.
  3. Generate the memory, complete the design and compileComplete the design as Build in the worksheet below describes. Before compiling, create the memory component in the IP Catalog. Open memory_ip_display.qpf and choose Processing → Start Compilation. Quartus writes output_files/memory_ip_display.sof.
  4. Upload the bitstream to LabsLandUpload bitstream LabsLand asks you to sign in. Use the access your course or institution provides.

Already compiled? Upload your .sof directly

Starter files · Verilog · Quartus 24.1 · VHDL · Quartus 24.1 · SystemVerilog · Quartus 24.1

Build

Open project/memory_ip_display.qpf from the extracted worksheet ZIP. In the IP Catalog, select RAM: 1-PORT for Cyclone V. Save the variation as course_ram in the same project folder. Choose Verilog for the generated component. Quartus can connect this component to each supported top-level HDL.

Set the output width to 4 and the depth to 32 words. Use a single clock and registered inputs. On the register page, clear q output port. Keep the default single-port read-during-write setting and finish the wizard. Check that course_ram.qip is listed once among the project files. The address display shows all five switches. The starter loses one bit on the way to the RAM. Demonstrate which writes overwrite each other, repair that path and retest.

Compile and open Compilation Report → Fitter → Resource Section → RAM Summary. Record the memory width and depth, total block memory bits, physical RAM block count and the device name. Which changes if you halve the depth while keeping this memory in a dedicated block? Mark your prediction before trying a separate copy of the project.

Simulate

Use Python 3 and Icarus Verilog. Generate the Verilog IP component in Quartus first. Run this command from the root of the extracted worksheet. Set QUARTUS_ROOTDIR to the Quartus folder that contains eda, or supply it with --quartus-root.

If you have both Quartus releases installed, open project/course_ram.qip and check its IP_TOOL_VERSION against the release at the top of your worksheet. If they differ, regenerate the component in the selected release. Use the quartus folder from that installation for the simulation library.

On Windows with the Python launcher, use py -3 wherever a command starts with python3.

Verilog

python3 simulation/simulate_memory_ip.py project/memory_ip_display.v project/course_ram.v simulation/test_memory_ip_display.v

SystemVerilog

python3 simulation/simulate_memory_ip.py project/memory_ip_display.sv project/course_ram.v simulation/test_memory_ip_display.v

VHDL also requires GHDL with synthesis support.

python3 simulation/simulate_memory_ip.py project/memory_ip_display.vhd project/course_ram.v simulation/test_memory_ip_display.v

The bench writes one address-dependent nibble into each of the 32 words, reads them in reverse, prepares a canceled write and changes one word.

Test on the DE1-SoC

Upload output_files/memory_ip_display.sof. SW8–4 select a word, SW3–0 set the input data and SW9 enables writes. Hold the switches steady, press KEY0 and release it to clock the operation. HEX5–4 show the address, HEX2 the input nibble and HEX0 the memory output. HEX3 and HEX1 stay blank.

With SW9 high, write A at address 00, B at 10, C at 0F and 3 at 1F. Lower SW9 and read the four words in a different order. Prepare a write of 5 at 00 but lower SW9 before releasing KEY0. Read 00. Now complete the write and verify that address 10 still holds its own word.

Address in hex Written First read After changing 00
00 A
10 B
0F C
1F 3

FPGAcademy · Digital Logic · Lab 8 · II. Verilog · VHDL · MIT