TN1290 Memory Usage Guide For MachXO3L Devices Mach XO3

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 54

DownloadTN1290 - Memory Usage Guide For MachXO3L Devices Mach XO3
Open PDF In BrowserView PDF
Memory Usage Guide for
MachXO3 Devices
March 2015

Technical Note TN1290

Introduction
This technical note discusses the memory usage for the Lattice MachXO3™ PLD family. It is intended to be used
by design engineers as a guide in integrating the EBR and PFU based memories for these devices in Diamond®.
The architecture of these devices provides resources for memory intensive applications. The sysMEM™ Embedded Block RAM (EBR) complements the distributed PFU-based memory. Single-Port RAM, Dual-Port RAM,
Pseudo Dual-Port RAM, FIFO and ROM memories can be constructed using the EBR. LUTs and PFU can implement Distributed Single-Port RAM, Dual-Port RAM and ROM.
The capabilities of the EBR Block RAM and PFU RAM are referred to as primitives and are described later in this
document. Designers can utilize the memory primitives in two ways:
• Via IPexpress™ – The IPexpress GUI allows users to specify the memory type and size that is required. IPexpress takes this specification and constructs a netlist to implement the desired memory by using one or more of
the memory primitives.
• Via the PMI (Parameterizable Module Instantiation) – PMI allows experienced users to skip the graphical interface and utilize the configurable memory modules on the fly from the Diamond® Project Navigator. The parameters and the control signals needed either in Verilog or VHDL can be set. The top-level design will have the
parameters defined and signals declared so the interface can automatically generate the black box during synthesis.
In addition to familiar Block RAM and PFU RAM primatives, MachXO3LF-640 and higher density devices (Only)
provide a new User Flash Memory (UFM) block, which can be used for a variety of applications including storing a
portion of the configuration image, storing and initializing EBR data, storing PROM data or as a general purpose
non-volatile user Flash memory. The UFM block connects to the device core through the embedded function block
WISHBONE interface. Designers can also access the UFM block through the JTAG, I2C and SPI interfaces of the
device. The UFM block offers the following features:
• Non-volatile storage up to 256 kbits
• Byte addressable for read access. Write access is performed in 128-byte pages.
• Program, erase, and busy signals
• Auto-increment addressing
• WISHBONE interface
• External access is provided through JTAG, I2C and SPI interfaces
For more information on the UFM, please refer to TN1293, Using Hardened Control Functions in MachXO3
Devices.
The remainder of this document discusses these approaches, utilizing IPexpress, PMI inference, memory modules
and memory primitives.

© 2015 Lattice Semiconductor Corp. All Lattice trademarks, registered trademarks, patents, and disclaimers are as listed at www.latticesemi.com/legal. All other brand
or product names are trademarks or registered trademarks of their respective holders. The specifications and information herein are subject to change without notice.

www.latticesemi.com

1

TN1290_01.1

Memory Usage Guide for MachXO3 Devices

Memories in MachXO3L/LF Devices
All MachXO3L/LF devices contain an array of logic blocks called PFUs surrounded by Programmable I/O Cells
(PICs). This is shown in Figures 1 and 2.
Figure 1. Top View of the MachXO3L/LF-1300 Device
Embedded Function
Block (EFB)
NVCM1 (MachXO3L)/
UFM (MachXO3LF)

sysCLOCK PLL

sysMEM Embedded
Block RAM (EBR)

On-chip Configuration
NVCM (MachXO3L)
/UFM (MachXO3LF)
Programmable Function Units
with Distributed RAM (PFUs)

PIOs Arranged into
sysIO Banks

Figure 2. Top View of the MachXO3L/LF-4300 Device
Embedded
Function Block(EFB)
NVCM1 (MachXO3L)/
UFM (MachXO3LF)
sysCLOCK PLL
On-chip Configuration
NVCM (MachXO3L)/
UFM (MachXO3LF)

sysMEM Embedded
Block RAM (EBR)

PIOs Arranged into
sysIO Banks

Programmable Function Units
with Distributed RAM (PFUs)

The PFU contains the building blocks for logic and Distributed RAM and ROM. Some PFUs provide the logic building blocks without the distributed RAM. This document describes the memory usage and implementation for both
Embedded Memory Blocks (EBRs) and Distributed RAM of the PFU. Refer to DS1047, MachXO3 Family Data
Sheet for details on the hardware implementation of the EBR and Distributed RAM.

2

Memory Usage Guide for MachXO3 Devices

Utilizing IPexpress
Designers can utilize IPexpress to easily specify a variety of memories in their designs. These modules will be constructed using one or more memory primitives along with general purpose routing and LUTs as required. The available primitives are:
• Single Port RAM (RAM_DQ) – EBR based
• Dual Port RAM (RAM_DP_TRUE) – EBR based
• Pseudo Dual Port RAM (RAM_DP) – EBR based
• Read Only Memory (ROM) – EBR based
• First In First Out Memory (FIFO_DC) – EBR based
• Distributed Single Port RAM (Distributed_SPRAM) – PFU based
• Distributed Dual Port RAM (Distributed_DPRAM) – PFU based
• Distributed ROM (Distributed_ROM) – PFU based
• RAM-based Shift Register - PFU based

3

Memory Usage Guide for MachXO3 Devices
IPexpress Flow
For generating any of these memories, create (or open) a project for the MachXO3L/LF devices.
From the Project Navigator, select Tools > IPexpress. Alternatively, users can also click on the IPexpress button in
the toolbar when MachXO3L/LF devices are targeted in the project.
This opens the IPexpress window as shown in Figure 3.
Figure 3. IPexpress – Main Window

The left pane of this window has the Module Tree. The EBR-based Memory Modules are under the
EBR_Components and the PFU-based Distributed Memory Modules are under Distributed_RAM as shown in
Figure 3.
As an example, let us consider generating an EBR-based Pseudo Dual Port RAM of size 512x16. Select RAM_DP
under the EBR_Components. The right pane changes as shown in Figure 4.

4

Memory Usage Guide for MachXO3 Devices
Figure 4. Example Generating Pseudo Dual Port RAM (RAM_DP) Using IPexpress

In this right pane, options like the Macro Type and Module_Name are device and selected module dependent.
These cannot be changed in IPexpress.
Users can change the directory where the generated modules will be placed by clicking the Browse button in the
Project Path.
The File Name text box allows users to specify an entity name for the module they are about to generate. Users
must provide this entity name.
Design entry, Verilog or VHDL, by default, is the same as the project type. If the project is a VHDL project, the
selected design entry option will be “VHDL”, and “Verilog-HDL” if the project type is Verilog-HDL. Schematic support
may also be selected with either HDL type.
When launched from within Project Navigator, the Device Family and Part Name pull-down menus are filled in by
default and cannot be changed by the user. However, when IPexpress is launched as a stand-alone application,
these menus allow users to select different devices within a device family, MachXO3L/LF in this example.
When finished, click the Customize button.
This opens another window where users can customize the RAM (Figure 5).

5

Memory Usage Guide for MachXO3 Devices
Figure 5. Example Generating Pseudo Dual Port RAM (RAM_DP) Module Customization (MachXO3L)

6

Memory Usage Guide for MachXO3 Devices
Figure 6. Example Generating Pseudo Dual Port RAM (RAM_DP) Module Customization (MachXO3LF)

The left side of this window shows the block diagram of the module. The right side includes the Configuration tab
The left side of this window shows the block diagram of the module. The right side includes the Configuration tab
where users can choose options to customize the RAM_DP (such as specify the address port sizes and data
widths).
Users can specify the address depth and data width for the Read Port and the Write Port in the text boxes provided. In this example we are generating a Pseudo Dual Port RAM of size 512 x 16. Users can also create RAMs of
different port widths for Pseudo Dual Port and True Dual Port RAMs.
The Input Data and the Address Control is always registered, as the hardware only supports the clocked write
operation for the EBR-based RAMs. The check box Enable Output Register inserts the output registers in the
Read Data Port, as the output registers are optional for EBR-based RAMs.
Clock Enable control is always provided for Input Data and Address signals. When Output Registers are enabled,
separate Output Clock Enables can be selected.

7

Memory Usage Guide for MachXO3 Devices
Users can specify the use of Byte Enables. Byte Enables can be used to mask the input data so that only specific
bytes of memory are overwritten. The unwritten bytes retain the previously written data.
The Reset Mode of the memory can be specified by the user for both assertion and release. For the synchronous
reset, the clock should be there and reset signal should satisfy setup/hold time requirements for both asserting and
deasserting edges. The write function is automatically disabled during a synchronous reset because the CS registers are reset, but the write is not disabled during an asynchronous reset operation.
The asynchronous reset can be programmed to be released (de-asserted) synchronously. As shown in Figure 7,
when de-asserted synchronously, the first clock edge after reset will release the internal reset to all registers that
have asynchronous reset, such as the data output registers, the FIFO counters and the FIFO flag registers.
Figure 7. Asynchronous Reset with Synchronous Release
RESET
Synchronous
Release
CLOCK

Unregistered
Data Out
First Valid
Data
Registered
Data Out
Asynchronous
Assertion

First Valid
Data

Memory may be initialized at configuration to all 1s or all 0s. To maximize the number of NVCM/Flash bits, initialize
the EBRs to an all 0's pattern. Initializing to an all 0’s pattern does not use up NVCM/UFM bits. Users can also initialize their memory with the contents specified in the Memory File. It is optional to provide this file for RAM; however for ROM, the Memory File is required. These files can be of Binary, Hex or Addressed Hex format. The details
of these formats are discussed in the Initialization File section of this document.
Traditionally, the initialization Memory File is static and is stored in the device configuration bitstream. Alternatively,
the MachXO3LF (Only) architecture allows the memory initialization data to be stored in UFM where it may be
accessed and/or dynamically modified by the user. To enable this feature, select Allow Update of initialization file
stored in UFM. For details of this feature, please refer to TN1293, Using Hardened Control Functions in MachXO3
Devices.
At this point, users can click the Generate button to generate the module they have customized. A VHDL or Verilog
netlist is then generated and placed in the specified location. Users can incorporate this netlist in their designs. In
addition, an instantiation template file (*_tmpl.v or .vhd), a Lattice Parameter file (*.lpc), a testbench template file
(tb_*_tmpl.v or .vhd), and two log files (*_generate.log, *.srp) are generated. Finally, a schematic symbol file
(*.sym) is created if Design Entry type is Schematic/VHDL or Schematic/Verilog.
Once the module is generated, user can either instantiate the *.lpc or the Verilog-HDL/ VHDL file in top-level module of their design.

