「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
相关推荐
UQI-LIUWJ39 分钟前
LLM 笔记:Speculative Decoding 投机采样
笔记
凤年徐3 小时前
【数据结构初阶】单链表
c语言·开发语言·数据结构·c++·经验分享·笔记·链表
阿阳微客5 小时前
Steam 搬砖项目深度拆解:从抵触到真香的转型之路
前端·笔记·学习·游戏
WarPigs6 小时前
Unity性能优化笔记
笔记·unity·游戏引擎
贝塔实验室9 小时前
FPGA 动态重构配置流程
驱动开发·fpga开发·硬件架构·硬件工程·射频工程·fpga·基带工程
px不是xp9 小时前
山东大学算法设计与分析复习笔记
笔记·算法·贪心算法·动态规划·图搜索算法
GateWorld9 小时前
《从零掌握MIPI CSI-2: 协议精解与FPGA摄像头开发实战》-- CSI-2 协议详细解析 (一)
fpga开发·mipi csi2
echo haha10 小时前
第7章 :面向对象
笔记
Chef_Chen10 小时前
从0开始学习R语言--Day18--分类变量关联性检验
学习
njsgcs10 小时前
chili3d 笔记16 emscripten配置 |用cnpm i 安装 |hello world 编译
笔记