# Start Your Engines: Mixed-Signal Modeling Best Practices for Converting a Real Number Signal to Electrical

Cadence^{®}Spectre^{®}AMS Designer is a high-performance mixed-signal simulation system. The ability to use multiple engines and drive from a variety of platforms enables you to "rev up" your mixed-signal design verification and take the checkered flag in the race to the market. The Start Your Engines! blog series will provide you with tips and insights to help you tune up your simulation performance and accelerate down the road to productivity.

Bonjour!

In my previous post, I explained the three methods to convert an electrical signal to a real number. In this post, I will cover the methods to convert a real number signal to an electrical signal in your design.

Let me get started with explaining how you can create such a behavioral model using the Verilog-AMS standard language. I will then present three methods and compare them. Looking at the comparison, you will then be able to select a method that best suits your application.

Let us consider that the following symbol of a model that requires a real number discrete signal to an electrical (R2E) conversion.

I’ve named the model as R2E_conv and it has:

- One RNM input named r
- One electrical output named e

All the three methods, #1, #2, #3, share the following three common parameters:

- td: the delay time between an input discrete value change and the electrical output change.
- tr: the rise time between two adjacent electrical values when there is a positive edge on discrete r values.
- tf: the fall time between two adjacent electrical values when there is a negative edge on discrete r values.

### Method #1: R2E Model Direct Conversion of RNM Events to Electrical Voltage-Controlled Source

In the first method, I will execute a direct R2E conversion for any positive or negative edge of the r input signal that is computed by the event solver. This model could show a linear buffer with a unity gain between the discrete r input and the electrical output e.

After the ports and parameters declaration, the behavioral model is described using three blocks.

- The first block is an initial block, executed only at time=0s in the event solver. The internal real variable e_val is initialized with the probed value on the wreal port named r.
- The second block is an always block, computed in the event solver. It is particularly important as it monitors and detects any event on the r wreal input. For any positive edge or negative edge detected on r, the real variable e_val is updated with the probed real value on the r port.
- Finally, the analog block, computed by the electrical solver, creates a voltage-controlled source between the electrical port e and the implicit ground of the electrical solver.

Verilog-AMS provides a powerful transition filter. It can delay and smooth out the piece-wise discrete signal. I use it to imitate the propagation delay and the rise time and fall time transition on the electrical output.

Two points to note regarding the implementation of the analog block:

- The transition function is very important. It implicitly synchronizes the event solver and the electrical solver. Every time the value of digital variable e_val is updated, the transition filter creates a D2A event synchronization and forces breakpoints in the electrical solver to get an accurate rise and fall time transition.
- I created the ideal voltage-controlled sources between the electrical port e and the electrical solver ground. This source has no series resistor and could deliver a huge current value. We will improve this in the next model.

This method plots the following waveform:

Here,

- The red color represents the discrete wreal r input, which is a sinusoidal wave. The amplitude value equals 1 volt and there are 400 discrete samples computed for one period.
- The yellow color represents the V(e) waveform, the result of R2E conversion.

This R2E conversion with the transition filter generates and forces a number of 400 D2A events synchronization and 3194 breakpoints for executing the electrical conversion with an accurate rise time and fall time between each e_val value change.

### Method #2: R2E Model Direct Conversion of RNM Events to Electrical Norton Model

SPICE solvers are based on the modified nodal analysis. They compute the Norton model faster compared to the Thevenin model.

In this method, I added a new real parameter, named rout, with a default value of 200 ohms.

Here, we will generate the Norton model in the electrical solver. We can see the current branch creation between the electrical port e and the implicit electrical solver ground.

This method plots the following waveform:

Here again,

- The red color represents the discrete wreal r input, which is a sinusoidal wave. The amplitude value equals 1 volt and there are 400 discrete samples computed for one period.
- The yellow color represents the V(e) waveform, result of R2E conversion.

