# Multi-bit phase shifter design - how NOT to calculate RMS phase error

New for November 2023. This is the second installment of an article on designing a four-bit phase shifter.

Click here for the third installment, where we design a MMIC 22-degree bit

Click here to go to the fourth installment, where we design a MMIC 45-degree bit

Click here to go to the fifth installment, where we design a MMIC 90-degree bit

Click here to go to the sixth installment, where we design a MMIC SPDT switch used in a MMIC 180-degree bit

Click here to go to the seventh installment, where we design a MMIC 180-degree bit

Click here to go to the eighth installment, where we complete the four-bit MMIC phase shifter preliminary design

Update January 2024: the equations for phase shift and phase error have been refined and this page was completely re-written to make it easier to follow.  The improved equations will appear in Rev 3 or higher of the MWO phase shifter design file available on our download page.

Let's review the AWR (Microwave Office) phase calculations for the cheesy lumped-element four-bit phase shifter design we have going on.  Here are the phase states as calculated by AWR.  You will notice that the reference state is set to exactly zero degrees, a convenient way to plot the phase data.

In order to discuss phase calculations, it is necessary to create a network that contains all of the phase states, shown below. We certainly did this the hard way, setting up a test bench that contains all sixteen phase states. If someone wants to be a hero, send us an equation block that will make an array of the sixteen phase states from a single two-port schematic with the phase state swept with "SWP_VAR", and a way to calculate and subtract phase errors from the states.  Are you listening, Cadence?  Imagine how much worse the calculations on this page are going to be for five- and six-bit phase shifters...

Now we have to set up a bunch of boring but important equations.  We start with capturing the transmission phase angles of the 16 circuits in the test bench. Note that these are treated as radians, not degrees. Be sure to use unwrapped phase angles...

Now we create equations that mimic the way AWR calculates the phase states (each state referenced to state 0).  We had to put an "IF" statement in there to keep all of the phase states between 0 and 360 (some were coming out less than 0).

Here we plotted the phase states referenced to state 0.  You can compare them to the AWR built-in phase state calculation, they are identical. Let's all agree that when you plot phase states for a phase shifter, the Y-axis ticks should be related to the phase bits so you can see how well the states land on their intended values.  Please stop letting your EDA software auto-scale! Maybe this is one small problem that AI can fix in the near future.

Next, we calculate phase errors the way AWR calculates them.  Below is the equation block.  Note that we don't have to mess around with an IF statement from here on.

Next, we plot phase errors as calculated in AWR. Note that they are NOT spread about Y=0, which is going to be a problem when you calculate RMS errors. You probably can't tell from the plot, but there are only fifteen traces.  MWO assumes that the reference state has no error and is not worthy of a trace.

Now, let's do it the right way.  The first thing to do is to calculate the average phase error across all of the states. Below is the formula for calculating average phase error, entered as text. Notice that we collected fifteen raw errors, but divided the total by 16 as there are 16 states.  If you disagree, shoot us an email or write your own app note on phase shifter phase error calculations!

Average_phase_error=(Four_bit_22_phase_error+Four_bit_45_phase_error+Four_bit_90_phase_error+Four_bit_112_phase_error+Four_bit_135_phase_error+Four_bit_157_phase_error+Four_bit_180_phase_error+Four_bit_202_phase_error+Four_bit_225_phase_error+Four_bit_247_phase_error+Four_bit_270_phase_error+Four_bit_292_phase_error+Four_bit_315_phase_error+Four_bit_337_phase_error)/16

Here is a plot of average phase error.

It turns out that the average phase error is what the reference state should be, if you add a minus sign.  Then the other phase states are corrected by subtracting the average phase error from the "AWR" phase states.  He is that equation block.

Now, let's plot the corrected phase states.  Note that the reference state now dips above and below zero degrees, so we adjusted the Y axis to span down to -45 degrees.

Next, we will calculate the corrected phase errors, which we denote as "phase_error2".  Here is that equation block.

And here the corrected phase errors plotted. Note that they are distributed around Y=0. And now there are sixteen traces.

Finally, we calculate the RMS phase errors two ways.   First, the AWR (wrong) way.   Each error is squared, added up, the total divided by 16 then square-root taken.

RMS_phase_error_AWR=SQRT((Four_bit_22_phase_error^2+Four_bit_45_phase_error^2+Four_bit_67_phase_error^2+Four_bit_90_phase_error^2+Four_bit_112_phase_error^2+Four_bit_135_phase_error^2+Four_bit_157_phase_error^2+Four_bit_180_phase_error^2+Four_bit_202_phase_error^2+Four_bit_225_phase_error^2+Four_bit_247_phase_error^2+Four_bit_270_phase_error^2+Four_bit_292_phase_error^2+Four_bit_315_phase_error^2+Four_bit_337_phase_error^2)/16)

Finally, we calculate RMS error, the Microwaves101 (correct) way.

RMS_phase_error=SQRT((Four_bit_Ref_phase_error2^2+Four_bit_22_phase_error2^2+Four_bit_45_phase_error2^2+Four_bit_67_phase_error2^2+Four_bit_90_phase_error2^2+Four_bit_112_phase_error2^2+Four_bit_135_phase_error2^2+Four_bit_157_phase_error2^2+Four_bit_180_phase_error2^2+Four_bit_202_phase_error2^2+Four_bit_225_phase_error2^2+Four_bit_247_phase_error2^2+Four_bit_270_phase_error2^2+Four_bit_292_phase_error2^2+Four_bit_315_phase_error2^2+Four_bit_337_phase_error2^2)/16)

Finally, we plot RMS phase errors using AWR's built-in (incorrect) formula, along with Microwaves101' correct formula. Voila, your phase error is not as bad as you thought it was.  Notify the Sales Team, stop the presses and update the data sheet!

Next up... we will design a practical 22-degree phase bit using a simplified switch FET model!

Author : Unknown Editor