07.PRBS 生成器
07.PRBS 生成器
1.概念
参考:DSP-Based Testing – Fundamentals 50 PRBS (Pseudo Random Binary Sequence)
https://www3.advantest.com/documents/11348/3e95df23-22f5-441e-8598-f1d99c2382cb
伪随机二进制序列(PRBS)常被用作模拟任务模式的高速串行接口设备测试的模型数据。
LFSR (Linear Feedback Shift Register) 线性反馈移位寄存器
下图位4bit前向移位寄存器,其生成多项式为

%% 验证 4bit LSFR 前向LFSR
pnseq_TEST = comm.PNSequence('Polynomial',[1 0 0 1 1], ...
'InitialConditions',[1 1 1 1],...
'Mask',0,'SamplesPerFrame',15)
out_TEST = pnseq_TEST()
Seed不可以为全0,不然会一直输出为0,PRBS”卡住“。
位的LFSR可以生成个L比特的PRBS组合(除全0之外)。


当需要个重复的序列输出时,使用L位LFSR仅能得到常的重复序列,故而可以补充一位的0。
PRBS7多项式不是电信标准,但它通常在测试设备中实现,因为它非常类似于8B/ 10b编码模式。
问题1:对于多项式的选择
注意:并非所有的m次多项式都能保证达到最大周期长度,解决方法: primitive polynomials
Therefore, the designer typically looks for criteria to select a generator that guarantees a maximum-length PRBS output. In finite field theory, this is guaranteed by selecting a polynomial that is primitive.
因此,设计人员通常会寻找标准来选择保证最大长度PRBS输出的生成器。在有限域理论中,这是通过选择一个原始多项式来保证的。
对于给定L,存在多个 primitive polynomial ,为简化硬件实现,一般选择一个包含最少数量反馈连接的多项式。这些多项式被称为三叉多项式,因为它们是这样的形式:
- Lin, S., and D. J. Costello. 2004. Error Control Coding (2nd Edition). Prentice Hall.
- Peterson, W. W., and E. J. Weldon. 1972. Error-Correcting Codes (2nd Edition). The MIT Press.
问题2:如何从给定的多项式构造LFSR
关于移位寄存器:https://cloud.tencent.com/developer/article/2287337
The signal flows in different directions and the flip-flops have a different orientation

If required to generate the forward counter for a given polynomial g(x), the reciprocal g'(x) should be constructed as a first step, according to this:
问题3:频谱说明及要求

Considering the signal integrity of the waveform, a good digital signal should contain at least 3 lobes (the main + 2 side lobes) in general.
波形的信号完整性,一个好的数字信号一般应该至少包含3个瓣(主瓣+ 2个副瓣)。
So an analog bandwidth of signal path should be greater than 3 times of the bit rate frequency. This is a rule of thumb for designing a load board for digital signal.
因此,信号路径的模拟带宽应大于比特率频率的3倍。这是设计数字信号负载板的经验法则。
This is greatly important in testing high-speed digital interface signals. An ATE resource to test such signals should be required to have more than 3 times of the bit rate as well
这对高速数字接口信号的测试非常重要。用于测试此类信号的ATE资源也应要求具有3倍以上的比特率。
2.Matlab程序实现
https://ww2.mathworks.cn/help/comm/ref/comm.pnsequence-system-object.html
考虑生成多项式为,前向LSFR
pnseq1 = comm.PNSequence('Polynomial',[16 15 13 4 0], ...
'InitialConditions',[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1],...
'Mask',[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1],'SamplesPerFrame',100)
% 'Polynomial' 自最高位到0位
pnseq2 = comm.PNSequence('Polynomial',[1 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1], ...
'InitialConditions',[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1],...
'Mask',[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1],'SamplesPerFrame',100)
mask_value=mask2shift ([1 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1],[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1])
pnseq3 = comm.PNSequence('Polynomial',[1 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1], ...
'InitialConditions',[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1],...
'Mask',mask_value,'SamplesPerFrame',100)
out_1 = pnseq1();
out_2 = pnseq2();
out_3 = pnseq3();
isequal(out_1,out_2)
isequal(out_1,out_3)
3.硬件实现
参考: https://docs.amd.com/v/u/en-US/xapp884_PRBS_GeneratorChecker