User manual
PAL tutorial
6. Open the tutorial MSVC workspace: Start>Programs> Celoxica>Platform Developer's
Kit
>DSM>DSM Tutorial Workspace [VC++].
7. Choose Part1, Part2 or Part3 of the tutorial by selecting Project>Set Active Project.
8. Compile the project by pressing F7.
9. Execute the simulation by pressing F5. The output will depend on which part of the tutorial
you have downloaded, but will describe any patterns matched and the time taken to do so.
2.1.2 Part 1 of the tutorial
Part 1 of the DSM pattern matching tutorial matches a single word of fixed pattern data against a stream
of information.
Hardware side
The data value is the only thing sent from software to hardware hence only one S2H port is required. The
count is sent back from hardware to software, so also one H2S port is required. This makes the
initialization on the hardware side as follows:
DsmVersionRequire (2, 0);
DsmInit (Interface);
par
{
DsmRun (Interface, InterfaceData, H2S_COUNT, S2H_COUNT);
DsmPortS2HRun (DataInPort);
DsmPortH2SRun (MatchOutPort);
/* … */
}
The ports are read and written with the
DsmRead() and DsmWrite() macros, e.g.:
DsmWord DataLength, Data, NewData;
int DataCount = 0, MatchCount = 0;
DsmRead (DataInPort, &DataLength);
DsmRead (DataInPort, &Data);
while (/* still data */)
{
DsmRead (DataInPort, &NewData);
while (/* bits left in NewData */)
{
if (Pattern == Data)
{
MatchCount++;
}
/* shift next bit from NewData into Data */
}
}
DsmPortWrite(MatchOutPort, MatchCount);
Software side
The requirement for S2H and H2S ports is the same as in the hardware side, making the initialization of
DSM in software as follows:
www.celoxica.com
Page 15