Conversion 1QN -> 2'Complement

T

Troels Smit

Guest
Hi all,

I have to convert a 1QN number into a 2' complement number both 20 bit
wide.

1QN define numbers between -1 and 1-(2^-n) with a binary point after 2
first bits.
i.e:
+1 : 0100 0000 ...
-1 : 1100 0000 ...
pi/8 : 0011 0010 ...
-pi/8 : 1100 1101 ...

The 2'complement number is between 1 and -1, where 7FFFF define 1 and
8FFFF define -1.
i.e:
+1 : 0111 1111
-1 : 1000 0000
+1/8 : 0000 1111
-1/8 : 1111 0001

Does anyone have an idea of how to convert between these two formats ?
It is the 1Qn that has to be converted into the 2'complement number.
 
On page 5 at this address:
http://www.xilinx.com/ipcenter/catalog/logicore/docs/cordic.pdf

They write:
Pout : "0000101011" => 00.00101011 =>-0.168
PHASE_IN : "0001100100" => 000.1100100 => 0.781

Now, both numbers are describe as 2QN numbers ... but they have
different fixed point, and one is negative .... I can't seem to
decipher what's going on :-/
Can anyone explain it ? (to me it seems like the line Pout... is
wrong)

As to the 1QN format I asked about yesterday ... Im using the cordic
to generate sin/cos output and therefore the x_out and y_out in 1QN
format will never use its 2. MSB (data > 1) and a sll performed on the
lower part of the data (keeping msb) make data usable for the DAC (I
think).

/Troels

troels_smit@hotmail.com (Troels Smit) wrote in message news:<316d5fc0.0306300235.64f32f9b@posting.google.com>...
Hi all,

I have to convert a 1QN number into a 2' complement number both 20 bit
wide.

1QN define numbers between -1 and 1-(2^-n) with a binary point after 2
first bits.
i.e:
+1 : 0100 0000 ...
-1 : 1100 0000 ...
pi/8 : 0011 0010 ...
-pi/8 : 1100 1101 ...

The 2'complement number is between 1 and -1, where 7FFFF define 1 and
8FFFF define -1.
i.e:
+1 : 0111 1111
-1 : 1000 0000
+1/8 : 0000 1111
-1/8 : 1111 0001

Does anyone have an idea of how to convert between these two formats ?
It is the 1Qn that has to be converted into the 2'complement number.
 

Welcome to EDABoard.com

Sponsor

Back
Top