【求助】:在ISE10.1功能仿真时正确,时序仿真结果出错 [
- UID
- 1062083
- 性别
- 男
|
【求助】:在ISE10.1功能仿真时正确,时序仿真结果出错 [
这是我的代码的一个模块,我拿来仿真了一下,在功能仿真时仿真结果正确,时序仿真的结果就不完全对,求达人帮忙看下有什么问题。
程序的主要功能就是把输入cmd的数据(cmd[4]=1时才会记录)记录在password里
module jlmm(password,cmd,clk,resetb
);
input clk,resetb;
input[4:0]cmd;
reg[2:0]sub_state,next_sub_state;
output[15:0] password;
reg [15:0]password;
parameter first=3'b000,
second=3'b001,
third=3'b010,
fourth=3'b011,
finish=3'b100;
[email=always@(posedge]always@(posedge[/email] clk or negedge resetb)
begin
if(!resetb)
sub_state<=first;
else
sub_state<=next_sub_state;
end
[email=always@(cmd]always@(cmd[/email] or sub_state)
begin
if(cmd[4]==1)
case(sub_state)
first:
next_sub_state=second;
second:
next_sub_state=third;
third:
next_sub_state=fourth;
fourth:
next_sub_state=finish;
finish:
next_sub_state=finish;
endcase
else
next_sub_state=sub_state;
end
[email=always@(posedge]always@(posedge[/email] clk or negedge resetb)
begin
if(!resetb)
password<=0;
else if(cmd[4]==1)
case(sub_state)
first:
password[15:12]<=cmd[3:0];
second:
password[11:8]<=cmd[3:0];
third:
password[7:4]<=cmd[3:0];
fourth:
password[3:0]<=cmd[3:0];
default:
password<=password;
endcase
else
password<=password;
end
endmodule |
|
|
|
|
|