「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
相关推荐
d111111111d26 分钟前
STM32外设基地址与寄存器偏移地址的深度解析
笔记·stm32·单片机·嵌入式硬件·学习
好奇龙猫34 分钟前
【AI学习-comfyUI学习-第十九节-comtrolnet艺术线处理器工作流-各个部分学习】
人工智能·学习
YangYang9YangYan1 小时前
2026高职会计电算化专业高价值技能证书
大数据·学习·区块链
老王熬夜敲代码1 小时前
解决IP不够用的问题
linux·网络·笔记
polarislove02141 小时前
8.1 时钟树-嵌入式铁头山羊STM32笔记
笔记·stm32·嵌入式硬件
QT 小鲜肉2 小时前
【Linux命令大全】001.文件管理之file命令(实操篇)
linux·运维·前端·网络·chrome·笔记
羽沢312 小时前
ECharts 学习
前端·学习·echarts
风行男孩2 小时前
stm32基础学习——OLED显示屏的基本使用
stm32·嵌入式硬件·学习
hetao17338373 小时前
2025-12-21~22 hetao1733837的刷题笔记
c++·笔记·算法
一声沧海笑3 小时前
【GEE学习笔记】GEE中如何上传矢量图?
笔记·学习