8

Memory Usage Guide for MachXO3 Devices
ECC in Memory Modules
IPexpress allows users to implement Error Check Codes in the EBR-based memory modules. There is a checkbox
to enable ECC in the configuration tab for the module.
If you choose to use ECC, you will have a 2-bit error signal and the error codes are as below:
• Error[1:0] = “00” – Indicates there is no error.
• Error[1:0] = “01” – Indicates there was a 1-bit error which was fixed.
• Error[1:0] = “10” – Indicates there was a 2-bit error which cannot be corrected.
• Error[1:0] = “11” – Not used.

IP Regeneration/Modification
Sometimes it is useful to regenerate or modify a previously generated module. By regenerating a customized module or IP you can modify any of its settings including: device type, design entry method, and any of the options specific to the module. You can also update older modules or IP to the latest version. From the IPexpress main window,
click the Regenerate button.
In the Select a Parameter File dialog box, choose the Lattice Parameter Configuration (.lpc) file of the module or
IP you wish to regenerate, and click Open.
This opens a dialog box as shown in Figure 8.
Figure 8. Example Regenerating/Modifying IP

9

Memory Usage Guide for MachXO3 Devices
The Select Target Core Version, Design Entry, and Device dialog box shows the current settings for the module
or IP in the Source Value box. Make your new settings in the Target Value box.
If you want to generate a new set of files in a new location, set the location in the LPC Target File box. The base of
the .lpc file name will be the base of all the new file names. The LPC Target File must end with a .lpc extension.
Click Next, and proceed with module customization as before.
The various memory modules, both EBR and Distributed, are discussed in detail in the following sections.

Utilizing PMI
Parameterizable Module Instantiation (PMI) allows experienced users to skip the graphical interface and utilize the
configurable memory modules on-the-fly from the Diamond Project Navigator.
The necessary parameters and control signals can be set in either Verilog or VHDL. The top-level design includes
the defined memory parameters and declared signals. The interface can then automatically generate the black box
during synthesis and Diamond can generate the netlist on-the-fly. Lattice memories are the same as industry standard memories, so you can get the parameters for each module from any memory-related guide, which is available
through the on-line help system.
PMI modules are instantiated the same way other modules are in your HDL. The process is similar to the process
for IPexpress with the addition of setting parameters to customize the module. The Diamond software provides a
template for the Verilog or VHDL instantiation command that specifies the customized module’s ports and parameters. Refer to the Diamond online help section “Instantiating a PMI Module” for further information.

Memory Module Inference
Finally, memories may be instantiated within Verilog or VHDL modules through inference. The HDL constructs for
memory inferencing is synthesis vendor dependant. Refer to the documentation provided by the synthesis engine
vendor for correct inference constructs and attribute settings.

IPexpress Memory Modules
Single Port RAM (RAM_DQ) – EBR Based
The EBR blocks in the MachXO3L/LF devices can be configured as Single Port RAM (RAM_DQ). IPexpress allows
users to generate the Verilog-HDL or VHDL netlist for the memory size, as per design requirements.
IPexpress generates the memory module as shown in Figure 9.
Figure 9. Single Port Memory Module Generated by IPexpress

Clock
ClockEn
OClockEn
Reset
ByteEn

RAM_DQ
EBR-Based Single Port
Memory

WE
Address
Data

10

Q

Memory Usage Guide for MachXO3 Devices
Since the device has a number of EBR blocks, the generated module makes use of these EBR blocks, or primitives, and cascades them to create the memory sizes specified by the user in the IPexpress GUI. For memory sizes
smaller than an EBR block, the module will be created in one EBR block. For memory sizes larger than one EBR
block, multiple EBR blocks can be cascaded in depth or width (as required to create these sizes).
In Single Port RAM mode, the input data and address for the ports are registered at the input of the memory array.
The output data of the memory is optionally registered at the output.
The various ports and their definitions for the Single Port Memory are listed in Table 1.
Table 1. EBR-Based Single Port Memory Port Definitions
Port Name
in the Generated Module

Description

Active State

Clock

Clock

Rising Clock Edge

1

Clock Enable

Active High

Output Clock Enable

Active High

Reset

Active High

Byte Enable

Active High

WE

Write Enable

Active High

Address

Address Bus

—

ClockEn

*OClockEn

2

Reset3
*ByteEn

4

Data

Data In

—

Q

Data Out

—

*ERROR

Error Check Code

Active High

*Denotes optional port
1. ClockEn is used as clock enable for all the input registers.
2. OClockEn can be used as clock enable for the optional output registers. This allows the full
pipeline of data to be output, including the last word.
3. Reset resets only the optional output registers of the RAM. It does not reset the input registers or the contents of memory.
4. ByteEn can be used to mask the input data so that only specific bytes of memory are overwritten.

The Single Port RAM (RAM_DQ) can be configured in NORMAL, READ BEFORE WRITE or WRITE THROUGH
modes. Each of these modes affects what data comes out of the port Q of the memory during the write operation
followed by the read operation at the same memory location.
IPexpress implements the MachXO3L/LF Single Port RAM (RAM_DQ) using an appropriately configured DP8KC
primitive.
Figures 10 through 15 show the internal timing waveforms for the Single Port RAM (RAM_DQ).

11

Memory Usage Guide for MachXO3 Devices
Figure 10. Single Port RAM Timing Waveform – NORMAL Mode, Without Output Registers

Clock
tSUCE_EBR

t HCE_EBR

ClockEn
t SUWREN_EBR

t HWREN_EBR

WE
t HADDR_EBR

t SUADDR_EBR

Address

Data

Add_0

Add_1

Data_0

Data_1

tSUDATA_EBR

Add_0

Add_1

Add_2

t HDATA_EBR

Q

Invalid Data

Data_0

Data_1

Data_2

t CO_EBR

Figure 11. Single Port RAM Timing Waveform – NORMAL Mode, With Output Registers

Clock
tSUCE_EBR

tHCE_EBR

ClockEn
t SUWREN_EBR

t HWREN_EBR

WE
tHADDR_EBR

t SUADDR_EBR

Address

Add_0

Add_1

Data

Data_0

Data_1

tSUDATA_EBR

Q

Add_0

Add_1

Add_2

t HDATA_EBR

Invalid Data

Data_0
t COO_EBR

12

Data_1

Memory Usage Guide for MachXO3 Devices
Figure 12. Single Port RAM Timing Waveform – READ BEFORE WRITE Mode, Without Output Registers

Clock
t SUCE_EBR

tHCE_EBR

ClockEn
t SUWREN_EBR

t HWREN_EBR

WE
t SUADDR_EBR

tHADDR_EBR

Address

Add_0

Data

New
Data_0
tSUDATA_EBR

Q

Add_0

Add_1

Add_1

Add_2

New
Data_1
t HDATA_EBR

Invalid Data

Old_Data_0

New_Data_0

Old_Data_1

New_Data_1

t CO_EBR

Figure 13. Single Port RAM Timing Waveform – READ BEFORE WRITE Mode, With Output Registers

Clock
t SUCE_EBR

tHCE_EBR

ClockEn
t SUWREN_EBR

t HWREN_EBR

WE
t SUADDR_EBR

tHADDR_EBR

Address

Add_0

Data

New
Data_0
tSUDATA_EBR

Q

Add_0

Add_1

Add_1

Add_2

New
Data_1
tHDATA_EBR

Invalid Data

Old_Data_0

New_Data_0
t COO_EBR

13

Old_Data_1

New
Data_1

Memory Usage Guide for MachXO3 Devices
Figure 14. Single Port RAM Timing Waveform – WRITE THROUGH Mode, Without Output Registers

Clock
tSUCE_EBR

t HCE_EBR

ClockEn
t SUWREN_EBR

t HWREN_EBR

WE
tHADDR_EBR

t SUADDR_EBR

Add_0

Address

Data_0

Data
tSUDATA_EBR

Q

Add_1

Add_0

Data_1

Data_2

Data_3

Data_4

t HDATA_EBR

Invalid Data

Data_0

Data_1

Data_2

Data_3

Data_4

t CO_EBR

Figure 15. Single Port RAM Timing Waveform – WRITE THROUGH Mode, With Output Registers

Clock
tSUCE_EBR

tHCE_EBR

ClockEn
t SUWREN_EBR

tHWREN_EBR

WE
t SUADDR_EBR

Address

Data
tSUDATA_EBR

Q

tHADDR_EBR

Add_0

Add_1

Data_0

Data_1

Add_0

Data_2

Data_3

Data_4

tHDATA_EBR

Invalid Data

Data_0

Data_1

Data_2

Data_3

t COO_EBR

Dual Port RAM (RAM_DP_TRUE) – EBR Based
The EBR blocks in MachXO3L/LF devices can be configured as True-Dual Port RAM (RAM_DP_TRUE). IPexpress
allows users to generate the Verilog-HDL or VHDL netlists for various memory sizes depending on design requirements.
IPexpress generates the memory module as shown in Figure 16.

14

Memory Usage Guide for MachXO3 Devices
Figure 16. True Dual Port Memory Module Generated by IPexpress

DataInA
DataInB
AddressA
AddressB
ClockA
ClockB
ClockEnA
OClockEnA
ClockEnB
OClockEnB
WrA
WrB
ResetA
ResetB

RAM_DP_TRUE
EBR-Based True Dual Port
Memory

QA
QB

Since the device has a number of EBR blocks, the generated module makes use of these EBR blocks, or primitives, and cascades them to create the memory sizes specified by the user in the IPexpress GUI. For memory sizes
smaller than an EBR block, the module will be created in one EBR block. For memory sizes larger than one EBR
block, multiple EBR blocks can be cascaded in depth or width (as required to create these sizes).
In True Dual Port RAM mode, the input data and address for the ports are registered at the input of the memory
array. The output data of the memory is optionally registered at the output.
The various ports and their definitions for True Dual Port Memory are in Table 2.
Table 2. EBR-Based True Dual Port Memory Port Definitions
Port Name
in the Generated Module
DataInA, DataInB
AddressA, AddressB

Address Bus port A and port B

ClockA, ClockB

Clock for PortA and PortB

ClockEnA, ClockEnB1
*OClockEnA, *OClockEnB
WrA, WrB
3

ResetA, ResetB
QA, QB

4

