[HDLBits] Count15

Build a 4-bit binary counter that counts from 0 through 15, inclusive, with a period of 16. The reset input is synchronous, and should reset the counter to 0.

复制代码
module top_module (
    input clk,
    input reset,      // Synchronous active-high reset
    output [3:0] q);
    always@(posedge clk) begin
        if(reset)
            q<=4'b0;
        else if(q<15)
            q<=q+1;
        else
            q<=4'b0;
    end
endmodule
相关推荐
初雪白了头20 分钟前
三模冗余检测并隔离故障模块
fpga开发
ehiway21 分钟前
FPGA在光纤互感器与行波测距系统中的应用研究
fpga开发
FPGA小c鸡20 小时前
FPGA卷积层流水线加速:从入门到精通(附完整SystemVerilog实现)
fpga开发
数字芯片实验室20 小时前
仿真器出bug了?分频时钟竞争的诡异仿真现象
fpga开发·bug
从此不归路21 小时前
FPGA 结构与 CAD 设计(第4章)下
fpga开发
Terasic友晶科技21 小时前
7-DE10-Nano的HDMI方块移动案例的整体实现(含Quartus完整工程免费下载)
fpga开发·i2c·pll·de10-nano·hdmi传输·方块移动案例·quartus prime
碎碎思1 天前
使用 Arm Cortex-M1 实现低成本图像处理系统 的 FPGA 方案详解
arm开发·图像处理·人工智能·fpga开发
minglie11 天前
PetaLinux工程目录设备树文件结构与作用
fpga开发
最遥远的瞬间1 天前
二、FPGA程序固化
fpga开发
Ghost Face...1 天前
内存调试:2T/3T模式配置实战指南
fpga开发