vector phase rotator

May 09, 2014 8 Replies

We did a quadrature-signal phase rotator in an FPGA, and I did this just to check my rusty high-school trig. The FPGA data is signed 16-bit fractional. We digitize an incoming sine wave (called I) and delay one path through a FIFO to get 90 degree lag, which we flip to be lead (called Q) and apply the I and Q data streams to the rotator block. We get I' and Q' out, the rotated pair.



I used the natural convention that a phase shift of +90 makes a sine wave happen



1/4 cycle earlier in time, which LT Spice agrees with. I was a little surprised that my customer assumed the opposite convention. We included a bit in the FPGA to give him the choice.


Version 4 SHEET 1 920 680 WIRE 96 -336 -64 -336 WIRE 144 -336 96 -336 WIRE 672 -336 496 -336 WIRE 720 -336 672 -336 WIRE -64 -272 -64 -336 WIRE 496 -256 496 -336 WIRE -64 -144 -64 -192 WIRE 496 -128 496 -176 WIRE 64 96 -64 96 WIRE 112 96 64 96 WIRE 144 96 112 96 WIRE 640 96 512 96 WIRE 688 96 640 96 WIRE 720 96 688 96 WIRE -64 160 -64 96 WIRE 64 160 64 96 WIRE 512 160 512 96 WIRE 640 160 640 96 WIRE -64 288 -64 240 WIRE 64 288 64 240 WIRE 512 288 512 240 WIRE 640 288 640 240 FLAG -64 288 0 FLAG 512 288 0 FLAG 64 288 0 FLAG 640 288 0 FLAG 112 96 I FLAG 688 96 Q FLAG -64 -144 0 FLAG 496 -128 0 FLAG 96 -336 I2 FLAG 672 -336 Q2 SYMBOL voltage -64 144 R0 WINDOW 0 -90 60 Left 2 WINDOW 3 -296 121 Left 2 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName VI SYMATTR Value SINE(0 1 107.142K 0 0 0) SYMBOL voltage 512 144 R0 WINDOW 0 -94 61 Left 2 WINDOW 3 -309 120 Left 2 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName VQ SYMATTR Value SINE(0 1 107.142K 0 0 90) SYMBOL res 48 144 R0 WINDOW 0 61 44 Left 2 WINDOW 3 66 76 Left 2 SYMATTR InstName R1 SYMATTR Value 1 SYMBOL res 624 144 R0 WINDOW 0 61 41 Left 2 WINDOW 3 68 75 Left 2 SYMATTR InstName R2 SYMATTR Value 1 SYMBOL bv -64 -288 R0 WINDOW 0 48 16 Left 2 WINDOW 3 56 120 Left 2 SYMATTR InstName B1 SYMATTR Value V=V(Q) * sin(T) + V(I) * cos(T) SYMBOL bv 496 -272 R0 WINDOW 0 53 7 Left 2 WINDOW 3 53 116 Left 2 SYMATTR InstName B2 SYMATTR Value V=V(Q) * cos(T) - V(I) * sin(T) TEXT -224 24 Left 2 !.tran 20u TEXT -64 344 Left 2 ;107.142 KHz SINEWAVE TEXT -64 384 Left 2 ;1 VOLT PEAK TEXT 104 384 Left 2 ;ANGLE 0 TEXT 504 384 Left 2 ;1 VOLT PEAK TEXT 680 384 Left 2 ;ANGLE +90 TEXT 504 344 Left 2 ;107.142 KHz SINEWAVE TEXT 584 -208 Left 2 ;x' = x*cos(t) - y*sin(t) TEXT 24 -216 Left 2 ;y' = x*sin(t) + y*cos(t) TEXT -296 -24 Left 2 !.PARAM T = 30/57.296 TEXT 96 128 Left 2 ;sine TEXT 688 120 Left 2 ;cos TEXT 208 -48 Left 2 ;PHASE ROTATOR TEXT 216 -8 Left 2 ;JL JAN 7 2014 TEXT -272 -72 Left 2 ;T = PHASE LEAD TEXT 56 -296 Left 2 ;rotated sine TEXT 600 -304 Left 2 ;rotated cos TEXT 280 128 Left 2 ;INPUT TEXT 280 -296 Left 2 ;OUTPUT


John Larkin Highland Technology Inc www.highlandtechnology.com jlarkin at highlandtechnology dot com Precision electronic instrumentation

On a sunny day (Fri, 09 May 2014 09:06:23 -0700) it happened John Larkin wrote in :

90 shift + is to the right is later.

I'm afraid not, if it's trigonometry, as the OP says, plus means advance of phase (earlier); minus is delay.

On a sunny day (Fri, 9 May 2014 10:26:34 -0700 (PDT)) it happened Vlad wrote in :

Don't be afraid. If you look at amplitude versus time (graphical), then to the right is later, or time +, to the left is earlier (time -). :-)

Then a behavioural source with sin(2*pi*time-pi/2) should output cos(), but it's -cos(). I think what you say refers to the sign of the time axis, not the same with the trigonometry meaning. At least that's the trigonometry I learned, late means the time has run out, you "owe" time, minus. LTspice s eems to think that way, too, as noted by John Larkin.

He's using the physicist's sign convention, where a wave travelling toward +x is exp(kx - omega t). That leads to a phase lead being a negative phase offset--the phase decreases with time, so if it arrives earlier it has a more negative phase. That's mildly annoying, but in physics calculations one is traditionally more interested in spatial behaviour. Positive frequencies lead to fewer sign blunders, so physicists take spatial frequency to be positive for a wave going to +x.

In EE, we're more concerned with temporal behaviour, so we use the opposite convention for the same reason.

I always use 'i' in physics calculations and 'j' in EE, which keeps it all straight.

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 hobbs at electrooptical dot net http://electrooptical.net

On a sunny day (Fri, 9 May 2014 10:48:32 -0700 (PDT)) it happened Vlad wrote in :

No no, the customer is always right.

I always do the opposite >:-} ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required