User manual

PAL tutorial
DsmInstance *Instance;
DsmPortS2H *DataOutPort;
DsmPortH2S *MatchInPort;
int DsmTutorial (DsmInterface Interface, void *InterfaceData)
{
DsmWord Data[MAX_DATA_LENGTH_WORDS];
DsmWord Pattern;
int i, DataLengthWords;
DsmSetDefaultErrorHandler ();
DsmInit (Interface, InterfaceData, H2S_COUNT, S2H_COUNT,
&Instance);
DsmPortS2HOpen (Instance, DATA_S2H_PORT, &DataOutPort);
DsmPortH2SOpen (Instance, MATCH_H2S_PORT, &MatchInPort);
// Do tutorial algorithm here
DsmPortS2HClose (DataOutPort);
DsmPortH2SClose (MatchInPort);
DsmExit (Instance);
}
The writing and reading from ports is done using the
DsmRead() and DsmWrite() functions.
2.1.3 Part 2 of the tutorial
Part 2 of the DSM pattern matching tutorial adds the ability to match against multiple words, and the
words are sent using a separate DSM port before the data is sent.
The method for using multiple ports in DSM is very simple. The only requirement is that you keep track of
how many ports are required on each side of the hardware/software divide and send the correct data to
the correct port.
Hardware side
There are two S2H ports and one H2S port, and these can be represented in the enumeration format, as
shown in the DSM User Guide.
Software side
The setup and algorithm now look as follows:
www.celoxica.com
Page 16