LFSR代码
module lfsr( input clk, input rst_n, output o1, output [3:0] o4 ); reg [3:0]tmp; always@(posedge clk or negedge rst_n) if(~rst_n) tmp<=4'b1111; else begin tmp[3]<=tmp[0]; tmp[2]<=tmp[3]; tmp[1]<=tmp[2]; tmp[0]<=tmp[0]^tmp[1]; end assign o4=tmp; assign o1=tmp[0]; endmodule