Memories
The Fpga fabric can hold data in different places. LUTs can be used if the amount of data is rather small. Block RAM can be used for bigger chunks of data. When a huge amount of memory is needed, DDR memory can be used via the PS, in that case a DMA needs to be configured to transfer data to and from the PL.
Block RAM = green (DSP = blue)


Verilog
In Verilog you can easily store and retrieve some data:
Using a Memory Block generator you can create an IP block that can be configured to load a file with some initialised memory. The configuration allows for single/dual port memory and read/write operations. The width and depth of the memory block need to be specified. You can load a .coe file into the memory block ip to initialize the memory when programming the bitstream.
The important thing to remember here is that it takes a clock cycle to look up the value in the memory. So, if the VGA_Pattern module sends out an address (to get the value in memory to display it), it will only be at the next clock cycle that this data enters the module. This means we have to send the address for the data we will need during the next clock cycle and not the address we need now. Each register you implement will take a clock cycle to pass on the data, so be well aware of which registers the address and the returning value are passing through.
In the design below, we lookup twice. The first time we lookup in the screen 'memory' which character should be displayed at the current location, the second lookup is to find out if a pixel should be plotted or not.





PS / AXI Block RAM
Todo
- Add example using python, with devmem -> next week