What to do when your SPICE models run out of gas: Part 6 - Embedded.com

# What to do when your SPICE models run out of gas: Part 6

In the previous installment in this series, Part 5, I provided a shortrefresher on mathematics and scattering parameters were presented. Itexplained how interchanges between time domain and frequency domain arepossible and how peeling allows the extraction of models from either time-domain or frequency-domain data.

This development covers a significant portion of the mathematicalinformation you need to begin working with data moving at microwavedata rates. At least one important subject has not yet been examined.

You saw in that material that reflections take place and that theytransport energy away from the desired end point, the data receiver. Ina realistic system with packages, traces, connectors, and passivecomponents in the signal path, there are numerous interfaces wherereflections take place.

Sometimes a bit of energy is reflected back at one interface andthen a bit of that is reflected to the original direction at anotherinterface. The question is, what procedure can be used to calculatewhat gets through to the receiver? The answer comes in the section on Mason's Rule. First let'sexamine crosstalk.

Crosstalk
You can generate a SPICE model directly frommeasured data in either time or frequency domain, but crosstalk is atleast as significant a factor as is the through-loss, particularly ineconomical multi-line connectors. A model is not complete until it canhandle the crosstalk.

Frequency factors. Various design situations generate variousopinions on what is the right way to handle crosstalk. What is actuallyright depends on how you will use the model you build. Here are severalviews on how you might handle crosstalk. You can read these and decideif one of these views fits your needs, or you may devise your own view.

The FlatResponse Theory. The flat response theory holds that the peakamplitude of crosstalk is the only important parameter. The frequencyprofile is irrelevant. How important is the frequency response of thecrosstalk path? This theory holds: not very.

Because you can seldom guarantee any phase relationship between theaggressor and the victim signal, a realistic handling of crosstalkrequires that you slew the phase of the aggressor over the entire timeinterval of the victim pulse.

But this is equivalent to converting the aggressor to an equalamplitude low frequency signal. So the solution is to handle crosstalkas frequency independent, but be sure to get the peak amplitude right.

Microwave frequency transmission lines on lossy media (FR4) exhibit greatloss for the high frequency components of the signal, but only littleloss for the low frequencies. Thus, the low frequencies required toachieve an equivalent to slewing the aggressor phase are already therein the aggressor signal. You just need to couple the signal across tothe victim at the right amplitude.

The theory works fine if the aggressor is in a line that has lowloss. But it is a poor solution for an aggressor that has encounteredhigh loss. Crosstalk starts out always looking capacitive. The couplingat DC is zero. The coupling profile looks like a high-pass filter.

In a high-loss case, the high frequencies encounter more loss thanthe low frequencies, but a flat-response model treats them all equally.As a result, this model can produce crosstalk that is much too high forthe case of a lossy aggressor.

The CapacitiveResponse Theory. This theory starts with the observation thatcrosstalk at zero frequency is usually zero. A look at the frequencyresponse of the crosstalk path looks very much like a capacitor exceptat the high frequency end.

You can model the crosstalk as just an R-C high-pass filter. For thismodel, you would choose a resistor that is large compared to theimpedance of the aggressor line and then calculate the capacitance thatyields the desired frequency response. You would then isolate thiscircuit from the victim, using an ideal current source.

The only unknown is the value of the capacitor, and you cancalculate that once a frequency is specified. A good way to choose thisfrequency is to use the frequency where the transfer function is athalf its ultimate response. Given this frequency and the resistance youchoose, you can write a formula that specifies the capacitance.

You now examine the frequency response of your crosstalk path andfind the frequency where the response is either half of its ultimatevalue or where it is half of the response at the highest frequency youcare about. Observe both the frequency and the amplitude of response atthat frequency. Use the frequency to calculate the capacitance. Use theamplitude to set the gain of the mechanism you will use to couple tothe victim line.

Of course, if you have more than one aggressor or if you havetime-domain information only, then it isn't quite this simple. If youhave more than one aggressor, another solution is to add the responsesof all aggressors together to build a single equivalent or generate aseparate coupler for each aggressor. I prefer the former.

