名称:基于FPGA的m序列(线性反馈移位寄存器)发生器Verilog代码Quartus仿真
软件:Quartus
语言:Verilog
代码功能:
m序列(线性反馈移位寄存器)发生器
线性反馈移位寄存器设计(m序列)
本源多项式为1+x2+x3+x4+x8
FPGA代码Verilog/VHDL代码资源下载:www.hdlcode.com
演示视频:
设计文档:
1. 工程文件
2. 程序文件
3. 程序编译
4. Testbench
5. 仿真图
部分代码展示:
//伪随机序列发生器 module?M_code( ????input?clk,//时钟 ????input?RESET,//复位 ????output?random_out//输出伪随机信号 ????); reg?[7:0]?shift_data=8'h12;//移位寄存器 parameter?polynomial=8'b10001110;//多项式1+x2+x3+x4+x8 //移位 always?@(posedge?clk?or?negedge?RESET) ???if?(RESET==0)?begin ??????shift_data?<=?8'h12;//复位,获取初始值(可自定义,但不可为0) ???end? ???else?begin//移位 ?????shift_data[0]?<=shift_data[1];//移位 ?????shift_data[1]?<=shift_data[2];//移位 ?????shift_data[2]?<=shift_data[3];//移位 ?????shift_data[3]?<=shift_data[4];//移位 ?????shift_data[4]?<=shift_data[5];//移位 ?????shift_data[5]?<=shift_data[6];//移位 ?????shift_data[6]?<=shift_data[7];//移位 ? ?//反馈多项式 ?????shift_data[7]?<=(shift_data[0]?&?polynomial[7])?^?//异或 ??(shift_data[1]?&?polynomial[6])?^?//异或 ??(shift_data[2]?&?polynomial[5])?^?//异或 ??(shift_data[3]?&?polynomial[4])?^?//异或 ??(shift_data[4]?&?polynomial[3])?^?//异或 ??(shift_data[5]?&?polynomial[2])?^?//异或 ??(shift_data[6]?&?polynomial[1])?^?//异或 ??(shift_data[7]?&?polynomial[0])?;?//异或??? ??end
点击链接获取代码文件:http://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=650
阅读全文
320