Data types and other questions

Hello all,

I’ve been using GNU Radio and the USRP for about a year now, and until
now I
took for granted some of the things that are going on under the hood, if
you
know what I mean. For example, recently, I noticed that the gr_complex
data
type is simply the complex float data type in C++ (I was looking in
gr_complex.h), which means that the data is 64bit data (32bit I and
32bit Q).
I’m sure this is all written down somewhere, but I’m trying to make sure
that
what I’ve seen in correct…Also, I was perusing (I think that’s a word)
through the gr-usrp/ folder and I also noticed that in usrp1_source_c.cc
that
the output seems to be of “short” data type:

for (int i = 0; i < nitems; i++){
dst[2i + 0] = host_to_usrp_short((short) real(in[i])); // FIXME
saturate?
dst[2
i + 1] = host_to_usrp_short((short) imag(in[i])); // FIXME
saturate?
}

does this mean that the 64-bit gr_complex float is converted to integers
(16bit
I and 16bit Q) when it
gets to the USRP? This seems odd to me (but that could just be me not
understanding), so I was wondering if maybe someone could help me
understand.

Thanks in advance,

David

[email protected] wrote:

does this mean that the 64-bit gr_complex float is converted to integers (16bit
I and 16bit Q) when it
gets to the USRP? This seems odd to me (but that could just be me not
understanding), so I was wondering if maybe someone could help me understand.

The USRP sends and receives complex shorts (pairs of 16-bit ints) over
the USB bus. The conversion to/from complex floats (pairs of 32-bit
floats) is done in the host computer. Everything happening in the USRP
is fixed point.

There are alternative blocks you can instantiate in your programs which
won’t do this conversion automatically for you, if you prefer to use the
fixed-point numbers.

Matt

On Tue, 2006-10-31 at 13:53 -0800, Matt E. wrote:

is fixed point.

I guess that also means you can double your storage space and get better
disk i/o speed by saving data in native usrp short format.

On Tue, Oct 31, 2006 at 04:47:54PM -0500, [email protected] wrote:

what I’ve seen in correct…
Yes, you’ve got it correct :wink:

Also, I was perusing (I think that’s a word)

gets to the USRP? This seems odd to me (but that could just be me not
understanding), so I was wondering if maybe someone could help me understand.

Yes this is correct. On the host we prefer to work with complex
numbers, and complex is a lot easier to deal with than
complex.
However, as Matt noted, the data passed across the USB is 16-bit I & Q.

Thanks in advance,
David

Eric