问题背景:
使用FPGA 产生一个2M速率的误码仪,误码仪格式X*9+X*5+1(X的9次方+X的5次方+1),满足国际电联的标准ITU V.52标准。国际电联标准英文如下:
4.1 511-bit pseudo-random test pattern
This pattern is primarily intended for error measurements on data circuits at bit rates up to 14 400 bit/s (see
Recommendation O.153).
The pattern may be generated in a nine-stage shift register whose 5th and 9th stage outputs are added in a
modulo-two addition stage, and the result is fed back to the input of the first stage. The pattern begins with the first ONE
of 9 consecutive ONEs.
Number of shift register stages 9
Length of pseudo-random sequence 2*9-1= 511 bits (2的9次方减1)
Longest sequence of ZEROs 8 (non-inverted signal)
按照上面英文的理解,写了一段VHDL程序如下:
process(clk)
begin
if rising_edge(clk) then
if (reset = '0') then
shift_out <= (others => '1');------初始状态全1
fdbk <= shift_out(8) xor shift_out(4);
else
m_code_out <= shift_out(8);-----最高位移位输出-----(这是我想要的n=9,长度为511的m序列)
shift_out(8 downto 1) <= shift_out(7 downto 0);
fdbk <= shift_out(8) xor shift_out(4);-----第5位和第9位模2加
shift_out(0) <= fdbk;-----第5位和第9位模2加的值作为新的输入
end if;
end if;
end process;