1,一位模二加法法则:加减法等同于异或,没有进位。

2,将移位寄存器的某几级作为抽头进行模二加法后作为反馈输入,就构成了有反馈的动态移位寄存器。此方法产生的序列是有周期的。

3,假设移位寄存器的级数为n则m序列的周期是2^n-1,(排除全零的情况),也即是说m序列是一种特殊的动态移位寄存器,一般把m序列称为伪随机序列。

4,要想得到m序列需要找到m序列的本原多项式,根据本原多项式得到伪随机序列,本原多项式fx的特点:

5,一般情况下本原多项式可以通过查表得到,得到本原多项式后需要根据本原多项式编写程序得到m序列。

一篇介绍lfsr的英文

This tutorial will teach you how to use LFSRs, why other tutorials on the subject are so confusing, and how you can go about understanding the underlying mathematics if you really want to know.

First, a glossary.

Linear Feedback Shift Register (LFSR):

An n-bit shift register which pseudo-randomly scrolls between 2n-1 values, but does it very quickly because there is minimal combinational logic involved.
Once it reaches its final state, it will traverse the sequence exactly as before.
It has many applications you should already be familiar with if you’re reading this.

Primitive polynomial:
(very basically) A polynomial of degree n that has the form: 1 + … + xn, where (…) are zero or more terms with a coefficient of 1.
xn and 1 are always present.
For each degree, there can be many different primitive polynomials.
These polynomials also must satisfy other mathematical conditions, if you’re really interested see http://mathworld.wolfram.com/PrimitivePolynomial.htmlor google it.
One important property to note is that their reciprocals also form primitive polynomials (that is, they come in pairs). Example: 1 + x3 + x4 is Degree 4, its reciprocal is 1 + x + x4 (10011 and 11001), and both are primitive.

Taps:
Lines that run from the output of one register within the LFSR into XOR gates that determine input to another register within the LFSR.
These are chosen based on the primitive polynomial.

Type 1 or External LFSRs:
One way of implementing LFSRs; all XOR gates are fed sequentially into one another and end up as the input to the least (or most, either is correct) significant bit of the LFSR.
Simply put, the XORs are external from the shift register.

Type 2 or Internal LFSRs:
Another LFSR implementation; XOR gates feed into different registers within the LFSR, and are not sequential.
Simply put, the XORs are inside the shift register.

Other tutorials on this subject are confusing because they only address one type of implementation, don’t explain how they got the taps, or they show the implementation of an LFSR and then in a table show the taps corresponding to a different primitive polynomial of the same degree.
Keep all of this in mind if you look elsewhere.

Consider a simple 3-bit LFSR.
The only primitive polynomials for degree 3 are 1 + x2 + x3 and 1 + x + x3 (they are reciprocals of each other, 1011 and 1101).
Since we have two primitive polynomials, and we have two different implementation strategies, we therefore have four unique ways of implementing the LFSR.
In fact, each of these implementations can differ according to which register is the most significant bit (either way will have 2n-1 states, but with different sequences).

A and B illustrate a Type 1 / External LFSR.

C and D illustrate a Type 2 / Internal LFSR.

A and C illustrate the implementation of 1 + x2 + x3
B and D illustrate the implementation of 1 + x + x3

Since xn and 1 are always present in primitive polynomials, you can think of them as being used as the output of the shift register and the input of the shift register, respectively.

For an n-bit LFSR, you need to discover a primitive polynomial associated with it to implement it.
Tap tables on the internet will list taps as such:

N = 3, Taps at 0, 1, 3 (this corresponds to 1 + x + x3)

This tutorial uses the 0 and 3 as taps because they correspond to the powers of x in the primitive polynomial.
Sometimes Tap tables will omit the 0 and 3, since they must be present.
Other times, they may use 0 to mean the output of the least significant register (so for N = 3, their taps would be listed as "0, 2" instead of "1, 3").
They usually only list the taps associated with one primitive polynomial, but more than one exists.
All of this explains why different tap tables will sometimes show you different numbers!

Here’s another pair of examples, for n = 8 and using the primitive polynomial 1 + x2 + x3 + x4 + x8:

Internal:


External:

Warning!
The images above show the Reset line used incorrectly.
The registers should be seeded to a non-zero value; all-zeroes is called the lock-up state and will not change.
Therefore, at least one register must be preset.
Your choice in seed value determines the order of states, and ultimately the value at the 2n-1 state.
Note that it is also possible to design LFSRs to have an all-ones lock-up state instead, but this will not be discussed here for brevity.
Special thanks to all those who have pointed out this omission.

Here is a good tap table provided by Scott R. Gravenhorst! In this link, the taps listed omit "0." Again, keep in mind that other polynomials do exist.

Good luck!

Images blatantly stolen fromhttp://www.ee.ualberta.ca/~elliott/ee552/studentAppNotes/1999f/Drivers_Ed/lfsr.html and http://www.edacafe.com/books/ASIC/Book/CH14/CH14.7.php

