The Xilinx Spartan2 FPGA used in Lab contains 10 4-Kilobit Block Rams (BRAMS) that are a very useful resource. They are dual-ported, which means they have two totally independent access ports (however, you can even read and write to the same location and the BRAM will provide either the old or newly written data). In addition, they are synchronous, which means the outputs are registered. To use the BRAM as a ROM, the default initialization values can be specified.
Xilinx FPGAs also provide "distributed memory" which creates larger memory blocks out of the flip-flops in the fabric. This memory is not very dense and should only be used for small memories or when the BRAMs are exhausted.
CoreGen (Core Generator) is the Xilinx wizard that creates various memory sizes and set other properties from the underlying BRAM primitives. coregen can create all sorts of other cores--in general you should design all the logic for the project using the methods covered over the course. However, certain blocks--such as multipliers--are appropriate to use Coregen for. Ask one of the teaching staff before using any other Coregen modules besides memory.
Launch CoreGen from within Xilinx (Tools-->Design
Entry-->Core Generator...)
Double clicking on a core type to launch a wizard for that core:
Select the following project options with the "Project-->Project Options"
menu:
After you select the appropriate options, press "Generate" to create
the core. The Coregen Memory Editor under Tools-->Memory Editor
can be used as the initialization file for the memory creating a ROM.
While the memory editor is fun, you'll probably want to write your
own
.COE files.
That's really all there is to it.
The testbench file includes the line "`timescale 1ns/10ps" that ensures all the simulation delay times are correlated. We are not using that feature and its only there to keep down some warnings in Modelsim.