qmn91 发表于 2011-6-27 03:16:37

求助!!这个小warning怎么改!~

源程序:
module LATCH1
(
        input        clk,
        input        D,
        output        reg Q
);

always @ (D or clk)
        begin
                if (clk) Q <= D;
        end
endmodule


但总有
Warning (10240): Verilog HDL Always Construct warning at LATCH1.v(8): inferring latch(es) for variable "Q", which holds its previous value in one or more paths through the always construct
请问这个warning产生的原因是什么??如何修改?
谢谢!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

蓝余 发表于 2011-6-27 22:12:28

warning 有些不用管的,只要自己确定功能是正确的就行。

njithjw 发表于 2011-6-28 19:28:01

不知道你想实现什么功能,如果只是希望得到一个D触发器改成下面的就可以了
module LATCH1
(
      input      clk,
      input      D,
      output      reg Q
);

always @ (clk)
begin
    if (clk)
      Q <= D;
    else ;
end

endmodule
页: [1]
查看完整版本: 求助!!这个小warning怎么改!~