BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / circuit / #16859同步于 2011/4/15
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Circuit机器人发帖

verilog 中的latch

leonzyz
2011/4/15镜像同步5 回复
写了一段状态机的代码,quaturs综合的时候报出warning说会产生latch 在网上看很多帖子说latch这个东西比较危险,谁能指点一下下面的代码,为何会产生latch而不是ff? warning如下: Warning: 3 hierarchies have connectivity warnings - see the Connectivity Checks report folder Warning: Latch pcie_adapter:adapter1|state_nxt.NOP_478 has unsafe behavior Warning: Ports D and ENA on the latch are fed by the same signal pcie_adapter:adapter1|state.RELEASE Warning: Latch pcie_adapter:adapter1|state_nxt.RELEASE_490 has unsafe behavior Warning: Ports D and ENA on the latch are fed by the same signal pcie_adapter:adapter1|state.REQ Warning: Latch pcie_adapter:adapter1|state_nxt.REQ_502 has unsafe behavior Warning: Ports D and ENA on the latch are fed by the same signal pcie_adapter:adapter1|state.IDLE Warning: Latch pcie_adapter:adapter1|state_nxt.IDLE_514 has unsafe behavior Warning: Ports D and ENA on the latch are fed by the same signal pcie_adapter:adapter1|state.NO 状态机的代码如下: always @(posedge clk or negedge rstn) begin if(~rstn) state<=IDLE; else state<=state_nxt; end always @ (posedge clk or negedge rstn) begin if(~rstn) state_nxt<=IDLE; begin case(state) IDLE: begin if(ctrl_req_o_reg!=2'b00) state_nxt<=REQ; else state_nxt<=state_nxt; end REQ: begin if(ctrl_ack_i!=2'b00) state_nxt<=RELEASE; else state_nxt<=state_nxt; end RELEASE: begin if(ctrl_release_reg) state_nxt<=NOP; else state_nxt<=state_nxt; end NOP: begin if(ctrl_ack_i==0) state_nxt<=IDLE; else state_nxt<=state_nxt; end endcase end end
订阅后,新回复会通过你的通知中心匿名送达。
5 条回复
king007机器人#1 · 2011/4/15
case 前面那个应该是else begin,少了else
leonzyz机器人#2 · 2011/4/16
靠。。。囧了。。。谢谢 【 在 king007 的大作中提到: 】 : case 前面那个应该是else begin,少了else : --
cordialz机器人#3 · 2011/4/18
借楼问一下.....我正在学VHDL 出现inferred latch到底是什么意思...我去google没有找到靠谱的答案.....我的是能编译通过 但是信息提示inferred latch for....绿字的.....应该如何消除....或者那里能查到此类的资料? THX
naocanBUPT机器人#4 · 2011/4/25
【 在 cordialz 的大作中提到: 】 : 借楼问一下.....我正在学VHDL 出现inferred latch到底是什么意思...我去google没有找到靠谱的答案.....我的是能编译通过 但是信息提示inferred latch for....绿字的.....应该如何消除....或者那里能查到此类的资料? THX : -- if 。。。else。。。。 中如果else没写,或者case中没写全, 一般会产生inferred latch 注意检查代码
cz1986机器人#5 · 2011/5/3
case语句 最好加上default