Verilog刷题笔记45

题目:Given the finite state machine circuit as shown, assume that the D flip-flops are initially reset to zero before the machine begins.

Build this circuit.

解题:

bash 复制代码
module top_module (
    input clk,
    input x,
    output z
); 
    wire [2:0]size;
    dtouch state0(
        .Clk(clk),
        .d(x^size[0]),
        .q(size[0])
    );
    dtouch state1(
        .Clk(clk),
        .d(x&(~size[1])),
        .q(size[1])
    );
    dtouch state2(
    	    .Clk(clk),
        	.d(x|(~size[2])),
            .q(size[2])
    );
    assign z=~(size[0]|size[1]|size[2]);
        

endmodule
       
        module dtouch(
        	input Clk,
            input d,
            output q
        
        );
            always@(posedge Clk)begin
                q<=d;
            end
        endmodule

结果正确:

注意点:该题有三个门电路,三个触发器,考虑用例化的办法实现。

相关推荐
齐生12 天前
iOS 知识点 - 渲染机制、动画、卡顿小集合
笔记
用户962377954482 天前
VulnHub DC-1 靶机渗透测试笔记
笔记·测试
齐生13 天前
iOS 知识点 - IAP 是怎样的?
笔记
tingshuo29174 天前
D006 【模板】并查集
笔记
tingshuo29174 天前
S001 【模板】从前缀函数到KMP应用 字符串匹配 字符串周期
笔记
西岸行者10 天前
学习笔记:SKILLS 能帮助更好的vibe coding
笔记·学习
ZPC821010 天前
docker 镜像备份
人工智能·算法·fpga开发·机器人
ZPC821010 天前
docker 使用GUI ROS2
人工智能·算法·fpga开发·机器人
starlaky10 天前
Django入门笔记
笔记·django
勇气要爆发10 天前
吴恩达《LangChain LLM 应用开发精读笔记》1-Introduction_介绍
笔记·langchain·吴恩达