四、FPGA之序列信号发生器
2015-05-16 15:22
183 查看
本次试验是序列信号发生器,本次要产生的序列是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:
next_state=S1;
S1:
next_state=S2;
S2:
next_state=S3;
S3:
next_state=S4;
S4:
next_state=S5;
S5:
next_state=S6;
S6:
next_state=S7;
S7:
next_state=S0;
endcase
end
always@(posedge clk or negedge rst_n)
if(rst_n==1'b0)
out<=1'b0;
else
begin
if(current_state==S0)
out<=1'b0;
else if(current_state==S1)
out<=1'b0;
else if(current_state==S2)
out<=1'b0;
else if(current_state==S3)
out<=1'b1;
else if(current_state==S4)
out<=1'b1;
else if(current_state==S5)
out<=1'b1;
else if(current_state==S6)
out<=1'b0;
else if(current_state==S7)
out<=1'b1;
else;
end
endmodule
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:
next_state=S1;
S1:
next_state=S2;
S2:
next_state=S3;
S3:
next_state=S4;
S4:
next_state=S5;
S5:
next_state=S6;
S6:
next_state=S7;
S7:
next_state=S0;
endcase
end
always@(posedge clk or negedge rst_n)
if(rst_n==1'b0)
out<=1'b0;
else
begin
if(current_state==S0)
out<=1'b0;
else if(current_state==S1)
out<=1'b0;
else if(current_state==S2)
out<=1'b0;
else if(current_state==S3)
out<=1'b1;
else if(current_state==S4)
out<=1'b1;
else if(current_state==S5)
out<=1'b1;
else if(current_state==S6)
out<=1'b0;
else if(current_state==S7)
out<=1'b1;
else;
end
endmodule
相关文章推荐
- FPGA Verilog HDL 系列实例--------序列信号发生器
- 【连载】 FPGA Verilog HDL 系列实例--------序列信号发生器
- 基于FPGA的高精度数字信号发生器
- 基于labview和fpga的信号发生器
- cpld的入门交流之二:秒信号发生器
- 基于FPGA的跨时钟域信号处理——借助存储器
- Verilog实现m序列发生器
- FPGA保留信号的语句
- 例2-20 将-100~100的序号序列给出的正弦信号压缩、扩展2倍并与元信号进行比较,时间间隔是0.3s
- 【新品发布】正式发布 [ AB-S05 ] 函数信号发生器
- 基于ATMEGAL16单片机的信号发生器
- 序列发生器管理组件 Example 程序
- FPGA作业3:定时产生脉冲计数序列
- 经典 函数信号发生器
- 信号发生器的输出阻抗与负载的关系
- 基于ARM + FPGA 的信号采集系统方案 ARM-STM32 Cortex M3 FPGA-CYCLONE4 传感器:光栅和压力传感器
- 基于FPGA的音频信号的FIR滤波(Matlab+Modelsim验证)
- 序列发生器管理组件 Example 程序
- OURS-SDR高级软件无线电-信号发生器IP
- 基于labview虚拟函数信号发生器的设计 最好有源程序