If you have only time domain information, you could use an Fast Fourier Transform (FFT) onthe response to find the frequency domain equivalent or you could fakeit. Faking it consists of choosing a frequency, typically half of thedata rate, and trying various coupling factors till the simulatedresponse best matches the measured waveform.

The perfectiontheory. This theory holds that the only adequate model is onethat perfectly mimics all internal and external electricalcharacteristics of the device. Perfection is a theory—in reality thereis no such thing.

You can spend 10 minutes generating a model with a method like oneof those described above, or you can spend an extra two months tryingto exactly match every nuance of the crosstalk response profile; overthe range of manufacturing variables, you will still only achieve thesame 95 percent accuracy.

Models are models; they are based on measurements that will alwayshave some error. Models run in tools that always add some error. Muchmore importantly, they model performance in circumstances that neverexactly match the measurement conditions.

These methods may not be adequate for you, but before you chose apath that will add a lot of work, convince yourself that there willactually be a measurable improvement in the final product.

TheMiller approach . My approach is to get it right at theports and forget what goes on inside. You can do this by using peelingfor the signal paths and capacitively driven directional couplers forthe crosstalk. The advantage of this method is that it is very easy toautomate the process of generating this model, and the model can bevery accurate in its response.

Limitations of this model include the fact that it won't give youany insights as to how to tweak the device to improve its performance.If you are designing the device being modeled, use a geometry-basedmodel. If you are using an existing device in a circuit, use myapproach.

Directionality
You could couple the crosstalk signal in by using a high-impedancesource, such as a current source. The problem with doing this is thatthe injected signal would travel in both directions down the victimnet, preventing you from being able to get both the forward and reversecrosstalk components right—they contaminate each other.

Nor does it work to enforce directionality by inserting a seriesamplifier. That would only allow signal waves to travel in onedirection. The model has to be able to transmit in both directions,handling both forward and reflected waves. What is needed is adirectional coupler, a device that allows signals to travel in bothdirections but couples in a signal in only one direction.

The DirectionalCoupler. Ideally, the directional coupler would have nobandwidth limits?DC to light. As long as we are talking about blue sky,limit the forward-to-back ratio only by the numerical accuracy of themachine.

In other words, the ratio of injected signal traveling in theintended forward direction to injected signal traveling in the wrongdirection is limited only by the numerical accuracy of SPICE.

The numerical accuracy of the machine would be something like 12orders of magnitude, maybe a bit more. And why not require the couplerto have no through delay, zero, no picoseconds? Try this: require thesame model to be able to automatically adapt to any characteristicimpedance. If you want it to work at 50 ohms, just terminate at 50. Ifyou want to use it at 85 ohms, terminate at 85.

If you had such a device, one could be placed at each end of thepeeled model and it would be totally transparent to signals traversingthe model. Yet, forward crosstalk would appear traveling in the forwarddirection only, and reverse in the reverse direction.

The big question is, how much of this can be achieved in practice?You could achieve all of it if you could find or model an idealtransformer. This is SPICE. Of course you can model an idealtransformer! Keep reading, I'll show you how.

Figure 4.16 below shows theschematic of an ideal directional coupler as implemented in SPICE.Signal passes through at ports A and B. That is, if this device is tosubstitute for a wire, one end of the wire is port A and the other endis port B. Crosstalk is injected at port C. Each transformer has anN1:N2 turns ratio, which sets the coupling coefficient of the coupler.In the figure, the ratio is 1:N. Note that N need not be an integer.

 Figure4.16. The Ideal Directional Coupler

Observe that the turns ratio is the same on each of the twotransformers, and that there is a terminator on the lower right corner.My personal preference is to implement the coupler as a SPICEsubcircuit and include the termination resistor inside it.

Port C needs to be driven with a source resistance of this samevalue, so I include that inside the subcircuit, too. Any impedancevalue that is used for this terminator is the value that will providean impedance match for ports A and B. This part is really simple.

Some types have a primitive for the ideal transformer; if your does,you are done. If yours does not, you need to generate one through useof controlled sources. I will give you equations, but will not explainhow and why the ideal transformer and the directional coupler work.

