Main Content

Customizing Datapath Building Blocks

This example shows how to customize a PassThrough block in Simulink® to use a MATLAB® function block or other Simulink library blocks. You will see how the implementation of a receiver gain or attenuation stage is controlled by an IBIS-AMI parameter, and this example provides a guide to modify PassThrough blocks to implement custom functions for a SerDes system.

PassThrough Block Function and Use

By default, PassThrough block is, as the name implies, a block that passes the input impulse or waveform to the output with no modifications. This block can be used as a floor planning tool in the SerDes Designer App and then customized after exporting to Simulink. Under the mask of a PassThrough block is a MATLAB System block referencing the serdes.PassThrough System object™, which when called by Simulink forwards the input to the output. The MATLAB System block can be updated to reference other SerDes System objects or can be replaced with other Simulink blocks as this example outlines. For an example of customizing with System objects, see Implement Custom CTLE in SerDes Toolbox PassThrough Block.

Create SerDes System in SerDes Designer App

Launch the SerDes Designer app. Place a PassThrough block after the analog model of the receiver. Change the name of the PassThrough block from PT to CustomExample.

Export the SerDes system to Simulink.

Add AMI Parameter to Control Gain

Double click on the Rx block to look inside the Rx subsystem and open the SerDes IBIS-AMI Manager dialog box.

In the AMI-Rx tab, select the CustomExample node. Click on the Add Parameter button and set the variables:

  • Parameter name to ExampleGain

  • Description to Gain setting for Receiver

  • Format to Range

  • Typ to 0.8

  • Min to 0

  • Max to 1.

Current value, Usage, and Type are kept at their default values 0, In, and Float, respectively.

Confirm settings and click OK.

You will see a parameter automatically generated on the canvas as shown below.

Change PassThrough to a MATLAB Function Block

You can create a MATLAB function block and add code to use the ExampleGain parameter as a modifier to the In signal. To illustrate the workflow, this example will show how to implement a gain (using multiplication) but any MATLAB function may be implemented for your system.

function out = fcn(in,ExampleGain)

gainSignal = ExampleGain*in;

out=gainSignal;

Then you can delete the PassThrough block, and wire up the MATLAB block with input signals In, ExampleGain and output signal Out as shown:

Remember to go back to the Rx subsystem, double-click on Init and click the button Refresh Init. You can see the affect of the value of the parameter ExampleGain by opening the IBIS AMI Manager and changing the Current value of ExampleGain to 0.8.

Run the simulation and observe the results.

Change the Current value of ExampleGain to 1.0 and re-run the simulation to confirm ExampleGain parameter is modifying the Receiver signal.

These steps showed you how to implement an AMI parameter called ExampleGain using a MATLAB function block in your system. You can also use built-in blocks to customize a PassThrough block as explained in the section "Change PassThrough to Gain Block or Other Built-in Block."

Change PassThrough to Gain Block or Other Built-in Block

Another way to configure a custom PassThrough block for your model is to use a built-in block. For example, a Gain block can be added within the PassThrough block. Instead of creating a MATLAB function block, look under the mask of the "CustomExample" block after the parameter ExampleGain is created from the steps in section "Add AMI Parameter to Control Gain" above:

Delete the parameter ExampleGain. You should see the canvas now looks like the default serdes.PassThrough System Object:

Next, delete the MATLAB System block that points to the serdes.PassThrough System Object:

Add a Gain block from the Simulink > MathOperators library and connect the Gain block between the input and output ports:

Note: While this example uses a Gain block to illustrated workflow, you can use any built-in block (as well as a MATLAB function).

Connect Block Parameters of Gain Block to Added AMI Parameter

Constants are represented as Simulink parameters. Double click the Gain block to open the Block Parameters dialog box. Set Gain value to CustomExampleParameter.ExampleGain.

Update Code that Runs During Statistical Analysis

To enable the gain to be applied to the impulse response during statistical analysis, double click the Init block inside the Rx subsystem. Click the Refresh Init button to add the new AMI parameter to the Init code. Click the Show Init button to open the MATLAB editor window and look for the Custom user code area surrounded by %%BEGIN and %END comments. Your code associated with the customized PassThrough block is encapsulated in this section.

Implement Gain

In the Custom user code area, edit your customized code to perform a Gain operation on the local variable containing the Impulse Response. To do this, replace the code:

CustomExampleParameter.ExampleGain;

with:

LocalImpulse = LocalImpulse*CustomExampleParameter.ExampleGain;

The Custom user code area should appear as below:

Save the changes.

Note: If Init code is not modified, results from the Statistical simulation does not reflect the gain operation and is only shown in the results from the Time-Domain (GetWave) simulation.

Run Simulation with Gain Setting

Open the SerDes IBIS-AMI Manager dialog box and click on the AMI-Rx tab. Select the ExampleGain* node and set the Current value to 0.8.

Run the simulation and observe amplitude of the waveform from Time-Domain (GetWave) and the waveform from Statistical (Init) results.

Change Gain Setting and Observe Change

Open the SerDes IBIS-AMI Manager dialog box and click on the AMI-Rx tab. Select the ExampleGain* node and set the Current value to 0.4.

Run the simulation again and observe how the amplitude changes for both the waveform from Time-Domain (GetWave) and the waveform from Statistical (Init).

These steps showed you how to implement an AMI parameter called ExampleGain using a built-in block to customize a PassThrough block. You can also implement an AMI parameter using a MATLAB function block in your system as explained in the section "Change PassThrough to a MATLAB Function Block."

See Also

| |

Related Topics