Implement the following circuit:
Note that this is a latch, so a Quartus warning about having inferred a latch is expected.
前言
两个输入,包括一个使能信号ena,一个输入d;一个输出信号q。
代码
module top_module (
input d,
input ena,
output q);
always@(*)begin
if(ena) q<=d;
else q<=q;
end
endmodule
总结
对于电平敏感信号列表,建议别具体填写直接写always@(*)就OK了。