Sign In

Don't have a Xilinx account yet?

  • Choose to receive important news and product information
  • Gain access to special content
  • Personalize your web experience on Xilinx.com

Create Account

Username

Password

Forgot your password?
XClose Panel
Xilinx Home
Reply
Contributor
sulilittle
Posts: 50
Registered: ‎12-13-2011
0

data type convertion

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~ 

Expert Contributor
gszakacs
Posts: 5,346
Registered: ‎08-14-2007
0

Re: data type convertion

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

-- Gabor
Contributor
sulilittle
Posts: 50
Registered: ‎12-13-2011
0

Re: data type convertion

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?

Expert Contributor
gszakacs
Posts: 5,346
Registered: ‎08-14-2007
0

Re: data type convertion


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

-- Gabor
Contributor
sulilittle
Posts: 50
Registered: ‎12-13-2011
0

Re: data type convertion

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 ?

Expert Contributor
rcingham
Posts: 2,010
Registered: ‎09-09-2010
0

Re: data type convertion

Frequency spectrum is not measured in dB. It is measured with lower and upper frequencies in Hz.

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."