Turns Ratio
The coupling coefficient is the value that relates the amplitude of theoutput signal to the amplitude of the input signal through the couplingpath. In Figure 4.16 earlier, that would be the ratio of signal at portB to the signal that is injected at port C. This coefficient can beexpressed in at least three ways.

The easiest is to simply recognize that a turns ratio of one to 10yields a coupling coefficient of 0.1. Often the coupling coefficient isexpressed in decibels rather than as this ratio. This is slightlytricky because you need to know whether the coefficient is expressed interms of voltage or of power.

Here we are concerned with voltage ratios, so this coupler will becalled a 20-decibel coupler. In some instances, couplers are specifiedin terms of power. That would make this a 10-decibel coupler.

Again, here we are interested in voltage ratios so our decibelexpressions must reflect that. You set your directional coupler towhatever coupling value floats your boat by specifying the turns ratio.

The Transformer
When you have chosen a turns ratio, the next step is to implement atransformer that expresses that turns ratio. The transformer is alittle trickier than the directional coupler. All you need are voltagesources, current sources, and resistors. You may want to refresh yourmemory on the SPICE syntax of the independent voltage source (Vxxx) and of thecurrent-controlled current source (Fxxx).

The current source is controlled by the current through somespecified voltage source. You implement this voltage source, used onlyto measure current, like any other voltage source, but the voltage isset to zero. Figure 4.17 below shows the schematic of this ideal transformer.

It is simple, containing only six components, two of which have avalue of zero. You are free to choose the value of R1 and the turnsratio. Your choice of these two fixes the value of all the rest. So,here are the equations you use to build this ideal transformer:

If your version of SPICE has an ideal transformer primitive, use it.If it doesn't, use these equations to create your own. Peculiarly, thistransformer is so ideal that it actually works at DC.

 Figure4.17. The Ideal Transformer

The components used to implement this transformer are fast and areavailable in Berkley2G6 SPICE, and so should be available to anyone who has almost anyversion of SPICE.

To use this technique, place one directional coupler at each end ofyour transmission line model, and inject the appropriate crosstalk ateach end. Since all ports on the coupler are at your Zo impedance, itdoesn't work to directly tie the C-port to the aggressor line.

Couple the aggressor to the directional coupler by use of anamplifier. SPICE provides the voltage-controlled voltage amplifier, theE element, for this. It gives you unlimited bandwidth and infiniteinput impedance.

Set its gain so that, in combination with the coupling coefficient,it gives you the right crosstalk values. When you are done, your modellooks like Figure 4.18 below

 Figure4.18. Block Diagram of the Model

By using subcircuits to implement the components of this model, youcan achieve a very compact and high quality model of your device.

Differential
At microwave frequencies, differential lines are used. One way to makea differential model with this is to start with the differential TDR data for thedevice you are going to model.

Use peeling on this to generate an equivalent single-endedvariable-impedance transmission line; place an ideal transformer ateach end of the model to do the single-ended to differentialconversion.

This method will not correctly account for common mode, but thereality is that, when we are doing our simulations, we seldom haveenough information about the circuit board to realistically modelcommon mode, anyway. Perhaps it would be better to use twotransformers.

If you don't have a differential TDR machine, an alternative is tomeasure the device with a network analyzer and calculate thedifferential characteristics. Another alternative, one I don'trecommend, is to use a balun.

The word balun is a contraction of the phrase “balanced tounbalanced converter.” The contraction, balun, has been used for aboutas long as there has been radio. It is often very difficult to get goodmeasurements with a balun. It is too easy to get measurements that lookOK but aren't.

Often these devices work well when terminated into their targetcharacteristic impedance but not so well when they are not. Now, if thedevice you were trying to measure was precisely 50 ohms throughout itsfrequency range, you probably wouldn't need to measure it anyway.

If, as is typical, your device is not precisely 50 ohms throughoutits frequency range, then what you measure with the balun is thecombined characteristics of both the balun variations and the device.

