The SIL Easy Transform is a template that provides an easy way to create a custom Transform using Visual Studio. With MxTransIt you can use the Transform in a Test Harness that can be very simple or complex. For an example of a SIL Easy project, examine the SILEasyCruiseControl sample provided with the MxSuite.
Some features of the SIL Easy Transform are:
•It allows any number of inputs and outputs.
•The functionality of the Transform can be written in C, C++, or C#.
•The Transform is built from Visual Studio project. A default project is provided.
•The default Transform has examples of discrete, continuous, and message Signals.
For more information, see Choosing a Transform Type.
Use this procedure to create a SIL Easy Transform:
2.Select File->New->Project from the main menu.
3.When you see the following form, select Custom and click Start MxTransIt on Finish.
Note: Although we are doing SIL testing, we are creating a Custom SUT.
4.Click the Finish button to launch MxTransIt.
5.In MxTransIt, select SIL Easy from the Toolbox and drag it into the harness (center) window. Notice, at this point it has no visible ports.
6.Click the transform to select it and display its properties:
Note: The IsSUT property defines whether your transform is ticked as a Connector Transform (True) or a Signal Processing Transform (False). You can change this property based on the purpose of your Transform.
7.Enter an appropriate name for your transform in the Name field. In the figure above we used Sil Easy Example.
8.Click the Create New Project verb (blue link) at the bottom of the Properties box.
9.Select a folder for your project. Normally this is the same folder you used when you created your MxVDev project.
Visual Studio opens.
10.You can examine the source code at this point:
•There are four code files provided by SIL Easy:
ISetGetMethods* setGetMethods = 0;
setGetMethods;//eliminate compiler warning
/* Example of Discrete Ports (booleans/integers etc) */
/* variable, name, dataFlow, min, max, init */
gSil.AddDiscrete(&Bool, L"Bool", DataFlowEnum::Input, 0, 1, 0);
gSil.AddDiscrete(&Invert, L"Invert", DataFlowEnum::Output, 0, 1, 0);
/* Example of Continuous Ports (floats/doubles) */
/* variable, name, dataFlow, min, max, init, units */
gSil.AddContinuous(&Number, L"Number", DataFlowEnum::Input, 0, 10, 0, L"unit");
gSil.AddContinuous(&Double, L"Double", DataFlowEnum::Output, 0, 10, 0, L"unit");
/* Example of Message Ports (array of bytes) */
/* variable, name, dataFlow, max length, actual length, variable length flag */
/* Input message can be defined as variable length, in that case actual length
of copied data is located in 'actual length' parameter */
gSil.AddMessage (bufferIn, L"Buffer In", DataFlowEnum::Input, 20, &actualLength, false);
gSil.AddMessage(bufferOut, L"Buffer Out", DataFlowEnum::Output, 20, &len2, false);
You can modify this code to add, delete, or change ports. See Making Changes to Ports. If you are a beginner, we recommend you complete a successful build before changing the code.
oSilInitialize() - This function is called once when the project is loaded. When a Scenario is rewound and run again, the project is unloaded and reloaded, consequently SilInitialize is called again.
oSilTick() - SilTick is called periodically during the test according to the Tick Period property of the SIL Easy transform. See Tick Period.
oSilFinalize() - This function is called when the project is unloaded, that is, when the Scenario is rewound or MxVDev is closed. It is NOT called when the Scenario completes execution.
/* called on start of scenario*/
actualLength = 0;
Bool = 0;
Number = 0.0;
/* called periodically */
/* example int */
Invert = (Bool == 0)? 1 : 0;
/* example double */
Double = 2.0 * Number;
/* example message */
for(i=0; i<20; i++)
/* reverse incoming message */
bufferOut[i] = bufferIn[19-i];
The sample code shows simple operations on three kinds of signals. You can write your own code to perform more extensive signal processing.
•The input RAM variables (in this example: Bool, Number, and bufferIn) are only written to when the value changes.
•For output Message signals, a transition is generated on the output port at any time any bit in the output message changes.
11.Select Build ‑> Build Solution from the Visual Studio main menu. If there are no errors, Visual Studio displays:
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
12.In MxTransIt, click on your Transform to select it and display the Properties form.
13.Click the Connect/Reconnect verb at the bottom of the Properties form to display the predefined ports on your transform:
You are now ready to customize the Test Harness. You can add, remove, or change ports by modifying the C++ code. You can connect it to other Transforms. To define the behavior of the SIL Easy Transform, add code to the Visual Studio project. (Click the Launch Project verb to open Visual Studio. Rebuild the project after you change the code.) You can debug your code in Visual Studio by attaching to the MxVGUI executable. See Attaching to the Process.
When you are ready, use the procedure below to connect the harness to MxVDev for testing.
1.Right-click on the Transform:
2.Select Export Ports.
3.In the Export Ports form, select the signals to be connected to MxVDev.
5.Click Save ().
6.Exit MxTransIt and return to MxVDev.
7.When you see this message, click Yes:
8.View the Stimulus and Response Connections forms to ensure that your signals have been imported into MxVDev.
For more details, see Exporting Ports.
You can now use these signals in TestCases to create a full system for SIL testing.
You can use Microsoft Visual Studio (MSVS) to debug C/C++ code for a SIL Easy Transform. To use debugging features, such as breakpoints, MSVS must be attached to the MxVDev process. There are two ways to do this:
For inputs, incoming data on the inport of the Transform is copied to the associated configured variable in the C++ code.
For outputs, variables are scanned on every tick. If data has changed since last time, a new transition is created for the associated outport on the Transform.
You can use the following steps to access the name of the currently executing Scenario from the SIL Easy project:
1.In main.c, declare a variable to hold the name.
2.Put the code that uses the Scenario name in SilTick. (The name and path are not available in SilInitialize.) For example:
if( strcmp(ScenarioName, "Default") == 0 )
Double = 10;
3.In main.h, make the variable visible.
extern char* ScenarioName;
4.In SilHarness.cpp, set the variable to the Scenario name.
ScenarioName = gSil.Scenario.GetName();
To access the Scenario path, use gSil.Scenario.GetPath()
The executable for the SIL Easy Transform is in a DLL file with a .sil suffix. (Sil.sil in the sample.) When the project is opened, MxVDev searches for that file. If the file is present, it is used. If the .sil file is not found, the system attempts to rebuild the Visual Studio solution. It uses the same version of Visual Studio used to create the solution file. To upgrade to a newer version, open the solution with the newer version and use the Visual Studio conversion wizard.
1>LINK_ORIG : fatal error LNK1104: cannot open file '\Sil\MSVS\..\Sil.sil'
1>CL : error : 'RVS' is incompatible with BullseyeCoverage
This error indicates Bullseye and Rapita RVS are both installed.
Disable Bullseye or RVS.