- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
data type convertion
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-25-2012 02:34 AM
Hi,
The data type after FPGA processing is signed,now the datas need enter into AD9739,and the input data type of AD9739 should be offset binary,the range is 0 to 16383,therefor, I need to transfer the datas from the FPGA.Now,my method is:to the datas(14bits),plus 8192,I use 15bits adder.Then I cut the 14bits for AD9739.How I can assure it is unsigned?Is this right?Thanks~
Re: data type convertion
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-25-2012 06:37 PM
A 14-bit signed number has the same range (max - min) as a 14 bit unsigned number, but a different zero point.
Adding 8192 works, and you don't need a 15-bit adder (the carry out is not needed). Effectively going from
signed 14 bits to unsigned (offset binary) is just inverting the MSB or bit 13. In fact if you look at an RTL schematic
of a constant adder of datas + 8192, you will see that it just inverts the high bit. There is no need to worry about
going out of range.
-- Gabor
Re: data type convertion
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-26-2012 06:01 AM
Thank you very much!Your mean is :for example,I have a 14 bits signed number:10000000000001,if I want to change it into unsigned number,I only need to do is invert the MSB,that is to say,the result is 00000000000001.Is it right?
Re: data type convertion
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-26-2012 09:31 AM
sulilittle wrote:
Thank you very much!Your mean is :for example,I have a 14 bits signed number:10000000000001,if I want to change it into unsigned number,I only need to do is invert the MSB,that is to say,the result is 00000000000001.Is it right?
That's right, but note that in this case "change to an unsigned number" means unsigned offset binary. In your
case, signed -8192 corresponds to unsigned offset binary 0, signed 0 corresponds to unsigned offset binary 8192,
signed 8191 corresponds to unsigned offset binary 16383. These are shown below:
10000000000000 --> 00000000000000
00000000000000 --> 10000000000000
01111111111111 --> 11111111111111
As you see only the MSB changes in each case.
-- Gabor
Re: data type convertion
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-27-2012 02:14 AM
Thank you! I have solved this problem.But I have another question:the datas will enter the AD9739,the datas rate is 540M,I use the clock generated by the AD9739 to clock the data,the project have no timing question.The origin frequency spectrum is 40db,but from the AD9739 ,its frequency spectrum is 20 db.What else reasons ?
Re: data type convertion
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-27-2012 08:31 AM
What are you actually measuring?
Post a diagram, or equipment screen shot, if you can.
------------------------------------------
"If it don't work in simulation, it won't work on the board."