*ByteEnA, *ByteEnB
*ERROR

Description
Input Data port A and port B

2

Active State
—
—
Rising Clock Edge

Clock Enables for Port CLKA and CLKB

Active High

Output Clock Enables for PortA and PortB

Active High

Write enable port A and port B

Active High

Reset for PortA and PortB

Active High

Output Data port A and port B

—

Byte Enable port A and port B

Active High

Error Check Code

Active High

*Denotes optional port
1. ClockEnA/B are used as clock enable for all the input registers.
2. OClockEnA/B can be used as clock enable for the optional output registers. This allows the full pipeline of data to be output, including the last word.
3. Reset resets only the optional output registers of the RAM. It does not reset the input registers or the contents of memory.
4. ByteEnA/B can be used to mask the input data so that only specific bytes of memory are overwritten.

The True Dual Port RAM (RAM_DP_TRUE) can be configured as NORMAL, READ BEFORE WRITE or WRITE
THROUGH modes. Each of these modes affects what data comes out of the port Q of the memory during the write
operation followed by the read operation at the same memory location.

15

Memory Usage Guide for MachXO3 Devices
IPexpress implements the MachXO3L/LF True Dual Port RAM (RAM_DP_TRUE) using the DP8KC primitive.
Figure 17 through Figure 22 show the internal timing waveforms for the True Dual Port RAM (RAM_DP_TRUE).
Figure 17. True Dual Port RAM Timing Waveform – NORMAL Mode, without Output Registers

ClockA
t SUCE_EBR

t HCE_EBR

ClockEnA
t SUWREN_EBR

tHWREN_EBR

WrA
t SUADDR_EBR

AddressA

DataA

t HADDR_EBR
Add_A0

Add_A1

Data_A0

Data_A1

t SUDATA_EBR

Add_A0

Add_A1

Add_A2

tHDATA_EBR

QA

Invalid Data

Data_A0

Data_A1

Data_A2

t CO_EBR

ClockB
t SUCE_EBR

tHCE_EBR

ClockEnB
t SUWREN_EBR

t HWREN_EBR

WrB
t SUADDR_EBR

t HADDR_EBR

AddressB

Add_B0

Add_B1

DataB

Data_B0

Data_B1

t SUDATA_EBR

QB

Add_B0

Add_B1

Add_B2

t HDATA_EBR
Invalid Data

Data_B0
t CO_EBR

16

Data_B1

Data_B2

Memory Usage Guide for MachXO3 Devices
Figure 18. True Dual Port RAM Timing Waveform – NORMAL Mode with Output Registers

ClockA
t SUCE_EBR

tHCE_EBR

ClockEnA
t SUWREN_EBR

t HWREN_EBR

WrA
t SUADDR_EBR

t HADDR_EBR

AddressA

Add_A0

Add_A1

DataA

Data_A0

Data_A1

t SUDATA_EBR

Add_A0

Add_A1

Add_A2

t HDATA_EBR

QA

Invalid Data

Data_A0

Data_A1

t COO_EBR

ClockB
t SUCE_EBR

tHCE_EBR

ClockEnB
t SUWREN_EBR

t HWREN_EBR

WrB
t SUADDR_EBR

AddressB

DataB
t SUDATA_EBR

QB

t HADDR_EBR
Add_B0

Add_B1

Data_B0

Data_B1

Add_B0

Add_B1

Add_B2

t HDATA_EBR
Invalid Data

Data_B0
t COO_EBR

17

Data_B1

Memory Usage Guide for MachXO3 Devices
Figure 19. True Dual Port RAM Timing Waveform – READ BEFORE WRITE Mode, without Output Registers

ClockA
tSUCE_EBR

tHCE_EBR

ClockEnA
t SUWREN_EBR

tHWREN_EBR

WrA
t SUADDR_EBR

tHADDR_EBR

AddressA

Add_A0

DataA

New
Data_A0
tSUDATA_EBR

QA

Add_A0

Add_A1

Add_A1

Add_A2

Old_Data_A1

New_Data_A1

New
Data_A1
tHDATA_EBR

Invalid Data

Old_Data_A0

New_Data_A0
t CO_EBR

ClockB
tSUCE_EBR

tHCE_EBR

ClockEnB
t SUWREN_EBR

t HWREN_EBR

WrB
t SUADDR_EBR

tHADDR_EBR

AddressB

Add_B0

DataB

New
Data_B0
tSUDATA_EBR

QB

Invalid Data

Add_B0

Add_B1

Add_B1

Add_B2

Old_Data_B1

New_Data_B1

New
Data_B1
tHDATA_EBR
Old_Data_B0

New_Data_B0
t CO_EBR

18

Memory Usage Guide for MachXO3 Devices
Figure 20. True Dual Port RAM Timing Waveform – READ BEFORE WRITE Mode, with Output Registers

ClockA
t SUCE_EBR

tHCE_EBR

ClockEnA
t SUWREN_EBR

tHWREN_EBR

WrA
t SUADDR_EBR

tHADDR_EBR

AddressA

Add_A0

DataA

New
Data_A0
tSUDATA_EBR

QA

Add_A0

Add_A1

Add_A1

Add_A2

New
Data_A1
tHDATA_EBR

Invalid Data

Old_Data_A0

New_Data_A0

Old_Data_A1

New
Data_A1

t COO_EBR

ClockB
t SUCE_EBR

tHCE_EBR

ClockEnB
t SUWREN_EBR

t HWREN_EBR

WrB
t SUADDR_EBR

tHADDR_EBR

AddressB

Add_B0

DataB

New
Data_B0
t SUDATA_EBR

QB

Add_B0

Add_B1

Add_B1

Add_B2

New
Data_B1
tHDATA_EBR

Invalid Data

Old_Data_B0

New_Data_B0
t COO_EBR

19

Old_Data_B1

New
Data_B1

Memory Usage Guide for MachXO3 Devices
Figure 21. True Dual Port RAM Timing Waveform – WRITE THROUGH Mode, without Output Registers

ClockA
t SUCE_EBR

t HCE_EBR

ClockEnA
t SUWREN_EBR

tHWREN_EBR

WrA
t SUADDR_EBR

t HADDR_EBR

AddressA

Add_A0

Add_A1

DataA

Data_A0

Data_A1

t SUDATA_EBR

QA

Add_A0

Data_A2

Data_A3

Data_A4

t HDATA_EBR

Invalid Data

Data_A0

Data_A1

Data_A2

Data_A3

Data_A4

t CO_EBR

ClockB
t SUCE_EBR

t HCE_EBR

ClockEnB
t SUWREN_EBR

tHWREN_EBR

WrB
t SUADDR_EBR

AddressB

tHADDR_EBR
Add_B0

DataB

Data_B0
t SUDATA_EBR

QB

Add_B1

Invalid Data

Add_B0

Data_B1

Data_B2

Data_B3

Data_B4

t HDATA_EBR
Data_B0

Data_B1
t CO_EBR

20

Data_B2

Data_B3

Data_B4

Memory Usage Guide for MachXO3 Devices
Figure 22. True Dual Port RAM Timing Waveform – WRITE THROUGH Mode, with Output Registers
ClockA
t SUCE_EBR

tHCE_EBR

ClockEnA
t SUWREN_EBR

tHWREN_EBR

WrA
t SUADDR_EBR

AddressA

DataA

t HADDR_EBR

Add_A0

Add_A1

Data_A0

Data_A1

t SUDATA_EBR

Add_A0

Data_A2

Data_A4

tHDATA_EBR

Invalid Data

QA

Data_A3

Data_A0

Data_A1

Data_A2

Data_A3

t COO_EBR

ClockB
tSUCE_EBR

tHCE_EBR

ClockEnB
tSUWREN_EBR

tHWREN_EBR

WrB
t SUADDR_EBR

AddressB

DataB
tSUDATA_EBR

QB

tHADDR_EBR

Add_B0

Add_B1

Data_B0

Data_B1

Add_B0

Data_B2

Data_B3

Data_B4

tHDATA_EBR

Invalid Data

Data_B0

Data_B1

Data_B2

Data_B3

t COO_EBR

Pseudo Dual Port RAM (RAM_DP) – EBR Based
The EBR blocks in the MachXO3L/LF devices can be configured as Pseudo-Dual Port RAM (RAM_DP). IPexpress
allows users to generate the Verilog-HDL or VHDL netlists for various memory sizes depending on design requirements.
IPexpress generates the memory module as shown in Figure 23.

21

Memory Usage Guide for MachXO3 Devices
Figure 23. Pseudo Dual Port Memory Module Generated by IPexpress

WrAddress
RdAddress
Data
ByteEn
WE
RdClock
RdClockEn
ORdClockEn
Reset

RAM_DP
EBR-Based
Pseudo Dual
Port Memory

Q

WrClock
WrClockEn

Since the device has a number of EBR blocks, the generated module makes use of these EBR blocks, or primitives, and cascades them to create the memory sizes specified by the user in the IPexpress GUI. For memory sizes
smaller than an EBR block, the module will be created in one EBR block. For memory sizes larger than one EBR
block, multiple EBR blocks can be cascaded in depth or width (as required to create these sizes).
In Pseudo Dual Port RAM mode, the input data and address for the ports are registered at the input of the memory
array. The output data of the memory is optionally registered at the output.
The various ports and their definitions for the Pseudo Dual Port Memory are listed in Table 3.
Table 3. EBR-Based Pseudo-Dual Port Memory Port Definitions
Port Name
in the Generated Module

Description

Active State

WrAddress

Write Address

—

RdAddress

Read Address

—

Data

Write Data

—

*ByteEn

1

WE
RdClock
2

Byte Enable

Active High

Write Enable

Active High

Read Clock

Rising Edge

RdClockEn

Read Clock Enable

Active High

*ORdClockEn3

Read Output Clock Enable

Active High

Reset4

Reset

Active High

WrClock

Write Clock

Rising Edge

WrClockEn

Write Clock Enable

Active High

Q

Read Data

—

*ERROR

Error Check Code

Active High

2

*Denotes optional port
1. ByteEn can be used to mask the input data so that only specific bytes of memory are overwritten.
2. RdClockEn/WrClockEn are used as clock enable for all the input registers.
3. ORdClockEn can be used as clock enable for the optional output registers. This allows the full pipeline of data to be
output, including the last word.
4. Reset resets only the optional output registers of the RAM. It does not reset the input registers or the contents of memory.

