「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
相关推荐
常驻客栈几秒前
B-深入理解计算机系统第3版之第11章:网络编程
开发语言·笔记·学习笔记·常驻客栈·深入理解计算机系统
血小板要健康8 分钟前
网格 dfs 与 FloodFill:从岛屿、区域到搜索路径
笔记·算法·leetcode·深度优先
NoteDeep 深度笔记11 分钟前
Observer: 思维 ≠ 自己
笔记
米饭不加菜1 小时前
一些常用模块简介
经验分享·笔记·嵌入式硬件
aichitang20241 小时前
希尔伯特空间中的正交性
人工智能·学习·机器学习·ai·泛函分析
for_ever_love__1 小时前
python基础语法学习: 正则表达式
python·学习·正则表达式
佳児素花痴╮1 小时前
STM32U575RIT6(USART)学习
stm32·嵌入式硬件·学习
sunshine22 girl2 小时前
Angular7,9,学习笔记三 dom操作
笔记·学习·angular
春风解人意2 小时前
从零开始学习嵌入式P28----线程
c语言·学习·算法
MartinYeung53 小时前
[论文学习]MAC:多智能体宪章学习
人工智能·学习·macos