「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
相关推荐
~樱小路~11 分钟前
网络:华为HCIA学习笔记:ICMP协议
网络·学习·华为
郭涤生43 分钟前
Chapter 7: Linking_《Computer Systems A Programmer’s Perspective》
笔记·系统架构
坊钰3 小时前
【MySQL 数据库】数据类型
java·开发语言·前端·数据库·学习·mysql·html
每次的天空4 小时前
Android学习总结之自定义View实战篇
android·学习
wusixuan1310044 小时前
图论学习笔记2
笔记·学习·图论
郭涤生4 小时前
Chapter 4: Encoding and Evolution_《Designing Data-Intensive Application》
笔记·分布式
zhuyixiangyyds4 小时前
day24学习Pandas库
笔记·学习·pandas
kfepiza5 小时前
MGR 和 GPT 笔记250406
笔记·gpt
zhangrelay5 小时前
ROS云课三分钟-差动移动机器人巡逻报告如何撰写-中等报告
学习
~卷心菜~5 小时前
【Docker基础】--查阅笔记1
笔记·docker