IPexpress implements the MachXO3L/LF Pseudo Dual Port RAM (RAM_DP) using the PDPW8KC primitive, or the
DP8KC primitive in narrow data port (9 bits or less) configurations.

22

Memory Usage Guide for MachXO3 Devices
Figures 24 and 25 show the internal timing waveforms for the Pseudo Dual Port RAM (RAM_DP).
Figure 24. Pseudo-Dual Port RAM Timing Diagram – Without Output Registers

WrClock
t SUCE_EBR

t HCE_EBR

WrClockEn

RdClock
tSUCE_EBR

tHCE_EBR

RdClockEn
t SUADDR_EBR

WrAddress

t HADDR_EBR
Add_0

t SUADDR_EBR

Add_1

Add_2

t HADDR_EBR

RdAddress

Add_0

Data

Data_0
t SUDATA_EBR

Add_1

Add_2

Data_2

Data_1
t HDATA_EBR

Q

Invalid Data

Data_0

Data_1

Dat
a_2

t CO_EBR

Figure 25. Pseudo-Dual Port RAM Timing Diagram – With Output Registers

WrClock
tSUCE_EBR

tHCE_EBR

WrClockEn

RdClock
t SUCE_EBR

tHCE_EBR

RdClockEn
t SUADDR_EBR

WrAddress

t HADDR_EBR
Add_0

t SUADDR_EBR

Add_1

Add_2

t HADDR_EBR

RdAddress

Add_0

Data

Data_0
tSUDATA_EBR

Q

Data_1

Add_1

Add_2

Data_2

t HDATA_EBR
Invalid Data

Data_0
t COO_EBR

23

Dat
a_1

Memory Usage Guide for MachXO3 Devices
Read Only Memory (ROM) – EBR Based
The EBR blocks in the MachXO3L/LF devices can be configured as Read Only Memory (ROM). IPexpress allows
users to generate the Verilog-HDL or VHDL netlist for various memory sizes depending on design requirements.
Users are required to provide the ROM memory content in the form of an initialization file.
IPexpress generates the memory module as shown in Figure 26.
Figure 26. ROM – Read Only Memory Module Generated by IPexpress

Address
ROM

OutClock
OutClockEn

EBR-Based Read Only
Memory

Q

Reset

Since the device has a number of EBR blocks, the generated module makes use of these EBR blocks, or primitives, and cascades them to create the memory sizes specified by the user in the IPexpress GUI. For memory sizes
smaller than an EBR block, the module will be created in one EBR block. For memory sizes larger than one EBR
block, multiple EBR blocks can be cascaded in depth or width (as required to create these sizes).
The various ports and their definitions for the ROM are listed in Table 4.
Table 4. EBR-Based ROM Port Definitions
Port Name in
Generated Module

Description

Active State

Address

Read Address

—

OutClock

Clock

Rising Clock Edge

OutClockEn1

Clock Enable

Active High

Reset

Active High

2

Reset
Q

Read Data

—

*ERROR

Error Check Code

Active High

*Denotes optional port
1. OutClockEn can be used as clock enable for the optional output registers.
2. Reset resets only the optional output registers of the ROM. It does not reset the contents of the
memory.

While generating the ROM using IPexpress, the user must provide the initialization file to pre-initialize the contents
of the ROM. These files are the *.mem files and they can be of Binary, Hex or the Addressed Hex formats. The initialization files are discussed in detail in the Initializing Memory section of this document.
IPexpress implements the MachXO3L/LF Read Only Memory (ROM) using an appropriately configured DP8KC
primitive with write-enables tied low.
Figures 27 and 28 show the internal timing waveforms for the Read Only Memory (ROM).

24

Memory Usage Guide for MachXO3 Devices
Figure 27. ROM Timing Waveform – Without Output Registers

OutClock
t SUCE_EBR

tHCE_EBR

OutClockEn

Add_0

Address
t SUADDR_EBR

Q

Add_1

Add_2

Data_0

Data_1

Add_3

Add_4

Data_2

Data_3

tHADDR_EBR

Invalid Data

Data_4

tCO_EBR

Figure 28. ROM Timing Waveform – With Output Registers

OutClock
tSUCE_EBR

tHCE_EBR

OutClockEn

Add_0

Address
t SUADDR_EBR

Q

Add_1

Add_2

Add_3

Add_4

tHADDR_EBR

Invalid Data

Data_0

Data_1

Data_2

Data_3

t COO_EBR

First In First Out (FIFO_DC) – EBR Based
The EBR blocks in MachXO devices can be configured as Dual-Clock First-In First-Out Memory (FIFO_DC). IPexpress allows users to generate the Verilog-HDL or VHDL netlist for various memory sizes depending on design
requirements.
IPexpress generates the FIFO_DC memory module as shown in Figure 29.
Figure 29. FIFO Module Generated by IPexpress
Data
WrClock

Q

RdClock
FIFO_DC

Empty

WrEn
RdEn

EBR-Based
First In First Out
Memory

Full
AlmostEmpty

ORdEn
AlmostFull
Reset
RPReset

25

Memory Usage Guide for MachXO3 Devices
Since the device has a number of EBR blocks, the generated module makes use of these EBR blocks, or primitives, and cascades them to create the memory sizes specified by the user in the IPexpress GUI. For memory sizes
smaller than an EBR block, the module will be created in one EBR block. For memory sizes larger than one EBR
block, multiple EBR blocks can be cascaded in depth or width (as required to create these sizes).
In FIFO_DC mode, the input data is registered at the input of the memory array. The output data of the memory is
optionally registered at the output.
The various ports and their definitions for the FIFO_DC are listed in Table 5.
Table 5. EBR-Based FIFO_DC Memory Port Definitions
Port Name in
Generated Module

Description

Active State

WrClock

Write Port Clock

Rising Clock Edge

RdClock

Read Port Clock

Rising Clock Edge

WrEn

Write Enable

Active High

RdEn

Read Enable

Active High

Output Read Enable

Active High

Reset

Active High

1

*ORdEn
Reset

2
3

Read Pointer Reset

Active High

Q

Data Output

—

Empty

Empty Flag

Active High

Full

Full Flag

Active High

AlmostEmpty

Almost Empty Flag

Active High

AlmostFull

Almost Full Flag

Active High

*ERROR

Error Check Code

Active High

RPReset

*Denotes optional port
1. ORdEn can be used as clock enable for the optional output registers. This allows the full pipeline of
data to be output, including the last word.
2. Reset resets only the optional output registers, pointer circuitry and flags of the FIFO. It does not
reset the input registers or the contents of memory.
3. RPReset resets only the read pointer. See additional discussion below.

IPexpress implements the MachXO3L/LF Dual-Clock First-In First-Out Memory (FIFO_DC) using the FIFO8KB
primitive.

FIFO_DC Flags
The FIFO_DC have four flags available: Empty, Almost Empty, Almost Full and Full. Almost Empty and Almost Full
flags have a programmable range.
The program ranges for the four FIFO_DC flags are specified in Table 6.
Table 6. FIFO_DC Flag Settings
Module Flag Name

Description

Programming Range

Full

Full flag setting

1 to (2N - 1)

AlmostFull

Almost full setting

1 to (FULL -1)

AlmostEmpty

Almost empty setting

1 to (FULL -1)

Empty

Empty setting

0

The value of Empty is fixed at 0. When coming out of reset, the active high flags Empty and Almost Empty are set
to high, since they are true.
26

Memory Usage Guide for MachXO3 Devices
The user should specify the absolute value of the address at which the Almost Empty and Almost Full flags will go
true. For example, if the Almost Full flag is required to go true at the address location 500 for a FIFO of depth 512,
the user should specify a value of 500 in IPexpress.
The Empty and Almost Empty flags are always registered to the read clock and the Full and Almost Full flags are
always registered to the write clock.
At reset both the write and read counters are pointing to address zero. After reset is de-asserted data can be written into the FIFO_DC to the address pointed to by the write counter at the positive edge of the write clock when the
write enable is asserted
Similarly, data can be read from the FIFO_DC from the address pointed to by the read counter at the positive edge
of the read clock when read enable is asserted.
Read Pointer Reset (RPReset) is used to facilitate a retransmit operation and is more commonly used in “packetized” communications. Asserting RPReset causes the internal read pointer to be reset to zero. It is typically used
in conjunction with the assertion of Reset prior to each new ‘packet’ which resets both read and write pointers to
zero. In this application, the user must keep careful track of when a packet is written into or read from the
FIFO_DC. To avoid the possible corruption of memory, RPReset should not be asserted until the prior read cycle is
complete (that is, RdEn deasserted for one clock period). Upon the deassertion of RPReset, the Empty and Almost
Empty flags assume their correct state after one read clock cycle – this is a regular condition known as boundary
cycle latency.
The data output of the FIFO_DC can be registered or non-registered through a selection in IPexpress. The output
registers are enabled by read enable.

FIFO_DC Dual and Dynamic Threshold Options
The optional Almost Full and Almost Empty flag thresholds may be individually set for single (default) or dual
threshold operation. In addition, the thresholds may be static at configuration (default) or dynamically set through
optional ports. The implementation of Dual or Dynamic thresholds automatically creates supporting LUT-based
logic.
Table 7. EBR-Based FIFO_DC Optional Dynamic Threshold Port Definitions
Port Name in
Generated Module

Description

AmEmptyThresh

Almost Empty Single Threshold

AmFullThresh

Almost Full Single Threshold

AmEmptySetThresh

Almost Empty Set Threshold

AmEmptyClrThresh

Almost Empty Clear Threshold

AmFullSetThresh

Almost Full Set Threshold

AmFullClrThresh

Almost Full Clear Threshold

FIFO_DC Operation
If the output registers are not enabled it will take two clock cycles to read the first word out. The register for the flag
logic causes this extra clock latency. In the architecture of the emulated FIFO_DC, the internal read enables for
reading the data out is controlled not only by the read enable provided by the user but also the empty flag. When
the data is written into the FIFO, an internal empty flag is registered using write clock that is enabled by write
enable (WrEn). Another clock latency is added due to the clock domain transfer from write clock to read clock using
another register which is clocked by read clock that is enabled by read enable.
Internally, the output of this register is inverted and then ANDed with the user-provided read enable that becomes
the internal read enable to the RAM_DP which is at the core of the FIFO_DC.

27

