FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > VHDL

VHDL comp.lang.vhdl newsgroup / Usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-30-2003, 12:35 PM
Troels Smit
Guest
 
Posts: n/a
Default Conversion 1QN -> 2'Complement

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.
Reply With Quote
  #2 (permalink)  
Old 07-01-2003, 11:43 AM
Troels Smit
Guest
 
Posts: n/a
Default Re: Conversion 1QN -> 2'Complement ( Cordic )

On page 5 at this address:
http://www.xilinx.com/ipcenter/catal...ocs/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

[email protected] (Troels Smit) wrote in message news:<316d5fc0.0306300235.64f32f9b@posting.go[email protected] 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.

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Two-complement value from ADC, Spartan-3A, 3E m m FPGA 0 09-17-2008 08:34 PM
Two's complement Coregen gone? Marty Ryba FPGA 3 01-18-2008 07:34 PM
Ones' complement addition Koen Van Renterghem FPGA 13 01-23-2007 10:39 AM
Verilog 2's Complement Shifter Davy FPGA 5 02-07-2006 07:14 PM
Verilog 2's Complement Shifter Davy Verilog 4 02-07-2006 07:14 PM


All times are GMT +1. The time now is 01:54 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved