|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
这是特权VIP_EX_8里面ddr_avl_bridge里面的一段代码
有大神帮忙看下吗,谢谢,本人觉得 这段else if(((sddr_state == SDDR_READRF) || (sddr_state == SDDR_READDJ)) && (cnt == 8'd0)) local_burstbegin <= local_ready; 条件不能满足啊,程序先进入sddr_state == SDDR_WRIT,出来时cnt==2,只有计数溢出才能为0吧
//状态机
always @(posedge phy_clk or negedge local_rst_n)
if(!local_rst_n) sddr_state <= SDDR_IDLE;
else begin
case(sddr_state)
SDDR_IDLE: begin
if(wfifo_used > 8'd0) sddr_state <= SDDR_WRIT;
else if(!rdfifo_clr_r[3] && rfifo_dj_used < 9'd200) sddr_state <= SDDR_READDJ;
else if(!rdfifo_clr_r[3] && rfifo_rf_used < 9'd200) sddr_state <= SDDR_READRF;
else sddr_state <= SDDR_IDLE;
end
SDDR_WRIT: begin
if((cnt == 8'd1) && local_ready) sddr_state <= SDDR_WSOP;
else sddr_state <= SDDR_WRIT;
end
SDDR_WSOP: sddr_state <= SDDR_IDLE;
SDDR_READRF: begin
if(dcnt >= 8'd8) sddr_state <= SDDR_RSOPRF; //local_size=8,
else sddr_state <= SDDR_READRF;
end
SDDR_RSOPRF: sddr_state <= SDDR_IDLE;
SDDR_READDJ: begin
if(dcnt >= 8'd8) sddr_state <= SDDR_RSOPDJ;
else sddr_state <= SDDR_READDJ;
end
SDDR_RSOPDJ: sddr_state <= SDDR_IDLE;
default: sddr_state <= SDDR_IDLE;
endcase
end
//计数器
always @(posedge phy_clk or negedge local_rst_n)
if(!local_rst_n) cnt <= 8'd0;
else if(sddr_state == SDDR_WRIT) begin
if(cnt == 8'd0) cnt <= cnt+1'b1;//延时一拍
else if((cnt == 8'd1) && local_ready) cnt <= cnt+1'b1;//写数据状态SDDR_WRIT下cnt=1,写完cnt>=2
else ;//addr_sdate中cnt最大为2
end
else if((sddr_state == SDDR_READRF) || (sddr_state == SDDR_READDJ)) begin
if(local_ready) cnt <= cnt+1'b1;//
else ;
end
else cnt <= 8'd0;
/Burstbegin产生,
always @(posedge phy_clk or negedge local_rst_n)
if(!local_rst_n) local_burstbegin <= 1'b0;
else if(local_ready && (sddr_state == SDDR_WRIT) && (cnt == 8'd1)) local_burstbegin <= 1'b1;//写状态下使能
else if(((sddr_state == SDDR_READRF) || (sddr_state == SDDR_READDJ)) && (cnt == 8'd0)) local_burstbegin <= local_ready;应该是计数溢出cnt=256
else local_burstbegin <= 1'b0; |
|