Memory Usage Guide for MachXO3 Devices
Thus, the first read data takes two clock cycles to propagate through. During the first data out, read enable goes
high for one clock cycle, empty flag is de-asserted and is not propagated through the second register enabled by
the read enable. The first clock cycle brings the Empty Low and the second clock cycle brings the internal read
enable high (RdEn and !EF) and then the data is read out by the second clock cycle. Similarly, the first write data
after the full flag has a similar latency.
If the user has enabled the output registers, the output registers will cause an extra clock delay during the first data
out as they are clocked by the read clock and enabled by the read enable.
1. First RdEn and Clock Cycle to propagate the EF internally.
2. Second RdEn and Clock Cycle to generate internal Read Enable into the DPRAM.
3. Third RdEn and Clock Cycle to get the data out of the output registers.
Figures 30 and 31 show the internal timing waveforms for the Dual Clock FIFO (FIFO_DC).
Figure 30. FIFO_DC Without Output Registers (Non-Pipelined)
Reset

RPReset

WrClock
tSUWREN_EBR
WrEn
t HWREN_EBR
RdClock

RdEn

Data

Data_0
t SUDATA_EBR

Q

Data_1

Data_2

Data_3

Data_4

tHDATA_EBR
Invalid Data

Data_0
t CO_EBR

Full

AlmostFull

Empty

AlmostEmpty

28

Data_1

Data_2

Data_3

Data_4

Memory Usage Guide for MachXO3 Devices
Figure 31. FIFO_DC With Output Registers (Pipelined)
Reset

RPReset

WrClock
tSUWREN_EBR
WrEn
t HWREN_EBR
RdClock

RdEn

Data

Data_0
t SUDATA_EBR

Q

Data_1

Data_2

Data_3

Data_4

tHDATA_EBR
Data_1

Invalid Data

Data_2

Data_3

Data_4

t CO_EBR
Full

AlmostFull

Empty

AlmostEmpty

Distributed Single Port RAM (Distributed_SPRAM) – PFU Based
PFU-based Distributed Single Port RAM is created using the 4-input LUT (Look-Up Table) available in the PFU.
These LUTs can be cascaded to create a larger Distributed Memory sizes.
Figure 32 shows the Distributed Single Port RAM module as generated by IPexpress.
Figure 32. Distributed Single Port RAM Module Generated by IPexpress

Address
Data
Clock
WE

PFU-Based
Distributed Single Port
Memory

Q

ClockEn
Reset

The generated module makes use of the 4-input LUTs available in the PFU. Additional decode logic is generated
by utilizing the resources available in the PFU.
The various ports and their definitions for the Memory are as per Table 8.

29

Memory Usage Guide for MachXO3 Devices
Table 8. PFU-Based Distributed Single Port RAM Port Definitions
Port Name in
Generated Module

Description

Active State

Address

Address

—

Data

Data In

—

Clock

Clock

Rising Clock Edge

WE

Write Enable

Active High

ClockEn

Clock Enable

Active High

Reset

Active High

Data Out

—

Reset

1

Q

1. Reset is available only when Output Registers are enabled.

Figures 33 and 34 show the internal timing waveforms for the Distributed Single Port RAM (Distributed_SPRAM).
Figure 33. PFU-Based Distributed Single Port RAM Timing Waveform – Without Output Registers

Clock

ClockEn
t SUWREN_PFU

tHWREN_PFU

WE
t SUADDR_PFU

Add_0

Address

Add_1

Data_0

Data
t SUDATA_PFU

Q

tHADDR_PFU

Add_0

Add_1

Add_2

Data_1
tHDATA_PFU

Invalid Data

Data_0
t CORAM_PFU

30

Data_1

Data_2

Memory Usage Guide for MachXO3 Devices
Figure 34. PFU- Based Distributed Single Port RAM Timing Waveform – With Output Registers

Clock

ClockEn
t SUWREN_PFU

tHWREN_PFU

WE
t SUADDR_PFU

Address

tHADDR_PFU

Add_0

Add_1

Data_0

Data
t SUDATA_PFU

Add_0

Add_1

Add_2

Data_1
tHDATA_PFU

Invalid Data

Q

Data_0

Data_1

t CO?

Distributed Dual Port RAM (Distributed_DPRAM) – PFU Based
PFU-based Distributed Dual Port RAM is created using the 4-input LUT (Look-Up Table) available in the PFU.
These LUTs can be cascaded to create larger Distributed Memory sizes.
Figure 35 shows the Distributed Dual Port RAM module as generated by IPexpress.
Figure 35. Distributed Dual Port RAM Module Generated by IPexpress

WrAddress
Data
WrClock
WE
WrClockEn

PFU-Based
Distributed Dual Port
Memory

Q

RdAddress
RdClock
RdClockEn
Reset

The generated module makes use of the 4-input LUTs available in the PFU. Additional decode logic is generated
by utilizing the resources available in the PFU.
The various ports and their definitions are listed in Table 9.

31

Memory Usage Guide for MachXO3 Devices
Table 9. PFU-Based Distributed Dual Port RAM Port Definitions
Port Name in
Generated Module

Description

Active State

WrAddress

Write Address

—

Data

Data Input

—

WrClock

Write Clock

Rising Clock Edge

WE

Write Enable

Active High

WrClockEn

Write Clock Enable

Active High

RdAddress

Read Address

—

*RdClock

Read Clock

Rising Clock Edge

*RdClockEn

Read Clock Enable

Active High

Reset*

Reset

Active High

Q

Data Out

—

*Denotes optional port.

The optional ports Read Clock (RdClock) and Read Clock Enable (RdClockEn) are not available in the hardware
primitive. These are generated by IPexpress when the user wants to enable the output registers in the IPexpress
configuration.
Figures 36 and 37 show the internal timing waveforms for the Distributed Dual Port RAM (Distributed_DPRAM).
Figure 36. PFU-Based Distributed Dual Port RAM Timing Waveform – Without Output Registers
WrClock
tSUCE_PFU

t HCE_PFU

WrClockEn

WE

RdClock
tSUCE_PFU

tHCE_PFU

RdClockEn
t SUADDR_PFU

WrAddress

t HADDR_PFU

Add_0
t SUADDR_PFU

Add_1

Add_2

t HADDR_PFU

RdAddress

Add_0

Data_0

Data
t SUDATA_PFU

Q

Data_1

Add_1

Add_2

Data_2

t HDATA_PFU

Invalid Data

Data_0
t CORAM_PFU

32

Data_1

Dat
a_
2

Memory Usage Guide for MachXO3 Devices
Figure 37. PFU-Based Distributed Dual Port RAM Timing Waveform – With Output Registers
WrClock
tSUCE_EBR

t HCE_EBR

WrClockEn

WE

RdClock
t SUCE_EBR

tHCE_EBR

RdClockEn
t SUADDR_EBR

WrAddress

tHADDR_EBR

Add_0
t SUADDR_EBR

Add_1

Add_2

tHADDR_EBR

RdAddress

Add_0

Data

Data_0
tSUDATA_EBR

Data_1

Add_1

Add_2

Data_2

tHDATA_EBR

Q

Invalid Data

Data_0

Dat
a_
1

Distributed ROM (Distributed_ROM) – PFU-Based
PFU-based Distributed ROM is created using the 4-input LUT (Look-Up Table) available in the PFU. These LUTs
can be cascaded to create a larger Distributed Memory sizes.
Figure 38 shows the Distributed ROM module as generated by IPexpress.
Figure 38. Distributed ROM Generated by IPexpress

Address
OutClock
OutClockEn

PFU-Based
Distributed ROM

Q

Reset

The generated module makes use of the 4-input LUTs available in the PFU. Additional decode logic is generated
by utilizing the resources available in the PFU.
The various ports and their definitions are listed in Table 10.

33

Memory Usage Guide for MachXO3 Devices
Table 10. PFU-Based Distributed ROM Port Definitions
Port Name in
Generated Module

Description

Active State

Address

Address

—

OutClock*

Out Clock

Rising Clock Edge

OutClockEn*

Out Clock Enable

Active High

Reset*

Reset

Active High

Q

Data Out

—

*Denotes optional port.

The optional ports Out Clock (OutClock) and Out Clock Enable (OutClockEn) are not available in the hardware
primitive. These are generated by the IPexpress when the user wants to enable the output registers in the IPexpress configuration.
Figures 39 and 40 show the internal timing waveforms for the Distributed ROM.
Figure 39. PFU-Based ROM Timing Waveform – Without Output Registers

OutClock

OutClockEn
t SUADDR_PFU

Address

Q

t HADDR_PFU

Add_0

Add_1

Invalid Data

Data_0

Add_2

Data_1

Data_2

t CORAM_PFU

Figure 40. PFU-Based ROM Timing Waveform – With Output Registers

OutClock

OutClockEn
t SUADDR_PFU

Address

Q

tHADDR_PFU

Add_0

Add_1

Invalid Data

Add_2

Data_0

34

Data_1

Memory Usage Guide for MachXO3 Devices
RAM-Based Shift Register
The Distributed SPRAM blocks in the MachXO3L/LF devices, in combination with LUT-based logic, can be configured as a RAM-based Shift Register. IPexpress allows users to generate the Verilog-HDL or VHDL netlist for the
Shift Register length, as per design requirements.
IPexpress generates the Shift Register module as shown in Figure 41.
Figure 41. RAM-Based Shift Register Generated by IPexpress
Din
Addr
Clock

RAM-Based
Shift Register

Q

ClockEn
Reset

The generated module makes use of the 4-input LUTs available in the PFU. Additional logic is generated by utilizing the resources available in the PFU.
The various ports and their definitions are listed in Table 11.
Table 11. RAM-Based Shift Register Port Definitions
Port Name in
Generated Module

Description

Active State

Din

Data In

—

*Addr

Address

—

Clock

Clock

Rising Clock Edge

ClockEn

Clock Enable

Active High

Reset

Reset

Active High

Q

Data Out

—

*Denotes optional port.

The optional Addr port is available only when Variable Length type is selected. It is generated by IPexpress when
the user wants to enable the Variable Length operation in the IPexpress configuration. Figures 42 and 43 show the
internal timing waveforms for the RAM-Based Shift Register.

35

Memory Usage Guide for MachXO3 Devices
Figure 42. RAM-Based Shift Register Timing Waveform – Without Output Registers (Shift = 2)

Clock
t SUCE_PFU

tHCE_PFU

ClockEn

Data_0

Din
t SUDATA_PFU

Data_1

Data_3

Data_4

Data_0

Data_1

Data_2

tHDATA_PFU

