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

结果正确:

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

相关推荐
ReedFoley8 小时前
【笔记】动手学Ollama 第五章 Ollama 在 LangChain 中的使用 - Python 集成
笔记·langchain
Mr Sorry14 小时前
Non-stationary Diffusion For Probabilistic Time Series Forecasting论文阅读笔记
论文阅读·笔记
南猿北者15 小时前
Cmake学习笔记
笔记·学习·策略模式
码小文16 小时前
Altium Designer 22使用笔记(8)---PCB电气约束设置
笔记·嵌入式硬件·硬件工程·ad22
UserNamezhangxi18 小时前
kotlin 协程笔记
java·笔记·kotlin·协程
9527华安20 小时前
FPGA实现Aurora 64B66B图像视频点对点传输,基于GTH高速收发器,提供2套工程源码和技术支持
fpga开发·音视频·aurora·gth·高速收发器·64b66b
翻滚的小@强1 天前
数据挖掘笔记:点到线段的距离计算
人工智能·笔记·数据挖掘
会思考的猴子1 天前
UE5 PCG 笔记(二) Difference 节点
笔记·ue5
yuxb731 天前
Linux 文本处理与 Shell 编程笔记:正则表达式、sed、awk 与变量脚本
linux·笔记·正则表达式
饕餮争锋1 天前
设计模式笔记_行为型_访问者模式
笔记·设计模式·访问者模式