In an attempt to reduce the impedance-dependent variations of thebalun, people typically put a wide-band attenuator on each output portof the balun. Minimum value for this is about 10 decibels ofattenuation. Though this attenuator does not totally eliminateimpedance variations at the ports of the balun, it reduces them at theexpense of an equal loss in measurement resolution. Because of allthis, I recommend against making measurements with a balun.

In making time domain measurements of your device, take care tomaintain the highest rise time achievable. The model you get has themeasurement rise time built into it. So rise time gets double countedwhen using this model.

The model's through response reacts for any signal as though itsrise time was slower than it actually is, slower by about 30 percent ofthe measurement rise time. For example, if the TDR wave arriving at theDUT had a 45-picosecond rise time, then the peeled model will respondto a signal with a 100-picosecond rise time as though it had a115-picosecond rise time.

It doesn't add this time to the wave, it just responds as though theharmonic content had been a little lower. The overall impact istypically negligible, unless the original measurement was made with tooslow a rise time.

To test this, create a connector model in SPICE and run a transientsimulation to get the TDR response for whatever rise time you want.Then run the result through the peeling algorithm and create a model.Now run the same waveform through each, adjust for timing offsets, andcompare output wave forms. The result in Figure 4.19 below shows how good amodel your system is generating.

 Figure4.19. Testing the Model

So now you have all the information you need to generate functionalmodels directly from measurements. The procedures would usually beimplemented with scripts rather than by hand. The entire process ofpeeling the data and generating a SPICE file with the directionalcouplers in place can be done in less than a second once you have theappropriate scripts working.

T Lines vs. L-C
Up to this point, development proceeded from device measurements to theequivalent transmission line model. You could simply take the peeledimpedance profile and implement it as a series of short SPICE T lines.

That would work and would yield a good simulation of the device.Yet, you might not be altogether happy with the results because shortsections of T lines tend to run slow in SPICE. A solution that runsfaster can be made out of equivalent L-C sections.

Recall that the impedance of a lossless transmission line and thevelocity of signals in it can both be expressed in terms of L-Csections.

The impedance equals the ratio of inductance and capacitance whereeach is expressed as a per unit length. Similarly, the velocity, interms of the units of length, can be expressed as a function of theinductance and capacitance per unit length.

When the peeling algorithm has completed its job, you are left witha list of impedances and time increments. From these you need togenerate inductances and capacitances. You can rearrange that toexpress inductance in terms of impedance and capacitance.

Now all you need to do is find capacitance per unit, and the problemis solved. The impedance equation has already been used, so capacitancehas to be somehow extracted from the velocity equation. Velocity isdistance per time increment. The distance can be normalized to one, sovelocity in this case becomes simply the reciprocal of the timeincrement. Rewrite the velocity equation like this:

Now everything is in terms of quantities you know—impedance and timeincrement. The rest is just mix and match to yield equations forinductance and capacitance.

That's it. To generate L-C segments from the impedance andtime-increment data, use the one equation to get the capacitance, thenthe other to get the inductance.

Two ways to go
From here you could proceed in either of two ways. The easy way is tojust put down: series inductor, capacitor to ground, series inductor,capacitor to ground, and so forth. Some people prefer to split eachinductor in half and place the capacitor to ground between the twohalves. The advantage of this is that it makes the segmentssymmetrical.

When you make your measurement of the device you are going to model,you will likely acquire hundreds of data points. You may even acquirethousands of data points. You could turn these into a model withhundreds or even thousands of tiny little segments. Don't do it!

This subject is one of my pet peeves. Is a model with thousands oftiny little features better than a model with only a few? The answer isusually a resounding no! Simulation tools are usually iterative innature. Iterative numerical methods are often very sensitive toderivatives.

When you add an excessive number of steps in the model, all you aredoing is adding a lot more derivatives for the algorithm to deal with.You are only slowing the machine down. So how many increments isreasonable? One engineering rule of thumb is that the time incrementshould be kept less than a fifth the period of the highest harmonic atwhich you need accuracy.

