In computer systems, it is necessary to provide a substantial amount of memory. If a system is implemented using only FPGA technology, it is possible to provide some amount of memory by using the memory resources that exist in the FPGA device. In this lab, we will examine the general issues involved in implementing such memory.
The FPGA included on the DE1-SoC board provides dedicated memory resources and has M10K blocks, each of which contains 10240 memory bits. The M10K blocks can be configured to implement memories of various sizes. A common term used to specify the size of a memory is its aspect ratio, which gives the depth (in words) and the width (in bits) as depth × width. In this lab, we will use an aspect ratio of 32 × 3.
There are two important features of the M10K blocks:
A conceptual diagram of the Random-Access Memory (RAM) module that we want implement is shown in Figure 1a. It contains 32 three-bit words (i.e., rows) that are accessed using a five-bit Address port, a three-bit bidirectional Data port, and a Write control input. However, given the properties of the M10K blocks, we will instead implement the modified 32 x 3 RAM module shown in Figure 1b. It includes registers for the address, data input, and write ports, and uses a separate unregistered data output port.
Commonly used logic structures, such as adders, registers, counters, and memories, can be implemented in an FPGA chip by using prebuilt modules that are provided in libraries. In this task, we will use such a module to implement the memory shown in Figure 1b.
module ram32x3 (address, clock, data, wren, q);
input [4:0] address; // Address
input clock;
input [2:0] data; // DataIn
input wren; // Write
output [2:0] q; // DataOut
// ...
Check above the definition of this module. If you see a line that looks like the following:
`timescale 1 ps / 1 ps
you will need to add the same line just above your test bench module in Step 5, otherwise you may see the following error message during simulation:
"… does not have a timeunit/timeprecision specification in effect, but other modules do."
You will likely encounter the following simulation error at first:
"Instantiation of 'altsyncram' failed. The design unit was not found."
Fixes:
Instead of creating a memory module by using the IP Catalog, we can implement the required memory by specifying its structure in SystemVerilog code as a multidimensional array. A 32 × 3 array, which has 32 words with 3 bits per word, can be declared by the statement:
logic [2:0] memory_array [31:0];
On the FPGA, such an array can be implemented either by using flip-flops found in each logic cell or, more efficiently, by using the built-in memory blocks.
The RAM blocks in Figure 1 have a single Address port for both read and write operations. For this task, you will create a different type of memory module that has separate ports for the addresses of read and write operations. You will also learn how to create and use a memory initialization file (MIF).
Due by the end of Friday, submitted as a PDF on .
Due within one week of the lab report deadline, but typically during your assigned demo slot or a scheduled office hour.