HDLBits练习——Exams/m2014 q4a

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了。

你可能感兴趣的:(fpga开发)