Some say a fifth, some say a tenth, some a twelfth—it depends on howmuch accuracy you need. You have the device measurements, so you knowhow long it takes a signal to traverse the device. Divide that time bythis time increment, and limit your number of model segments to theresulting number.

That pretty much exhausts what needs to be said about peeling. Youhave a lot of choices and decisions to make about how to handlecrosstalk, how to implement the algorithm, how to make themeasurements, and so on. Overall, you should find it a good tool inyour kit.

Mason's Rule
In a system dominated by loss and widely separated discontinuities,energy reflected at a particular discontinuity traverses a substantialloss as it travels to the next discontinuity. Energy redirected back tothe original direction again traverses a substantial loss as it returnsto the point of the original reflection.

This loss might be great enough that the energy returning to theoriginal discontinuity is too small to significantly impact theremaining forward signal. Such a system is said to be loss-dominated,and only limited error results from treating all reflected energy astotally lost at the first reflection. The total link-loss can bemodeled by adding up a list of losses through sections and losses atreflections between sections.

In links that are not loss-dominated, following energy throughmultiple reflections can become difficult. Nevertheless, signal qualityat the receiver can actually deteriorate as loss decreases because ofmultiple reflections in the link. In such an instance, it becomesimportant to examine the actual impact of all these reflections.

The simplest way to deal with a net that has multiple reflections isto model the link in SPICE and examine the transient response. Thealternative is initially more difficult to set up, but once done, youcan reuse it for various systems. This alternative will run much fasterthan the SPICE simulation and it will yield important insights; you cancheck the results by running SPICE.

A few decades back, people designing amplifiers with multiplefeedback loops encountered the problem of how to predict the transferfunction of such an amplifier. The solution they generated is calledMason's Rule.

This procedure is fascinating in that it can accurately deal withfeedback loops that intertwine and interconnect in arbitrarily complexways. Professors love Mason's Rule because it is often exceedinglytricky to apply correctly. The trickiness makes it easy to createchallenging problems on tests. Here is Mason's Rule.

The precise details of all this are not important for the discussionhere because things get simplified when this equation is applied to apoint-to-point circuit interconnect.

To apply Mason's Rule to an interconnect, treat the forward wave asthe forward path and the reverse wave as a backward path. Then, loopsare formed at interfaces where forward and reverse energy arereflected. The flow graph of a typical signal path is depicted by Figure 4.20 below.

 Figure4.20. Flow Graph of an Interconnect Circuit

The flow diagram of Figure 4.20 shows that each reflecting interfaceforms a loop, and there is only one forward path. In this diagram, anindividual component makes a contribution whose elements correspond tothe scattering parameters of the device. The individual element throughthe center sections of this graph is depicted in Figure 4.21 below. Thenumerical components are the fundamental scattering parameters of thedevice.

 Figure4.21. Flow Graph of an Individual Component

Applying Mason's Rule to this interconnect, the one and only forwardpath is removed, leaving the “non-touching” loops as depicted in Figure 4.22 below.

 Figure4.22. Flow Graph, Forward Path Removed

Thus, for this type of application Mason's Rule simplifies to a newstandard form:

In this form, M1 is simply the loss of the forward path. The totalloss of the link, M, will be increased by the components of thedivisor. In the divisor, all remaining loops are non-touching,resulting in no difficulty in identifying what are loops and whichloops touch each other.

The loop gains are the products of the S11 and S22 elements thatmake up each loop. The smaller each of these products is, the lessimpact that pair will have on the overall divisor. Of course, thesevalues are not expressed in decibels when the products are made.Requiring small products is equivalent to requiring a low magnitude ofreturn loss at interfaces.

The question is occasionally asked, how good is good enough? Amongother things, Mason's Rule allows you to quantify how much signal losswill result from a specified amount of return loss. Much more could beadded to the discussion but will be skipped here.

This series of articles was an introduction. A great deal ofinformation is available on the web if “Mason's Rule” is used as the (Google)search keyword. However, I advise you to skip over any responsesthat refer to people who wear funny hats or drive tiny cars in parades.

To read Part 1, go to “Unmodelable featuresof high performance designs