주요 콘텐츠

Dual Rate Dual Port RAM

R2026b

Dual-port RAM that supports two rates

  • Dual Rate Dual Port RAM block

Libraries:
HDL Coder / HDL RAMs

Description

The Dual Rate Dual Port RAM block models a dual-port memory that supports simultaneous read and write operations through two independent RAM ports, port A and port B, which can operate at different rates. Each RAM port has its own address, data, and write-enable signals, which you can use to access different memory locations concurrently. The block ports din_A, addr_A, we_A, and dout_A represent the inputs and outputs for the RAM port A, and ports din_B, addr_B, we_B, and dout_B represent the inputs and outputs for the RAM port B.

In high-performance hardware applications, you can use this block to access the RAM twice per clock cycle. If you generate HDL code, this block maps to a dual-clock dual-port RAM in most FPGAs.

This block supports HDL code generation for complex signals. You cannot mix real-value and complex inputs.

Simultaneous Access

You can access different memory locations in port A and port B simultaneously.

If you access a memory location from one port while the other port writes to the same location, the block generates an error.

Read-During-Write Behavior

The RAM uses write-first behavior. When a write occurs, the newly written data is immediately available at the corresponding output port.

Limitations

  • This block does not support the half data type.

  • You can generate HDL code for Dual Rate Dual Port RAM blocks that are in resettable subsystems.

  • If the RAMArchitecture model configuration parameter is set to WithoutClockEnable, you cannot generate HDL code for Dual Rate Dual Port RAM blocks in enabled or triggered subsystems.

Ports

Input

expand all

Write data for port A, specified as a scalar. When the signal at port we_A is true, the block writes this data to the memory location specified by port addr_A.

Note

The input signals at ports din_A, addr_A, and we_A must have the same data rate.

Data Types: int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fixed point | single | double
Complex Number Support: Yes

Address for port A, specified as an unsigned scalar with a fraction length of 0. This address identifies the memory location accessed by port A for read or write operations. The address width must be between 2 and 28 bits.

Data Types: uint8 | uint16 | fixed point

Write-enable signal for port A, specified as a scalar. The we_A signal determines whether the block writes or reads data:

  • When the signal at port we_A is true, the block writes data from the din_A port to the memory location specified by the addr_A port.

  • When the signal at port we_A is false, the block reads data from the memory location specified by the addr_A port.

Data Types: Boolean

Write data for port B, specified as a scalar. When the signal at port we_B is true, the block writes this data to the memory location specified by port addr_B.

Note

The input signals at ports din_B, addr_B, and we_B must have the same data rate.

Data Types: int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fixed point | single | double
Complex Number Support: Yes

Address for port B, specified as an unsigned scalar with a fraction length of 0. This address identifies the memory location accessed by port B for read or write operations. The address width must be between 2 and 28 bits.

Data Types: uint8 | uint16 | fixed point

Write-enable signal for port B, specified as a scalar. The we_B signal determines whether the block writes or reads data:

  • When the signal at port we_B is true, the block writes data from the din_B port to the memory location specified by the addr_B port.

  • When the signal at port we_B is false, the block reads data from the memory location specified by the addr_B port.

Data Types: Boolean

Output

expand all

Read data output for port A, returned as a scalar. This output is the data read from the memory location specified by the addr_A port.

Data Types: int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fixed point | single | double
Complex Number Support: Yes

Read data output from port B, returned as a scalar. This output is the data read from the memory location specified by the addr_B port.

Data Types: int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fixed point | single | double
Complex Number Support: Yes

Parameters

expand all

Address of the bit width that the memory uses. The value must be an integer between 2 and 28.

Programmatic Use

Block parameter: ram_size
Type: string scalar | character vector
Value:Integer between 2 and 28
Default: '8'

Algorithms

expand all

HDL code generated for RAM blocks has:

  • A latency of one clock cycle for read data output.

  • No reset signal, because some synthesis tools do not infer a RAM from HDL code if it includes a reset.

Extended Capabilities

expand all

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

Version History

Introduced in R2014a

expand all