This conversion with the transition filter generates and force a number of 400 D2A events synchronization and 3194 breakpoints for executing the electrical conversion with accurate rise time and fall time between each e_val value change.

### Method #3: R2E Model Direct Conversion of RNM Events to Electrical Norton Model with Input Noise Filtering

In the last method we will see how to filter in case the r input signal is noisy.

The R2E **method#2** provides a direct conversion of any positive or negative edge. The transition filter will force breakpoints in the electrical solver to provide an accurate rise and fall time. If the r real signal has noise, it will slow down the test bench simulation. To avoid this, I will introduce input noise filtering. Only when value of r changes in the absolute value by more than rdelta, the relative previous event the e_val is updated. This filtering is done in the always block using the ternary operator.

This method plots the following waveform:

Here,

- The red color represents the discrete wreal r input, which is a sinusoidal wave. The amplitude value equals 1 volt and there are 400 discrete samples computed for one period.
- The yellow color represents the V(e) waveform, result of R2E conversion with rdelta=0.2.

This R2E conversion with input noise filtering rdelta=0.2 generates and forces only 16 D2A synchronization events and 210 time-steps in the electrical solver for executing the electrical conversion with an accurate rise time and fall time between each e_val value change.

### Common Errors

**Error #1**: In the analog block, you do not use the transition filter and write

analog V(e)<+ e_val;

Such models will show a random behavior:- When you change the simulation stop time you could observe different behavior.
- Electrical solver may ignore some e_val changes.

**Error #2:**Defining a high value for the rout parameter.**Error #3:**In**method #3**, you define rdelta above the mandatory precision magnitude required for your model. For example, you have an input signal amplitude of 1 Volt and a rdelta= 0.7. This value is too high for rdelta.

### Comparison of the Methods

**Method#1**: This method has a disadvantage when defining an ideal voltage source with no series resistor in the electrical. This voltage source may deliver the current in mega amperes. In such a scenario, this method can be nonrealistic and too ideal.**Method#2**: In this method, any positive or negative edge of the r signal will generate D2A events in the mixed-signal simulator. If the r discrete signal is noisy, the electrical will create many breakpoints in the electrical solver. This conversion may be inefficient for such a case. This model provides a Norton output impedance equal to rout.**Method#3**: This method triggers the electrical conversion only when the variation above rdelta is observed on the r discrete input. This conversion may be efficient for a noisy input. The engineer should have a clear idea of the accuracy he needs for his application to define the highest rdelta This model provides a Norton output impedance equal to rout. In the example with rdelta=0.2 as explained in**method#3**, it provides a 11X simulation speed up versus**method#2**because there are less A2D synchronization events between the digital and electrical solvers and less electrical breakpoints in the electrical solver.

### Conclusion

Usually, a mixed-signal engineer would prefer **method#3** because it provides the advantage to be faster for noisy signals. The R2E conversion creates D2A events between the event and electrical solvers only when the “r” wreal signal changes is higher than the rdelta value. You can consider rdelta like an LSB (Least Significant Bit) of an analog to digital converter. Also, the R2E connect modules could use a similar method.

The concepts presented here could be reused for connect module creation with the Cadence Verilog-AMS or SystemVerilog-AMS compilers delivered with Xcelium.

Wishing you a happy experience with Spectre AMS Designer and Verilog-AMS or SystemVerilog-AMS modeling of R2E conversion!

I wish you all the best for the upcoming holiday season coming and Happy new year-2021!

*~ Andre Baguenier*

### Related Resources

For more information on Cadence circuit design products and services, visit www.cadence.com.

### About Start Your Engines

The* Start Your Engines! *series brings you blog posts from several analog/mixed-signal subject matter experts on a variety of topics, such as introduction to the new features in Spectre AMS Designer, tips for enhanced understanding of existing features, and much more. To receive notifications about new blogs in this series, click Subscribe and submit your email ID in the *Subscriptions* box.