top of page
FOLLOW ME
  • Black Facebook Icon

Memory initialization in VHDL

In this post we will illustrate different methods of memory initialization in VHDL, before reading this post it is recommended to read the Memory Modeling in VHDL post

  • Initialization with zeroes :

The Memory can be initialized with zeroes or ones by simply setting all bits into Zeros or ones as follow :

  • Initialization with constant values :

The memory content can be initialized using constant values written in binary, hex or integer the following example shows the initialization of memory with

  • Initialization from text file :

A text file can be used to initialize the memory in VHDL, for this purpose library textio is used. A function is written before declaring the memory signal, this function reads the text file line by line, converts each value in the line to std_logic_vector type and use it to initialize the memory. the following code shows an example of initializing a memory with from text file

- Text file


- VHDL code

  • Initialization using a mathematical function :

In this initialization method the memory arry is initialized using a mathematical function, such as sine, cosine, linear .... etc.

a function should first be written before declaring the memory signal, this function shall describe the required mathematical formula that will be used to fill the memory locations. The following code shows an example of using a linear function to initialize the memory.



Subscribe to get upcoming FPGA projects by email

SEARCH BY TAGS
No tags yet.
FEATURED POSTS
bottom of page