Embedded Design Handbook

ID 683689
Date 8/28/2023
Public
Document Table of Contents

3.5.2.6. Best Practices

To optimize the use of the on-chip memory in your system, follow these guidelines:

  • Set the on-chip memory data width to match the data-width of its primary system master. For example, if you are connecting the on-chip memory to the data master of a Nios® II processor, you should set the data width of the on-chip memory to 32 bits, the same as the data-width of the Nios® II data master. Otherwise, the access latency could be longer than one cycle because the system interconnect fabric performs width translation.
  • If more than one master connects to an on-chip memory component, consider enabling the dual-port feature of the on-chip memory. The dual-port feature removes the need for arbitration logic when two masters access the same on-chip memory. In addition, dual-ported memory allows concurrent access from both ports, which can dramatically increase efficiency and performance when the memory is accessed by two or more masters. However, writing to both slave ports of the RAM can result in data corruption if there is not careful coordination between the masters.

To minimize FPGA logic and memory utilization, follow these guidelines:

  • Choose the best type of on-chip memory for your application. Some types are larger capacity; others support wider data-widths. The embedded memory section in the device handbook for the appropriate FPGA family provides details on the features of on-chip memories.
  • Choose on-chip memory sizes that are a power of 2 bytes. Implementing memories with sizes that are not powers of 2 can result in inefficient memory and logic use.