【发布时间】:2019-05-14 08:16:07
【问题描述】:
我正在尝试使用 GNU Radio 解扰块。我有一个由第三方编写的块,需要解扰。使用的多项式是 x17 + x12 + 1。
代码如下
descrambler_cc_impl::descrambler_cc_impl()
: gr::sync_block("descrambler_cc",
gr::io_signature::make(1, 1, sizeof(unsigned char)),
gr::io_signature::make(1, 1, sizeof(unsigned char)))
{
lsr = 0;
}
/*
* Our virtual destructor.
*/
descrambler_cc_impl::~descrambler_cc_impl()
{
}
int
descrambler_cc_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const unsigned char *in = (const unsigned char *) input_items[0];
unsigned char *out = (unsigned char *) output_items[0];
int i;
for (i = 0; i < noutput_items; i++) {
out[i] = (lsr & 1) ^ ((lsr >> 12) & 1) ^ ((lsr >> 17) & 1);
lsr = lsr << 1;
lsr = lsr | (in[i] & 1);
}
// Tell runtime system how many output items we produced.
return i;
}
现在我想使用 GNU Radio 解扰器块。从
this link,我计算解扰参数如下:Mask - 0x0210001;种子 - 0x00;长度 - 24。
不幸的是,它不能作为上面显示的代码中的对应物。有人可以就为什么这不起作用提供指导吗?
【问题讨论】:
-
能否为您的链接添加一个合适的名称?还有“第三方”:它来自哪里?它遵循一个非常不寻常的命名方案:
_cc表示“复杂输入,复杂输出”,而您所拥有的是“字节输入,字节输出”,它被称为_bb。 -
另外,解释一下你是如何得出长度和系数的。这些参数是在外部指定的,还是从源代码中读取的?
-
另外,你的面具不可能是正确的;移动 17 位不会超过三个字节。
-
另外,请确保您不会误解现有源代码中的位移位;此 LFSR 向左移动! GNU Radio 的 LFSR 右移。
-
我承认使用的约定应该是 _bb 而不是 _cc。这是作者的错误。我通过链接中的示例计算了掩码。即 x^4 + x^3 + x^0 = 0x19 * x^5 + x^3 + x^0 = 0x29 * x^6 + x^5 + x^0 = 0x61 。我假设由于掩码的顺序为 17,因此您至少需要 3 个字节 = 24 位。使用的多项式是 G3RUH/K9NG [(x^17 + x^12 + 1)]
标签: gnuradio gnuradio-companion