|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
我是刚刚开始作FPGA的新手,好不容易学会时序仿真了,但是时序仿真没有输出!我应该从那分析啊!
我的源代码是:
/*It is a program of series input data to parallel out data,
which is used in 16DAPSK*/
`timescale 1us/1ns
module series_to_parallel(series_in,
convert_clk,
out_clk,
convert_rst,
parallel_out,
convert_out,
convert_begin,
busy);
input series_in;
input convert_clk;
input out_clk;
input convert_rst;
input convert_begin;
output[3:0] parallel_out;
output[3:0] convert_out;
output busy;
reg[3:0] parallel_out;
reg[3:0] convert_out;
reg busy;
reg [5:0] shift_state;
//reg convert_begin;
parameter shift_state_begin=6'b100000;
parameter shift_state_bit0=6'b000010;
parameter shift_state_bit1=6'b000100;
parameter shift_state_bit2=6'b001000;
parameter shift_state_bit3=6'b010000;
parameter shift_state_end= 6'b000001;
always @(posedge convert_rst or posedge convert_clk)
begin
if(convert_rst)
begin
//busy<=1'b1;
//convert_begin<=1'b1;
if(convert_begin)
begin
shift_state<=shift_state_begin;
parallel_out<=4'b0000;
end
else
begin
shift_state<=shift_state_end;
parallel_out<=4'b0000;
end
end
else
begin
case(shift_state)
shift_state_begin:
begin
if(convert_begin)
begin
shift_state<=shift_state_bit3;
busy<=1'b1;
end
else
begin
shift_state<=shift_state_end;
busy<=1'b0;
end
end
shift_state_bit3:
begin
if(convert_begin)
begin
parallel_out[3]<=series_in;
shift_state<=shift_state_bit2;
busy<=1'b1;
end
else
begin
shift_state<=shift_state_end;
busy<=1'b0;
end
end
shift_state_bit2:
begin
if(convert_begin)
begin
parallel_out[2]<=series_in;
shift_state<=shift_state_bit1;
busy<=1'b1;
end
else
begin
shift_state<=shift_state_end;
busy<=1'b0;
end
end
shift_state_bit1:
begin
if(convert_begin)
begin
parallel_out[1]<=series_in;
shift_state<=shift_state_bit0;
busy<=1'b1;
end
else
begin
shift_state<=shift_state_end;
busy<=1'b0;
end
end
shift_state_bit0:
begin
if(convert_begin)
begin
parallel_out[0]<=series_in;
shift_state<=shift_state_bit3;
busy<=1'b1;
end
else
begin
shift_state<=shift_state_end;
busy<=1'b0;
end
end
shift_state_end:
begin
if(convert_begin)
begin
shift_state<=shift_state_begin;
busy<=1'b1;
end
else
begin
shift_state<=shift_state_end;
busy<=1'b0;
end
end
default:
begin
shift_state<=shift_state_end;
//convert_begin<=1'b0;
end
endcase
end
//busy<=1'b0;
end
//?????????1/4??????
[email=always@(posedge]always@(posedge[/email] out_clk or posedge convert_rst)
begin
if(convert_rst)
convert_out<=4'b0000;
else
convert_out<=parallel_out;
end
endmodule
请高人指点! |
|