Example: DDR SDRAM

Top  Previous  Next

This example shows how a Diamond task can use the DDR2 SDRAM connected to the FPGA of the SignalMaster board.

 

The example has three tasks.  Task task_0 runs on the DSP; it writes data to the SDRAM, reads it back, and checks that no data corruption has occurred.

The other two tasks run on the FPGA.  Task ddrsdram_2ports provides access to the DDR2 SDRAM controller which is automatically implemented by Diamond when it detects that a task attempts to use the DDR2 SDRAM.

 

Task chan_router is used by the DSP task to send control information to other tasks in the firmware. It routes the data it receives on its input port to one of its output ports. This is an alternative to using custom registers.

 

 

Running the Example

Users of the SignalMaster Quad should select the type of board they have as shown here.

 

There are two versions of the example:

'smq.sdram' is for a SignalMaster Quad Virtex4

'smd.sdram' is for a SignalMaster Dual

 

You can build the application by typing Ctrl+B and then execute it by clicking run. Note that building this application  takes a few minutes as it involves launching the Xilinx tools.

 

task_0

Task task_0 runs on the DSP. It writes a counter to an array in the DDR SDRAM, then reads the array and checks that it contains correct values.

 

 

This task has one input port and two output ports.

 


Input Port

Description


0

Receives the data read from the DDR memory

 


Output Port

Description


0

Sends the data to be written to the DDR memory


1

Sends control words to the DDR controller to define the size of memory array to use and its starting address. These  words are routed to task ddrsdram_2ports via task chan_router.

 

ddrsdram_2ports

Task ddrsdram_2ports connects to the DDR SDRAM controller to give access to the memory connected to the FPGA.

 

 

This task has five input ports and one output port.

 


Input Port

Description


0

Data to be stored to memory


1

Address at which incoming data should be written


2

Number of bytes to write to memory. The task starts writing to memory as soon as this value is updated.


3

Address from which to read memory


4

Number of bytes to read from memory. The task starts reading from memory as soon as this value is updated.

 


Output Port

Description


0

Data read from memory

 

chan_router

Task chan_router routes messages sent on its input port to one of its output ports. The messages sent on its output port follow a simple protocol specifying the destination output port and the size of the message. The function WriteToChannel() is provided to construct a message.

 

 

This task has one input port and four output ports.

 


Input Port

Description


0

Receives the messages to be routed to one of the output ports.

 


Output Port

Description


0

Output port 0


1

Output port 1


2

Output port 2


3

Output port 3

 

Prerequisites

You  need the following components to be able to run this example:

 


Hardware

Quantity


SignalMaster Dual or Quad

1


3L Diamond DSP licence

1


3L Diamond FPGA llicence

1