Invalid Data

Q

Data_2

Data_3

tCO_RAM
(SHIFT-1) Clock Periods
Delay

Figure 43. RAM-Based Shift Register Timing Waveform – With Output Registers (Shift = 2)

Clock
t SUCE_PFU

tHCE_PFU

ClockEn

Data_0

Din
t SUDATA_PFU

Q

Data_1

Data_2

Data_3

Data_4

tHDATA_PFU

Invalid Data

Data_0
tCOREG

(SHIFT) Clock Periods Delay

36

Data_1

Data_2

Memory Usage Guide for MachXO3 Devices

MachXO3L/LF Primitives
Single Port RAM (SP8KC) – EBR Based
The Single Port RAM primitive is shown below.
Figure 44. Single Port RAM (SP8KC)

AD[12:0]
DI[8:0]
CLK
CE
OCE

EBR

DO[8:0]

RST
WE
CS[2:0]

Table 12. EBR-Based Single Port Memory Port Definitions
Port Name in the EBR
Block Primitive (SP8KC)

Description

Active State

AD

Address Bus

—

DI

Data In

—

CLK

Clock

Rising Clock Edge

CE

Clock Enable

Active High

OCE

Output Clock Enable

Active High

RST

Reset

Active High

WE

Write Enable

Active High

CS[2:0]

Chip Select

—

DO

Data Out

—

Each SP8KC primitive consists of 9,216 bits of RAM. The possible values for address depth and data width for the
SP8KC primitive are listed in Table 13.
Table 13. Single Port Memory Sizes for 9K Memories in MachXO3L/LF
Single Port
Memory Size

Input Data

Output Data

Address [MSB:LSB]

8K x 1

DI

DO

AD[12:0]

4K x 2

DI[1:0]

DO[1:0]

AD[12:1]

2K x 4

DI[3:0]

DO[3:0]

AD[12:2]

1K x 9

DI[8:0]

DO[8:0]

AD[12:3]

Table 14 shows the various attributes available for the SP8KC. Some of these attributes are user selectable
through the IPexpress GUI. For detailed attribute definitions, refer to Appendix A. Attribute Definitions.

37

Memory Usage Guide for MachXO3 Devices
Table 14. Single Port RAM Attributes for MachXO3L/LF (SP8KC)
Attribute

Description

Default
Value

Values
1, 2, 4, 9

9

User Selectable
through IPexpress

DATA_WIDTH

Data Word Width

REGMODE

Register Mode (Pipelining) NOREG, OUTREG

NOREG

Yes

RESETMODE

Selects Reset Type

ASYNC, SYNC

SYNC

Yes

CSDECODE

Chip Select Decode

0b000, 0b001, 0b010, 0b011, 0b000
0b100, 0b101, 0b110, 0b111
0b000

No

WRITEMODE

Read/Write Behavior

NORMAL, WRITETHROUGH, READBEFOREWRITE

NORMAL

Yes

DISABLED

No

GSR

Enable Global Set Reset

ENABLED, DISABLED

INITVAL_00 .. INITVAL_1F

Initialization Value

0x0000000000000000000000
000000000000000000000000
000000000000000000000000
0000000000

0x00000000000
0000000000000
0000000000000
0000000000000
0000000000000
....
0000000000000
0xFFFFFFFFFFFFFFFFFFFF 0000
FFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFF

Yes

No

(80- character hex strings)
ASYNC_RESET_RELEASE Reset Release

ASYNC, SYNC

SYNC

Yes

INIT_DATA (MachXO3LF
Only)

STATIC, DYNAMIC

STATIC

Yes

Init Values Status

True Dual Port RAM (DP8KC) – EBR-Based
The True Dual Port RAM primitive is shown below.
Figure 45. True Dual-Port RAM (DP8KC)

DIA[8:0]

DIB[8:0]

ADA[12:0]

ADB[12:0]

CLKA

CLKB

CEA

CEB

EBR
RSTA

RSTB

WEA

WEB

CSA[2:0]

CSB[2:0]

OCEA

OCEB

DOA[8:0]

DOB[8:0]

38

Memory Usage Guide for MachXO3 Devices
Table 15. EBR-Based True Dual Port Memory Port Definitions
Port Name in the EBR Block
Primitive (DP8KC)
DIA, DIB

Description

Active State

Input Data port A and port B

ADA, ADB

Address Bus port A and port B

CLKA, CLKB

Clock for PortA and PortB

—
—
Rising Clock Edge

CEA, CEB

Clock Enables for Port CLKA and CLKB

Active High

RSTA, RSTB

Reset for PortA and PortB

Active High

WEA, WEB

Write enable port A and port B

Active High

CSA[2:0], CSB[2:0]

Chip Selects for each port

OCEA, OCEB

Output Clock Enables for PortA and PortB

DOA, DOB

Output Data port A and port B

—
Active High
—

Each DP8KC primitive consists of 9,216 bits of RAM. The possible values for address depth and data width for the
DP8KC primitive are listed in Table 16.
Table 16. Dual Port Memory Sizes for 9K Memory in MachXO3L/LF
Dual Port
Memory Size

Input Data
Port A

Input Data
Port B

Output Data
Port A

Output Data
Port B

Address Port A Address Port B
[MSB:LSB]
[MSB:LSB]

8K x 1

DIA

DIB

DOA

DOB

ADA[12:0]

ADB[12:0]

4K x 2

DIA[1:0]

DIB[1:0]

DOA[1:0]

DOB[1:0]

ADA[12:1]

ADB[12:1]

2K x 4

DIA[3:0]

DIB[3:0]

DOA[3:0]

DOB[3:0]

ADA[12:2]

ADB[12:2]

1K x 9

DIA[8:0]

DIB[8:0]

DOA[8:0]

DOB[8:0]

ADA[12:3]

ADB[12:3]

Table 17 shows the various attributes available for the True Dual Port Memory (RAM_DP_TRUE). Some of these
attributes are user-selectable through the IPexpress GUI. For detailed attribute definitions, refer to Appendix A.
Attribute Definitions.

39

Memory Usage Guide for MachXO3 Devices
Table 17. Dual Port RAM Attributes for MachXO3L/LF (DP8KC)
Attribute
DATA_WIDTH_A

Description

Default
Value

Values

User Selectable
through IPexpress

Data Word Width Port A

1, 2, 4, 9

9

DATA_WIDTH_B

Data Word Width Port B

1, 2, 4, 9

9

Yes

REGMODE_A

Register Mode (Pipelining) NOREG, OUTREG
for Port A

NOREG

Yes

REGMODE_B

Register Mode (Pipelining) NOREG, OUTREG
for Port B

NOREG

Yes

RESETMODE

Selects the Reset type

ASYNC, SYNC

SYNC

Yes

CSDECODE_A

Chip Select Decode
for Port A

0b000, 0b001, 0b010, 0b011, 0b000
0b100, 0b101, 0b110, 0b111

No

CSDECODE_B

Chip Select Decode
for Port B

0b000, 0b001, 0b010, 0b011, 0b000
0b100, 0b101, 0b110, 0b111

No

WRITEMODE_A

Read / Write Mode
for Port A

NORMAL, WRITETHROUGH, READBEFOREWRITE

NORMAL

Yes

WRITEMODE_B

Read / Write Mode
for Port B

NORMAL, WRITETHROUGH, READBEFOREWRITE

NORMAL

Yes

DISABLED

No

GSR

Enables Global Set Reset ENABLE, DISABLE

INITVAL_00 .. INITVAL_1F

Initialization Value

0x00000000000
0000000000000
0000000000000
0000000000000
0000000000000
....
0000000000000
0xFFFFFFFFFFFFFFFFFFFF 0000
FFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFF

0x0000000000000000000000
000000000000000000000000
000000000000000000000000
0000000000

Yes

No

(80-character hex strings)
ASYNC_RESET_RELEASE Reset Release
INIT_DATA (MachXO3LF
Only)

Init Values Status

ASYNC, SYNC

SYNC

Yes

STATIC, DYNAMIC

STATIC

Yes

40

Memory Usage Guide for MachXO3 Devices
Pseudo Dual Port RAM (PDPW8KC) – EBR-Based
The Pseudo Dual Port RAM primitive is shown below.
Figure 46. Pseudo Dual-Port RAM (PDPW8KC)

ADW[8:0]
DI[17:0]

ADR[12:0]

BE[1:0]
CLKW
CEW

CLKR

EBR

CER
DO[17:0]

RST

OCER
CSR[2:0]
CSW[2:0]

Table 18. EBR-Based Pseudo-Dual Port Memory Port Definitions
Port Name in the EBR Block
Primitive (PDPW8KC)

Description

ADW

Write Address

—

DI

Write Data

—

Active State

BE

Byte Enable

Active High

CLKW

Write Clock

Rising Edge

CEW

Write Clock Enable

Active High

RST

Reset

Active High

CSW

Write Chip Select

—

ADR

Read Address

—

CLKR

Read Clock

Rising Edge

CER

Read Clock Enable

Active High

DO

Read Data

—

OCER

Read Output Clock Enable

Active High

CSR

Read Chip Select

—

Each PDPW8KC primitive consists of 9,216 bits of RAM. The possible values for address depth and data width for
the PDPW8KC primitive are listed in Table 19.

41

Memory Usage Guide for MachXO3 Devices
Table 19. Pseudo-Dual Port Memory Sizes for 9K Memory in MachXO3L/LF
Pseudo-Dual Read
Port Memory Size

Write Data Port

Read Data Port

Read Address Port
[MSB:LSB]

Write Address Port
[MSB:LSB]

8K x 1

DI[17:0]

DO

ADR[12:0]

ADW[8:0]

4K x 2

DI[17:0]

DO[1:0]

ADR[12:1]

ADW[8:0]

2K x 4

DI[17:0]

DO[3:0]

ADR[12:2]

ADW[8:0]

1K x 9

DI[17:0]

DO[8:0]

ADR[12:3]

ADW[8:0]

512 x 18

DI[17:0]

DO[17:0]*

ADR[12:4]

ADW[8:0]

Note: High and low bytes are swapped with regard to DI word.

Table 20 shows the various attributes available for the Pseudo Dual Port Memory (RAM_DP). Some of these attributes are user selectable through the IPexpress GUI. For detailed attribute definitions, refer to Appendix A. Attribute Definitions.
Table 20. Pseudo-Dual Port RAM Attributes for MachXO3L/LF (PDPW8KC)
Attribute
DATA_WIDTH_W

