在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 26499|回复: 88

LFSR(Linear Feedback Shift Registers)

[复制链接]
发表于 2009-8-21 16:46:42 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
设计中,当我们只需要计总数,不需要考虑中间的数字时,用LFSR要比adder来的更快,模块更小这里提供了几篇关于lsdr的论文和一个简单的testbench生成软件

lfsr.rar

360.53 KB, 下载次数: 1303 , 下载积分: 资产 -2 信元, 下载支出 2 信元

 楼主| 发表于 2009-8-21 16:50:36 | 显示全部楼层

顺便附上tutorial

Understanding Linear Feedback Shift Registers – The Easy Way
Written by Dan Healy for UCSC’s CMPE125 class.



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.html or 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 from http://www.ee.ualberta.ca/~elliott/ee552/studentAppNotes/1999f/Drivers_Ed/lfsr.html and http://www.edacafe.com/books/ASIC/Book/CH14/CH14.7.php


发表于 2009-9-9 10:23:10 | 显示全部楼层

觉得LFSR很神奇。

学习一下!
发表于 2009-9-9 15:16:07 | 显示全部楼层
学习学习~~~~~~~
发表于 2009-9-9 17:22:02 | 显示全部楼层
Thanks
发表于 2009-9-10 07:52:39 | 显示全部楼层
good, thanks.
发表于 2009-11-23 20:18:37 | 显示全部楼层
多谢分享
发表于 2009-12-8 04:08:53 | 显示全部楼层
太棒了 学习学习
发表于 2009-12-15 09:52:11 | 显示全部楼层
xie xie!
发表于 2009-12-18 02:16:31 | 显示全部楼层
正需要谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

×

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-5-18 11:15 , Processed in 0.033562 second(s), 9 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表