Main Content

True Dual Port RAM System

True Dual Port RAM block based on the hdl.RAM system object with ability to provide initial value

Since R2023b

  • True Dual Port RAM System block

Libraries:
HDL Coder / HDL RAMs

Description

The blocks are MATLAB System blocks that use the hdl.RAM System object™. You can specify the RAM type as Dual port, Simple dual port, Single port, True dual port, or Simple tri port. With the MATLAB System blocks, you can:

  • Specify an initial value for the RAM. In the Block Parameters dialog box, enter a value for Initial output of RAM.

  • Obtain faster simulation results when you use these blocks in your Simulink® model.

  • Create parallel RAM banks when you use vector data by leveraging the hdl.RAM System object functionality.

  • Obtain higher performance and support for large data memories.

  • Specify writable portions of bits in an addressed memory location by using column-write method. For more information, see Using the Column-Write Method to Selectively Write to Columns.

Limitations

  • When you build the FPGA bitstream for the RAM, the global reset logic does not reset the RAM contents. To reset the RAM, implement the reset logic.

  • The RAM write address can be either fixed-point (fi) or integer, must be unsigned, and must be between 2 and 31 bits long.

Ports

Input

expand all

Data to write into the RAM memory location when the signal at port we_a is true, specified as a scalar or a vector. This value can be double, single, half, integer, or a fixed-point (fi) object, and can be real or complex.

Bus Support:

You can use non-virtual bus and array of buses at the data port for HDL code generation.

Data Types: single | double | half | int8 | int16 | uint8 | uint16 | Boolean | fixed point

Address to write, specified as a scalar or a vector. The RAM address to write the data from port din_a to. This value can be either fixed-point (fi) or integer, must be unsigned, and must be between 2 and 31 bits long. The values at port addr_a and addr_b cannot be the same address.

Data Types: uint8 | uint16 | fixed point

Write enable, specified as a scalar or a vector. When the signal at this port is true, the RAM writes the data from port din_a to the memory location specified by port addr_a. This value can be either a Boolean or an integer or a fixed-point (fi).

Note

To use column-write method the data type must be an integer or a fixed-point (fi).

Data Types: uint8 | uint16 | uint32 | uint64 | Boolean | fixed point

Data to write into the RAM memory location when we_b is true, specified as a scalar or a vector. This value can be double, single, half, integer, or a fixed-point (fi) object, and can be real or complex.

Data Types: single | double | int8 | int16 | uint8 | uint16 | fixed point

Address to write or read, specified as a scalar or a vector. The RAM address where you write the data from port din_b into. This value can be either fixed-point (fi) or integer, must be unsigned, and must be between 2 and 31 bits long. The values at port addr_a and addr_b cannot be the same address.

Data Types: uint8 | uint16 | fixed point

Write enable, specified as a scalar or a vector. When the signal at this port is true, the RAM writes the data from port din_b to the memory location specified by port addr_b. This value can be either Boolean or integer or a fixed-point (fi).

Note

To use column-write method the data type must be an integer or a fixed-point (fi).

Data Types: uint8 | uint16 | uint32 | uint64 | Boolean | fixed point

Output

expand all

New or old output data that the RAM reads from the memory location specified by port addr_a.

New or old output data that the RAM reads from the memory location specified by port addr_b.

Parameters

expand all

Main

Type of RAM, specified as either:

  • Single port — Create a single port RAM with write data, write address, and write enable as inputs and read data as the output.

  • Simple dual port — Create a simple dual-port RAM with write data, write address, write enable, and read address as inputs and data from read address as the output.

  • Dual port — Create a dual-port RAM with write data, write address, write enable, and read address as inputs and data from read address and write address as the outputs.

  • True dual port — Create a true dual-port RAM with write data a and b, write/read address a and b, and write enable a and b as inputs and data from write address a and b as the outputs.

  • Simple tri port — Create a simple tri-port RAM with write data, write address, write enable, and read address a and b as inputs and data from read address a and b as the outputs.

The code generator dynamically configures the input and output ports of the block based on the RAM type that you specify.

Behavior for the write output, specified as either:

  • New data — Send out new data at the address to the output.

  • Old data — Send out old data at the address to the output.

Initial simulation output of the System object block, specified as either:

  • A scalar value

  • A vector with one-to-one mapping between the initial value and the RAM words

  • An n-by-m matrix with one-to-one mapping between the initial values and the RAM words in the RAM banks, where n represents the number of RAM banks and m represents the number of address location in the RAM block, or vice-versa.

Advanced

Since R2024b

If you specify:

  • true

    • The RAM delays the input data by one cycle before the output can read it.

    • The RAM is cycle-accurate to the generated HDL code.

  • false

    • The RAM reads and outputs the input data immediately, but adds one cycle of latency during HDL code generation.

    • You can leverage clock-rate pipelining when you specify an oversampling value or work with multirate models.

Programmatic Use

Block Parameter: ModelRAMDelay
Type: character vector, string
Values: "on" | "off"
Default: "on"

Data Types: Boolean

More About

expand all

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2023b

expand all