扩频通讯中会用的到伪随机数列 —— m序列
代码中是5bit原始码
module m_generate (
clock ,
reset ,
m_code
);
input clock ,reset ;
output m_code ; reg [:]ori_reg ; //original code
always @ (posedge clock)
if(!reset)
begin
ori_reg <= 'b10000;
end
else
begin
ori_reg[] <= ori_reg[] ^ ori_reg[] ;
ori_reg[:] <= ori_reg[:] ;
end assign m_code = ori_reg[] ; endmodule