fpga产生伪随机序列的更多相关文章

  1. Xilinx FPGA高速串行收发器简介

    1 Overview 与传统的并行实现方法相比,基于串行I/O的设计具有很多优势,包括:器件引脚数较少.降低了板空间要求.印刷电路板(PCB)层数较少.可以轻松实现PCB设计.连接器较小.电磁干扰降低 ...

  2. DPSK通信系统的FPGA实现

    之前接触过一些FPGA的相关知识,借着实现一个简单的DPSK系统,顺便复习和记录一下Verilog HDL的简单使用方法.准备直接用一张图展现DPSK的调制解调原理,再按照模块介绍Verilog的实现 ...

  3. FPGA与simulink联合实时环路系列——实验三 按键key

    实验三 按键key 实验内容 在FPGA的实验中,经常涉及到按键的使用,按键是必不可少的人机交互的器件之一,在这些实验中,有时将按键的键值读取显示到数码管.LCD或者是通过串口传送到PC的串口助手上进 ...

  4. FPGA与simulink联合实时环路系列——实验二LED

    实验二LED 实验内容 在实验一的基础上,将simulink产生的测试信号输出到FPGA开发板上的LED灯进行显示,这里要在生成的硬件模型上进行修改,将传送到FPGA的信号输出到8个LED灯上,并且对 ...

  5. FPGA优化之高扇出

    Fanout即扇出,模块直接调用的下级模块的个数,如果这个数值过大的话,在FPGA直接表现为net delay较大,不利于时序收敛.因此,在写代码时应尽量避免高扇出的情况.但是,在某些特殊情况下,受到 ...

  6. 关于 FPGA 内部信号扇入扇出

    扇入.扇出系数 扇入系数是指门电路允许的输入端数目.一般门电路的扇入系数为1—5,最多不超过8.扇出系数是指一个门的输出端所驱动同类型门的个数,或称负载能力.一般门电路的扇出系数为8,驱动器的扇出系数 ...

  7. FPGA Timing笔记

    很多FPGA工程师都会遇到timing的问题,如何让FPGA跑到更快的处理频率是永久话题.决定FPGA的timing关键是什么?如何才能跑到更快的频率呢? A. 第一步需要了解FPGA的timing路 ...

  8. FPGA的引脚VCCINT 、VCCIO VCCA

    首先是看到FPGA在配置的时候有三种不同的电VCCINT .VCCIO VCCA,于是就查了下有什么不同: FPGA一般会有许多引脚,那它们都有什么用呢? VCCINT为施加于 FPGA 内核逻辑的电 ...

  9. FPGA与simulink联合实时环路系列——实验一 测试

    实验一 测试 实验内容 在simulink创建测试模块,通过测试模块产生信号,再传送到FPGA,FPGA读出后再将信号无处理传送回simulink进行显示.由此来测试整个硬件在环的功能是否正常,并且熟 ...

随机推荐

  1. 在线修改GTID模式

    在线修改GTID模式 1. 在每一台机器上执行命令 SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = WARN; 这是很重要的一步,必须确保服务器上没有违反GTID规范的 ...

  2. django---ORM之Q查询

    filter 等方法中的关键字参数查询都是一起进行“AND” 的. 如果你需要执行更复杂的查询(例如OR 语句),你可以使用Q对象 调用Q from django.db.models import Q ...

  3. HTML5世界地图

    在线演示 本地下载

  4. 高亮显示QSS文件

    转[作者:一去丶二三里 博客地址:http://blog.csdn.net/liang19890820] 简述 语法高亮是文本编辑器用来显示文本的,特别是源代码,根据不同的类别来用不同的颜色和字体显示 ...

  5. 使用shiro缓存用户身份信息的时候报:java.io.NotSerializableException: org.apache.shiro.util.SimpleByteSource

    最近在使用shiro缓存用户的身份信息的时候,报了simpleByteSource不能序列化,跟进源码一看,原来这个类没有实现序列化的接口,但是我在缓存身份信息的实现又要用到这个类,解决方法:重写一个 ...

  6. 并发-ConcurrentHashMap源码分析

    ConcurrentHashMap 参考: http://www.cnblogs.com/chengxiao/p/6842045.html https://my.oschina.net/hosee/b ...

  7. Kruskal算法-最小生成树

    2017-07-26  10:32:07 writer:pprp Kruskal算法是根据边的加权值以递增的方式,一次找出加权值最低的边来建最小生成树:并且每次添加的边不能造成生成树有回路,直到找到N ...

  8. 深度学习框架TensorFlow在Kubernetes上的实践

    什么是TensorFlow TensorFlow是谷歌在去年11月份开源出来的深度学习框架.开篇我们提到过AlphaGo,它的开发团队DeepMind已经宣布之后的所有系统都将基于TensorFlow ...

  9. 分享:自定义JAVA注解

    元注解 元注解指用来定义注解的注解,例如:@Retention @Target Inherited @Documented等等.最为重要和经常使用的是@Retention @Target. @Rete ...

  10. pandas 选取数据 修改数据 loc iloc []

    pandas选取数据可以通过 loc iloc  [] 来选取 使用loc选取某几列: user_fans_df = sample_data.loc[:,['uid','fans_count']] 使 ...