Re: gr_unpacked_to_packed_bb, modulation

In chunks-to-symbols you need a lookup table of one dimension, so
D=1 and it should contain 4 entries.

Achilleas

Hi again,

Thanks for the reply, that confirmed my suspicion of me being wrong
about D=2.

But then I am wondering how the gr_unpacked_to_packed_bb- block is
working?

When I setup a unpacked_to_packed_bb(2,GR_MSB_FIRST) (I guess
GR_MSB_FIRST
on a regular intel x86, right?) and connect it to a
gr_chunks_to_symbols_bc block using the following lines of code:

float t = sqrt(2)/2;
gr_complex c[] = {
gr_complex(-t, t), gr_complex(t, t),
gr_complex(-t,-t), gr_complex(t,-t)
};

std::vector<gr_complex>
d_constellation(c,c+sizeof©/sizeof(gr_complex));
d_mapper = gr_make_chunks_to_symbols_bc(d_constellation,1);

The program fails with an assert in gr_chunks_to_symbols_bc.cc:68

In an effort to understand this problem, I have modefied
gr_chunks_to_symbols work- function with a few printouts…

in[i] = 1, d_D = 1, d_symbol_table.size() = 4
in[i]*d_D+d_D = 2
in[i] = 69, d_D = 1, d_symbol_table.size() = 4
in[i]*d_D+d_D = 70
packer: gr_chunks_to_symbols_bc.cc:68: virtual int
gr_chunks_to_symbols_bc::work(int, gr_vector_const_void_star&,
gr_vector_void_star&): Assertion `((unsigned int)in[i]*d_D+d_D) <=
d_symbol_table.size()’ failed.
Aborted

Looking at the printouts, one can see that it fails (appropriately) on
the second input, in[i] = 69.

This gave me suspicions regarding gr_packed_to_unpacked, which is the
block “before” in the connection- chain.

Adding a few printouts to that block gave me the following output
(reworked for readability)
Where "residue is the variable with the same name in “unsigned int
get_bit_be1(…)”, return is the same functions return
and out is what is written to out in “general_work(…)”. The “||” is
just there to separate the bytes.

residue:0 1 0 1 0 1 0 1 || 0 1 0 1 0 1 0 1
return : 0 0 0 0 0 0 0 1 || 0 1 0 0 0 1 0 1
out: 1 || 69

The input to the block is a file_source
(gr_make_file_source(sizeof(unsigned char),“ones.in”,false))
containing eight bytes, [0, 0, 0, 1, 1, 0, 1, 1]

What am I doing wrong?
Best regards,
Mattias

Mattias K. wrote:

d_symbol_table.size()’ failed.
Aborted

Looking at the printouts, one can see that it fails (appropriately) on
the second input, in[i] = 69.

Ops, this should read:

This gave me suspicions regarding gr_unpacked_to_packed_bb, which is the
block “before” in the connection- chain.

Please disregard my last mail on the same topic.

I figured it out. It turned out there was no problem once I figured a
bit about what packed and unpacked bytes actually mean.
This shows how important having a cup of coffee now and then is…

cheers,
//Mattias