Description

Values

Default Value
18

User Selectable
through IPexpress

Write Data Word Width

18

DATA_WIDTH_R

Read Data Word Width

1, 2, 4, 9, 18

9

Yes

REGMODE

Register Mode (Pipelining) NOREG, OUTREG

NOREG

Yes

RESETMODE

Selects the Reset type

ASYNC, SYNC

SYNC

Yes

CSDECODE_W

Chip Select Decode for
Write

0b000, 0b001, 0b010, 0b011, 0b000
0b100, 0b101, 0b110, 0b111

No

CSDECODE_R

Chip Select Decode for
Read

0b000, 0b001, 0b010, 0b011, 0b000
0b100, 0b101, 0b110, 0b111

No

GSR

Enables Global Set Reset ENABLE, DISABLE

INITVAL_00 .. INITVAL_1F

Initialization Value

DISABLED

Yes

No

0x00000000000
0000000000000
0000000000000
0000000000000
0000000000000
0000000000000
0xFFFFFFFFFFFFFFFFFFFF 0000
FFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFF FFFFFFF
(80- character hex strings)

No

ASYNC_RESET_RELEASE Reset Release

ASYNC, SYNC

SYNC

Yes

INIT_DATA (MachXO3LF
Only)

STATIC, DYNAMIC

STATIC

Yes

Init Values Status

0x0000000000000000000000
000000000000000000000000
000000000000000000000000
0000000000
....

42

Memory Usage Guide for MachXO3 Devices
Dual-Clock FIFO (FIFO8KB) – EBR Based
The Dual-Clock FIFO RAM primitive is shown below.
Figure 47. FIFO_DC Primitive (FIFO8KB)

AFF
FF
AEF

DI[17:0]

EF

CLKW

DO[17:0]

WE
RST

EBR

FULLI
CSW[1:0]

ORE
CLKR
RE
EMPTYI
CSR[1:0]
RPRST

Table 21. EBR-Based FIFO_DC Memory Port Definitions
Port Name in Primitive
(FIFO8KB)

Description

Active State

DI

Data Input

—

CLKW

Write Port Clock

Rising Clock Edge

WE

Write Enable

Active High

FULLI

Write inhibit

Active High

CSW

Write Chip Select

Active High

AFF

Almost Full Flag

Active High

FF

Full Flag

Active High

AEF

Almost Empty

Active High

EF

Empty Flag

Active High

DO

Data Output

—

ORE

Output Read Enable

Active High

CLKR

Read Port Clock

Rising Clock Edge

RE

Read Enable

Active High

EMPTYI

Read inhibit

Active High

CSR

Read Chip Select

Active High

RPRST

Read Pointer Reset

Active High

Each FIFO8KB primitive consists of 9,216 bits of RAM. The possible values for address depth and data width for
the FIFO8KB primitive are listed in Table 22.

43

Memory Usage Guide for MachXO3 Devices
Table 22. MachXO3L/LF FIFO_DC Data Widths Sizes
FIFO Size

Input Data

Output Data

8K x 1

DI

DO

4K x 2

DI[1:0]

DO[1:0]

2K x 4

DI[3:0]

DO[3:0]

1K x 9

DI[8:0]

DO[8:0]

512 x 18

DI[17:0]

DO[17:0]

Table 23 shows the various attributes available for the FIFO_DC. Some of these attributes are user-selectable
through the IPexpress GUI. For detailed attribute definitions, refer to Appendix A. Attribute Definitions.
Table 23. FIFO_DC Attributes for MachXO3L/LF (FIFO8KB)
Attribute

Description

Values

User Selectable
Default Value through IPexpress

DATA_WIDTH_W

Data Width Write Mode

1, 2, 4, 9, 18

18

YES

DATA_WIDTH_R

Data Width Read Mode

1, 2, 4, 9, 18

18

YES

REGMODE

Register Mode

NOREG, OUTREG

NOREG

YES

RESETMODE

Select Reset Type

ASYNC, SYNC

ASYNC

YES

CSDECODE_W

Chip Select Decode for Write
Mode

0b00, 0b01, 0b10, 0b11

0b00

NO

CSDECODE_R

Chip Select Decode for Read
Mode

0b00, 0b01, 0b10, 0b11

0b00

NO

GSR

Enable Global Set Reset

ENABLED, DISABLED

DISABLED

NO

AEPOINTER

Almost Empty Pointer

0b00000000000000, .....,
0b01111111111111

—

YES

AFPOINTER

Almost Full Pointer

0b00000000000000, .....,
0b01111111111111

—

YES

FULLPOINTER

Full Pointer

0b00000000000000, .....,
0b10000000000000

—

YES

FULLPOINTER1

Full Pointer minus 1

0b00000000000000, .....,
0b01111111111111

—

NO

AFPOINTER1

Almost Full Pointer minus 1

0b00000000000000, .....,
0b01111111111110

—

NO

AEPOINTER1

Almost Empty Pointer plus 1

0b00000000000000, .....,
0b10000000000000

—

NO

ASYNC_RESET_RELEASE Reset Release

ASYNC, SYNC

SYNC

Yes

INIT_DATA (MachXO3LF
Only)

STATIC, DYNAMIC

STATIC

Yes

Init Values Status

44

Memory Usage Guide for MachXO3 Devices
FIFO_DC Flags
The FIFO_DC have four flags available: Empty, Almost Empty, Almost Full and Full. Almost Empty, Almost Full and
Full flags have a programmable range.
The program ranges for the four FIFO_DC flags are specified in Table 24.
Table 24. FIFO_DC Flag Settings
Module Flag Name
Full

AlmostFull

FIFO Attribute Name

Description

Programming Range

Program Bits

FULLPOINTER

Full setting

1 to (2N - 1)

14

FULLPOINTER1

Full – 1

1 to (FULL-1)

14

AFPOINTER

Almost full setting

1 to (FULL -1)

14

AFPOINTER1

Almost full – 1

1 to (FULL -1)

14

AEPOINTER1

Almost empty + 1

1 to (FULL -1)

14

AlmostEmpty

AEPOINTER

Almost empty setting

1 to (FULL -1)

14

Empty

—

Empty setting

0

—

The value of Empty is fixed at 0. When coming out of reset, the active high flags Empty and Almost Empty are set
to high, since they are true.
Careful attention is required to set the Pointer attributes to match the desired behavior. Refer to Appendix B. Setting FIFO_DC Pointer Attributes.
The Empty and Almost Empty flags are always registered to the read clock and the Full and Almost Full flags are
always registered to the write clock.

Distributed SPRAM (SPR16X4C) – PFU Based
The PFU based distributed single port RAM primitive is shown below.
Figure 48. Distributed_SPRAM Primitive (SPR16X4C)

AD[3:0]
DI[3:0]
CK

PFU

DO[3:0]

WRE

Table 25. PFU based Distributed Single Port RAM Port Definitions
Port Name in the PFU
Primitive

Description

AD[3:0]

Address

—

DI[3:0]

Data In

—

Active State

CK

Clock

Rising Clock Edge

WRE

Write Enable

Active High

DO[3:0]

Data Out

—

45

Memory Usage Guide for MachXO3 Devices
Distributed DPRAM (DPR16X4C) – PFU Based
The PFU based distributed Pseudo Dual-port RAM primitive is below.
Figure 49. Distributed DPRAM Primitive (DPR16X4C)

RAD[3:0]

WAD[3:0]
DI[3:0]

PFU

WCK

DO[3:0]

WRE

Table 26. PFU based Distributed Dual-Port RAM Port Definitions
Port Name in the EBR
Block Primitive

Description

Active State

WAD[3:0]

Write Address

—

DI[3:0]

Data Input

—

WCK

Write Clock

Rising Clock Edge

WRE

Write Enable

Active High

RAD[3:0]

Read Address

—

DO[3:0]

Data Out

—

Distributed ROM (ROMnnnX1A) – PFU Based
The PFU based distributed ROM primitives are shown below.
Figure 50. Distributed_ROM Primitive (ROM16X1A)

AD[3:0]

PFU

DO

PFU

DO

Figure 51. Distributed_ROM Primitive (ROM32X1A)

AD[4:0]

46

Memory Usage Guide for MachXO3 Devices
Figure 52. Distributed_ROM Primitive (ROM64X1A)

AD[5:0]

PFU

DO

PFU

DO

PFU

DO

Figure 53. Distributed_ROM Primitive (ROM128X1A)

AD[6:0]

Figure 54. Distributed_ROM Primitive (ROM256X1A)

AD[7:0]

Table 27. PFU-Based Distributed ROM Port Definitions
Port Name in the PFU
Block Primitive

Description

AD[n:0]

Address

DO

Data Out

47

Memory Usage Guide for MachXO3 Devices

Initializing Memory
In the EBR based ROM or RAM memory modes and the PFU-based ROM memory mode, it is possible to specify
the power-on state of each bit in the memory array. Each bit in the memory array can have one of two values: 0 or
1.

Initialization File Format
The initialization file is an ASCII file, which can be created or edited using any ASCII editor. IPexpress supports
three different types of memory file formats:
1. Binary file
2. Hex File
3. Addressed Hex
The file name for the memory initialization file is *.mem (.mem). Each row depicts the value to be
stored in a particular memory location and the number of characters (or the number of columns) represents the
number of bits for each address (or the width of the memory module).
The initialization file is primarily used for configuring the ROMs. The EBR in RAM can also use the initialization file
to preload the memory contents.
Binary File
The file is a text file of 0’s and 1’s. The rows indicate the number of words and columns indicate the width of the
memory. In the example below, the memory size is 20x32; that is 20 addresses with each word of 32 bit length.
00100000010000000010000001000000
00000001000000010000000100000001
00000010000000100000001000000010
00000011000000110000001100000011
00000100000001000000010000000100
00000101000001010000010100000101
00000110000001100000011000000110
00000111000001110000011100000111
00001000010010000000100001001000
00001001010010010000100101001001
00001010010010100000101001001010
00001011010010110000101101001011
00001100000011000000110000001100
00001101001011010000110100101101
00001110001111100000111000111110
00001111001111110000111100111111
00010000000100000001000000010000
00010001000100010001000100010001
00010010000100100001001000010010
00010011000100110001001100010011

48

