hdl.RAM
Single, simple dual, dual, true dual, or simple tri-port RAM for memory read/write access
Description
The hdl.RAM
System object™ reads from and writes to memory locations for a single, simple dual, dual, true
dual, or simple tri-port RAM. The output data is delayed one step. If your input data is
scalar, the address and write enable inputs must be scalar, and HDL Coder™ infers a single RAM block. If your data is a vector, HDL Coder infers an array of parallel RAM banks. With vector data input, the address and
write enable inputs can be both scalars or vectors. When you specify scalar inputs for the
write enable and address ports, the system object applies the same operation to each RAM
bank.
The hdl.RAM
System object can have 231
bytes of internal
storage. The RAM size takes into account the address width, the number of bytes that are used
to store each word, and the number of RAM banks.
To read from or write to memory locations in the RAM:
Create the
hdl.RAM
object and set its properties.Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?
Creation
Properties
Usage
Syntax
Description
[
writes the value wrDataOut
,rdDataOut
] = ram(wrData
,wrAddress
,wrEn
,rdAddress
)wrData
into the memory location
wrAddress
when wrEn
is true
.
wrDataOut
is the new or old data at memory location
wrAddress
, and rdDataOut
is the old data at the
address location rdAddress
. Use this syntax when you create a
dual-port RAM System object.
[
writes the value wrDataOutA
,wrDataOutB
] = ram(wrDataA
,wrAddressA
,wrEnA
,wrDataB
,wrAddressB
,wrEnB
)wrDataA
into the memory location
wrAddressA
when wrEnA
is true
and writes the value wrDataB
into the memory location
wrAddressB
when wrEnB
is
true
. wrDataOutA
is the new or old data at memory
location wrAddressA
. wrDataOutB
is the new or old
data at the memory location wrAddressB
. wrAddressA
and wrAddressB
cannot be the same address. Use this syntax when you
create a true dual-port RAM System object.
[
writes the value rdDataOutA
,rdDataOutB
] = ram(wrData
,wrAddress
,wrEn
,rdAddressA
,rdAddressB
)wrData
into the memory location
wrAddress
when wrEn
is true
.
rdDataOutA
is the old data at address location
rdAddressA
, and rdDataOutB
is the old data at
the address location rdAddressB
. Use this syntax when you create a
simple tri-port RAM System object.
Input Arguments
Output Arguments
Object Functions
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named obj
, use
this syntax:
release(obj)
Examples
Algorithms
Extended Capabilities
Version History
Introduced in R2015a