
Altera Corporation
 39
Custom Paramterized Functions
csdpram
Parameterized Cycle-Shared Dual-Port 
RAM 
The 
csdpram
 function is a custom function 
that has two address and two data ports 
that are cycle-shared. This function also 
provides a busy flag to indicate that the 
address on both ports is pointing to the 
same location and that a port will have 
priority. 
Ports
Parameters
Name
Type
Required
Description
dataa[]
Input
Input
Input
Input
Input
Input
Input
Input
Output
Output
Output
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Data input to the memory. This port is 
LPM_WIDTH
 wide.
Data input to the memory. This port is 
LPM_WIDTH
 wide.
Address input to the memory. This port is 
LPM_WIDTHAD
 wide.
Address input to the memory. This port is 
LPM_WIDTHAD
 wide.
Write enable input.
Write enable input.
Positive-edge-triggered clock.
Positive-edge-triggered clock.
Data output from the memory. This port is 
LPM_WIDTH
 wide.
Data output from the memory. This port is 
LPM_WIDTH
 wide.
Indicates that 
addressa[]
 = 
addressb[]
 and that 
dataa[]
 is writing data.
datab[]
addressa[]
addressb[]
wea
web
clock
clockx2 
qa[]
qb[]
busy
Name
Required
Value
Description
LPM_WIDTH
Yes
Yes
Integer > 0
Integer > 0
Width of the 
dataa[]
, 
datab[]
, 
qa[]
, and 
qb[]
 ports.
Width of the 
addressa[]
 and 
addressb[]
 ports. 
LPM_WIDTHAD
 should be (but is not required to be) equal to 
log
2
(
LPM_NUMWORDS
). If 
LPM_WIDTHAD
 is too small, some 
memory locations will not be addressable. If it is too large, the 
addresses that are too high will return undefined logic levels.
Number of words stored in memory. In general, this value 
should be (but is not required to be):
2
LPM_WIDTHAD
 – 1
 < 
LPM_NUMWORDS
≤
 2
LPM_WIDTHAD
. The 
default value is 2
LPM_WIDTHAD
.
LPM_WIDTHAD
LPM_NUMWORDS
No
Integer > 0
CSDPRAM
dataa[]
datab[]
addressa[]
addressb[]
wea
web
clock
clockx2
LPM_WIDTH=
LPM_WIDTHAD=
LPM_NUMWORDS=
qa[]
qb[]
busy