「Verilog学习笔记」时钟分频(偶数)

专栏前言

本专栏的内容主要是记录本人学习Verilog过程中的一些知识点,刷题网站用的是牛客网

复制代码
`timescale 1ns/1ns

module even_div
    (
    input     wire rst ,
    input     wire clk_in,
    output    wire clk_out2,
    output    wire clk_out4,
    output    wire clk_out8
    );
//*************code***********//

    reg out2, out4, out8 ;

    always @ (posedge clk_in or negedge rst) begin 
        if (~rst) out2 <= 'd0 ; 
        else out2 <= ~out2 ; 
    end

    always @ (posedge clk_out2 or negedge rst) begin 
        if (~rst) out4 <= 'd0 ; 
        else out4 <= ~out4 ; 
    end

    always @ (posedge clk_out4 or negedge rst) begin 
        if (~rst) out8 <= 'd0 ; 
        else out8 <= ~out8 ; 
    end

    assign clk_out2 = out2 ; 
    assign clk_out4 = out4 ; 
    assign clk_out8 = out8 ;

//*************code***********//
endmodule
相关推荐
西岸行者9 小时前
学习笔记:SKILLS 能帮助更好的vibe coding
笔记·学习
ZPC82109 小时前
docker 镜像备份
人工智能·算法·fpga开发·机器人
ZPC82109 小时前
docker 使用GUI ROS2
人工智能·算法·fpga开发·机器人
starlaky9 小时前
Django入门笔记
笔记·django
勇气要爆发9 小时前
吴恩达《LangChain LLM 应用开发精读笔记》1-Introduction_介绍
笔记·langchain·吴恩达
悠哉悠哉愿意10 小时前
【单片机学习笔记】串口、超声波、NE555的同时使用
笔记·单片机·学习
勇气要爆发10 小时前
吴恩达《LangChain LLM 应用开发精读笔记》2-Models, Prompts and Parsers 模型、提示和解析器
android·笔记·langchain
别催小唐敲代码11 小时前
嵌入式学习路线
学习
qianshanxue1112 小时前
计算机操作的一些笔记标题
笔记
土拨鼠烧电路12 小时前
笔记11:数据中台:不是数据仓库,是业务能力复用的引擎
数据仓库·笔记