本次试验是序列信号发生器,本次要产生的序列是00011101序列,关于序列信号发生器的原理这里就不说了,网上有很多资料。下面给出序列信号发生器的一种设计源代码。
module xulie(clk,rst_n,out);
input clk;
input rst_n;
output out;
reg out;
parameter S0=3'd0,S1=3'd1,S2=3'd2,S3=3'd3,S4=3'd4,S5=3'd5,S6=3'd6,S7=3'd7;
reg[2:0]current_state,next_state;
always@(posedge clk or negedge rst_n)
if(rst_n==1'b0)
current_state<=S0;
else
current_state<=next_state;
always@(*)
begin
case(current_state)
S0:
ne