小弟写了一个控制12位AD tlv5613,想用XC95108控制AD转换,但是遇到的问题相当郁闷。行为仿真正确,但时序仿真确怎么也来。我用示波器测试过,控制口一直是低电平。忘有经验的大哥大姐帮小弟看看,指点迷津,感激不尽!! 程序: module FSM_5613(rst,dac_clk,a1,a0,dac_cs,dac_we,dac_ld); input rst,dac_clk; output a1,a0,dac_cs,dac_we,dac_ld; reg a1,a0,dac_cs,dac_we,dac_ld; reg[2:0] present; parameter reset_dac=3'b000,rd_high=3'b001,ld_high=3'b010,rd_low=3'b011,ld_low=3'b100; always@(posedge dac_clk or posedge rst)
if(rst) begin present=reset_dac; dac_ld=0; dac_cs=1; a0=0; a1=0; dac_we=1; end
else
begin
case(present)
reset_dac: if(dac_cs) begin present=rd_high; dac_cs=0; dac_we=0; dac_ld=1; end
rd_high: if(dac_we==0) begin present=ld_high; dac_we=1; a0=1; end
ld_high: if(dac_we==1) begin present=rd_low; dac_we=0; end
rd_low: if(dac_we==0) begin present=ld_low; dac_we=1; end
ld_low: if(dac_we==1) begin present=reset_dac; dac_cs=1; dac_ld=0; a0=0; end default:present=reset_dac;
endcase end endmodule
行为仿真-时序仿真分别如下图: |