|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
我想当装态机到达startcaping状态时开始让地址线增一,但是仿真却不行!!麻烦各位给看看啊!急啊,兜一个月了!!!!再搞不定就...唉!!
`timescale 1ns/100ps
module capcard (we,nrd,addressbus,reset,CAPING,CAPSTR,ICLK,IDQ,IGPV,IGPH);
input CAPSTR,ICLK,IDQ,IGPH,IGPV,nrd,reset;
output CAPING,we;
output [17:0] addressbus;
reg we;
reg [17:0] addressbus;//18位地址线
reg CAPING;
reg [2:0] state;
parameter idle=3'b000, startflag=3'b001, //状态机
wait_vstart =3'b010, wait_vend =3'b011,
wait_hstart =3'b100, wait_hend=3'b101,
startcaping=3'b110;
initial
begin
addressbus<=18'b00_0000_0000_0000_0000;//复位
we=1;
CAPING=1;
state=idle;
end
always @ (posedge ICLK)
begin
if(!reset)begin
we<=1;
CAPING<=1;
state<=idle;
end
else
case(state)
idle:
if(!CAPSTR)
state<=startflag;
startflag:
if(!IGPV)begin
state<=wait_vstart;
end
wait_vstart:
if(IGPV)begin
state<=wait_vend;
end
wait_vend:
if(!IGPH)begin
state<=wait_hstart;
end
wait_hstart:
if(IGPH)begin
state<=wait_hend;
end
wait_hend:
if(IDQ)begin
state<=startcaping;
end
startcaping:begin
addressbus=addressbus+1;
we<=0;
CAPING<=0;
if(!IGPV)state<=idle;
else state=startcaping;
end
default : state<=idle;
endcase
end
endmodule |
-
仿真图
|