fpga产生伪随机序列
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产生伪随机序列的更多相关文章
- Xilinx FPGA高速串行收发器简介
1 Overview 与传统的并行实现方法相比,基于串行I/O的设计具有很多优势,包括:器件引脚数较少.降低了板空间要求.印刷电路板(PCB)层数较少.可以轻松实现PCB设计.连接器较小.电磁干扰降低 ...
- DPSK通信系统的FPGA实现
之前接触过一些FPGA的相关知识,借着实现一个简单的DPSK系统,顺便复习和记录一下Verilog HDL的简单使用方法.准备直接用一张图展现DPSK的调制解调原理,再按照模块介绍Verilog的实现 ...
- FPGA与simulink联合实时环路系列——实验三 按键key
实验三 按键key 实验内容 在FPGA的实验中,经常涉及到按键的使用,按键是必不可少的人机交互的器件之一,在这些实验中,有时将按键的键值读取显示到数码管.LCD或者是通过串口传送到PC的串口助手上进 ...
- FPGA与simulink联合实时环路系列——实验二LED
实验二LED 实验内容 在实验一的基础上,将simulink产生的测试信号输出到FPGA开发板上的LED灯进行显示,这里要在生成的硬件模型上进行修改,将传送到FPGA的信号输出到8个LED灯上,并且对 ...
- FPGA优化之高扇出
Fanout即扇出,模块直接调用的下级模块的个数,如果这个数值过大的话,在FPGA直接表现为net delay较大,不利于时序收敛.因此,在写代码时应尽量避免高扇出的情况.但是,在某些特殊情况下,受到 ...
- 关于 FPGA 内部信号扇入扇出
扇入.扇出系数 扇入系数是指门电路允许的输入端数目.一般门电路的扇入系数为1—5,最多不超过8.扇出系数是指一个门的输出端所驱动同类型门的个数,或称负载能力.一般门电路的扇出系数为8,驱动器的扇出系数 ...
- FPGA Timing笔记
很多FPGA工程师都会遇到timing的问题,如何让FPGA跑到更快的处理频率是永久话题.决定FPGA的timing关键是什么?如何才能跑到更快的频率呢? A. 第一步需要了解FPGA的timing路 ...
- FPGA的引脚VCCINT 、VCCIO VCCA
首先是看到FPGA在配置的时候有三种不同的电VCCINT .VCCIO VCCA,于是就查了下有什么不同: FPGA一般会有许多引脚,那它们都有什么用呢? VCCINT为施加于 FPGA 内核逻辑的电 ...
- FPGA与simulink联合实时环路系列——实验一 测试
实验一 测试 实验内容 在simulink创建测试模块,通过测试模块产生信号,再传送到FPGA,FPGA读出后再将信号无处理传送回simulink进行显示.由此来测试整个硬件在环的功能是否正常,并且熟 ...
随机推荐
- js自执行函数&扩展方法
我们通常将JS代码写在一个单独的JS文件中,然后在页面中引入该文件.但是,有时候引入后会碰到变量名或函数名与其它JS代码冲突的问题.那么如何解决这个问题呢?作用域隔离.在JS中,作用域是通过函数来划分 ...
- Python3.x: pyodbc+FreeTDS+UinxODBC连接sybase数据库(Linux系统)
Python3.x: pyodbc+FreeTDS+UinxODBC连接sybase数据库(Linux系统) 一.安装UinxODBC以及依赖包 yum -y install gcc gcc-c++ ...
- UDP协议----简单的CS模型实现
UDP简单介绍 传输层主要应用的协议模型有两种,一种是TCP协议,另外一种则是UDP协议.TCP协议在网络通信中占主导地位,绝大多数的网络通信借助TCP协议完成数据传输.但UDP也是网络通信中不可或缺 ...
- SElinux 读懂.te 定义自己的 .te【转】
本文转载自:https://blog.csdn.net/kongbaidepao/article/details/61417291 一. .te 文件定义中的一些宏 1.1 unix_socket_c ...
- 在Kotlin中 使用js 函数
在Kotlin中 使用js 函数 import javax.script.Invocable import javax.script.ScriptEngineManager fun main(args ...
- 基于 CodeIgniter 的各类开源项目大全
名称:STBlog 介绍:STBlog 是一套由CI中国社区驱动,基于Codeigniter MVC 框架编写的多权限博客系统,轻巧/快速/安全/易拓展/界面友好是它的最大特点. 官方:http:// ...
- JavaWeb -- Struts2 ResultType细化, 国际化
1. ResultType细化 <result-types> <result-type name="chain" class="com.opensymp ...
- 用Java编程计算兔子生兔子的问题
题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第四个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? 程序分析: 这是一个典型的Fibonacci数列问 ...
- sass基础篇
scss的语法非常简单: $color: red; div{ color: $color; } 这就是一个简单的scss代码. 但是,使用 Sass 进行开发,那么是不是直接通过“<link&g ...
- ubuntu14.04搭建Hadoop2.9.0伪分布式环境
本文主要参考 给力星的博文——Hadoop安装教程_单机/伪分布式配置_Hadoop2.6.0/Ubuntu14.04 一些准备工作的基本步骤和步骤具体说明本文不再列出,文章中提到的“见参考”均指以上 ...