Memory Usage Guide for MachXO3 Devices
Hex File
The Hex file is a text file of hex characters arranged in a similar row-column arrangement. The number of rows in
the file is same as the number of address locations, with each row indicating the content of the memory location. In
the example below, the memory size is 8x16; that is 8 addresses with each word of 16 bit length.
A001
0B03
1004
CE06
0007
040A
0017
02A4
Addressed Hex
Addressed Hex consists of lines of address and data. Each line starts with an address, followed by a colon, and
any number of data. The format of memfile is address: data data data data ... where address and data are hexadecimal numbers.
–A0 : 03 F3 3E 4F
–B2 : 3B 9F
The first line puts 03 at address A0, F3 at address A1, 3E at address A2,and 4F at address A3. The second line
puts 3B at address B2 and 9F at address B3.
There is no limitation on the values of address and data. The value range is automatically checked based on the
values of addr_width and data_width. If there is an error in an address or data value, an error message is printed.
Users need not specify data at all address locations. If data is not specified at certain address, the data at that location is initialized to 0. IPexpress makes memory initialization possible both through the synthesis and simulation
flows.

49

Memory Usage Guide for MachXO3 Devices

Technical Support Assistance
e-mail:

techsupport@latticesemi.com

Internet: www.latticesemi.com

Revision History
Date

Version

March 2015

1.1

Change Summary
General updates:
— Product name/trademark adjustment.
— Added MachXO3LF support.
— Changed ispLEVER to Diamond.
Updated Introduction section.
— Added UFM information.
Updated Memories in MachXO3L/LF Devices section.
— Revised Figure 1, Top View of the MachXO3L-1300 Device and
Figure 2, Top View of the MachXO3L-4300 Device. Added UFM.
Updated IPexpress Flow section.
— Indicated MachXO3L in Figure 5, Example Generating Pseudo Dual
Port RAM (RAM_DP) Module Customization (MachXO3L).
— Added Figure 6, Example Generating Pseudo Dual Port RAM
(RAM_DP) Module Customization (MachXO3LF).
— Added information on storing memory initialization data in UFM.
Updated MachXO3L/LF Primitives section.
Revised the following tables to add INIT_DATA (MachXO3LF Only) attribute:
— Table 14, Single Port RAM Attributes for MachXO3L/LF
— Table 17, Dual Port RAM Attributes for MachXO3L/LF (DP8KC)
— Table 20, Pseudo-Dual Port RAM Attributes for MachXO3L/LF
(PDPW8KC)
— Table 23, FIFO_DC Attributes for MachXO3L (FIFO8KB)
Updated Appendix A. Attribute Definitions section.
Added INIT_DATA (MachXO3LF Only)

April 2014

01.0

Initial release.

50

Memory Usage Guide for MachXO3 Devices

Appendix A. Attribute Definitions
DATA_WIDTH
Data width is associated with the RAM and FIFO elements. The DATA_WIDTH attribute defines the number of bits
in each word. It takes the values defined in the RAM size tables in each memory module.

REGMODE
REGMODE, or the Register mode attribute, is used to enable pipelining in the memory. This attribute is associated
with the RAM and FIFO elements. The REGMODE attribute takes the NOREG or OUTREG mode parameter that
disables and enables the output pipeline registers.

RESETMODE
The RESETMODE attribute allows users to select the mode of reset in the memory. This attribute is associated
with the block RAM elements. RESETMODE takes two parameters: SYNC and ASYNC. SYNC means that the
memory reset is synchronized with the clock. ASYNC means that the memory reset is asynchronous to clock.

CSDECODE
CSDECODE, or the Chip Select Decode attributes, are associated to block RAM elements. Chip Select (CS) is a
useful port when multiple cascaded EBR blocks are required by the memory. The CS signal forms the MSB for the
address when multiple EBR blocks are cascaded. CS is a 3-bit bus, so it can cascade eight memories easily.
CSDECODE takes the following parameters: “000”, “001”, “010”, “011”, “100”, “101”, “110”, and “111”. CSDECODE
values determine the decoding value of CS[2:0]. CSDECODE_W is chip select decode for write and
CSDECODE_R is chip select decode for read for Pseudo Dual Port RAM. CSDECODE_A and CSDECODE_B are
used for true dual port RAM elements and refer to the A and B ports.

WRITEMODE
The WRITEMODE attribute is associated with the block RAM elements. It takes the NORMAL, WRITETHROUGH,
and READBEFOREWRITE mode parameters.
In NORMAL mode, the output data does not change or get updated during the write operation. This mode is supported for all data widths.
In WRITETHROUGH mode, the output data is updated with the input data during the write cycle. This mode is supported for all data widths.
In READBEFOREWRITE mode, the output data port is updated with the existing data stored in the write address,
during a write cycle. This mode is supported for x9 and x18 data widths.
WRITEMODE_A and WRITEMODE_B are used for dual port RAM elements and refer to the A and B ports in case
of a True Dual Port RAM.
For all modes of the True Dual Port module, simultaneous read access from one port and write access from the
other port to the same memory address is not recommended. The read data may be unknown in this situation.
Also, simultaneous write access to the same address from both ports is not recommended. When this occurs, the
data stored in the address becomes undetermined when one port tries to write a 'H' and the other tries to write a
'L'.
It is recommended that users implement control logic to identify this situation if it occurs and then either:
1. Implement status signals to flag the read data as possibly invalid, or
2. Implement control logic to prevent the simultaneous access from both ports.

GSR
GSR, the Global Set/ Reset attribute, is used to enable or disable the global set/reset for the RAM element.

51

Memory Usage Guide for MachXO3 Devices
ASYNC_RESET_RELEASE
When RESETMODE is set to ASYNC, the ASYNC_RESET_RELEASE attribute allows users to select how the
reset is de-asserted/released: When set to SYNC, the reset is de-asserted synchronously to the clock. When set to
ASYNC, the memory reset is released asynchronously (without relation to the clock).

INIT_DATA (MachXO3LF Only)
The INIT_DATA attribute allows the user to specify how EBR initialization values are stored and accessed. When
set to STATIC, the EBR initialization values are compressed by the software and stored in a variable location in
UFM (User Flash Memory). When set to DYNAMIC, the initialization values are not compressed, and stored in a
user-accessible, fixed location in UFM.

52

Memory Usage Guide for MachXO3 Devices

Appendix B. Setting FIFO_DC Pointer Attributes
The FIFO_DC uses pointer attributes to control the Full, Almost Full and Almost Empty flags.
The values for the pointer attributes are set according to the following table and equations:
Table 28. Pointer Attribute Setting Equations
Flag

Trip Value

Full

ff

Almost Full

aff

Almost Empty

Attribute

Port Width

FULLPOINTER
FULLPOINTER1
AFPOINTER
AFPOINTER1
AEPOINTER

aef

AEFOINTER1

wrw1
wrw1
rdw1

Equation
[(ff - 1) * wrw] + 1
[(ff - 2) * wrw] + 1
[(aff - 1) * wrw] + 1
[(aff - 2) * wrw] + 1
[(aef) * rdw] + rdw - 1
[(aef + 1) * rdw] + rdw - 1

1. Set Write Port Width (wrw) and Read Port Width (rdw) per Table 29.

Table 29. Port Width Values
Attribute:
Data_width_w,
Data_width_r

Port Width: wrw, rdw

1

1

2

2

4

4

9

8

18

16

The user should specify the absolute value of the address at which the Almost Empty and Almost Full flags will go
true. For example, if the Almost Full flag is required to go true at the address location 500 for a FIFO of depth 512,
the user should specify aff = 500.
Worked Example:
Write Data Width: 18 => use wrw=16
Read Data Width: 4 => use rdw = 4

Full: ff =16 ( (16) 18-bit words)
Almost Full: aff = 14
Almost Empty: aef = 8 ( (8) 4-bit words, which corresponds to (2) 16-bit writes)
Empty: 0 (always)

53

Memory Usage Guide for MachXO3 Devices
Calculated Values:
FULLPOINTER = [(ff - 1) * wrw] + 1
= [(16 – 1) * 16] + 1
= (15 * 16) + 1
= 241
=> 14’ b00_0000_1111_0001
FULLPOINTER1 = [(ff - 2) * wrw] + 1
= [(16 – 2) * 16] + 1
= (14 * 16) + 1
= 225
=> 14’ b00_0000_1110_0001
AFPOINTER = [(aff - 1) * wrw] + 1
= [(14 – 1) * 16] + 1
= (13 * 16) + 1
= 209
=> 14’ b00_0000_1101_0001
AFPOINTER1 = [(aff - 2) * wrw] + 1
= [(14 – 2) * 16] + 1
= (12 * 16) + 1
= 193
=> 14’ b00_0000_1100_0001
AEPOINTER = [(aef) * rdw] + rdw - 1
= (8 * 4) + 4 - 1
= (8 * 4) + 3
= 35
=> 14’ b00_0000_0010_0011
AEFOINTER1 = [(aef + 1) * rdw] + rdw - 1
= [(8+1) * 4] + 4 - 1
= (9 * 4) + 3
= 39
=> 14’ b00_0000_0010_0111

54



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.6
Linearized                      : Yes
Author                          : Lattice Semiconductor
Create Date                     : 2000:11:21 10:30:03Z
Keywords                        : MachXO3L, MachXO3LF, memory
Modify Date                     : 2015:02:27 12:09:20+08:00
Subject                         : Memory Usage Guide for MachXO3L Devices
Has XFA                         : No
Language                        : en
Tagged PDF                      : Yes
XMP Toolkit                     : Adobe XMP Core 5.2-c001 63.139439, 2010/09/27-13:37:26
Format                          : application/pdf
Description                     : Memory Usage Guide for MachXO3L Devices
Title                           : TN1290 - Memory Usage Guide for MachXO3L Devices
Creator                         : Lattice Semiconductor
Producer                        : Acrobat Distiller 10.1.10 (Windows)
Creator Tool                    : FrameMaker 10.0.2
Metadata Date                   : 2015:02:27 12:09:20+08:00
Document ID                     : uuid:6a0be1ac-25a0-4dce-922d-1002ea12b9df
Instance ID                     : uuid:89d746c3-ed50-4534-b648-7ec97bfc1eb5
Page Mode                       : UseOutlines
Page Count                      : 54
Signing Date                    : 2015:02:27 12:09:20+08:00
Signing Authority               : ARE Acrobat Product v8.0 P23 0002337
Annotation Usage Rights         : Create, Delete, Modify, Copy, Import, Export
EXIF Metadata provided by EXIF.tools

Navigation menu