[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
相关推荐
minglie17 小时前
iverilog 配合 Makefile 搭建 Verilog 仿真工程
fpga开发
芒果树技术7 小时前
MangoTree案例分享:基于AtomRIO FPGA平台,客户实现自适应主动减振
测试工具·fpga开发·模块测试
雨洛lhw8 小时前
按键电路设计的细节
fpga开发
minglie112 小时前
vio_uart的浏览器版上位机
fpga开发
不吃鱼的羊14 小时前
达芬奇PWM模块
单片机·嵌入式硬件·fpga开发
FPGA小迷弟15 小时前
京微齐力FPGA联合modelsim仿真操作
fpga开发·ic·verilog·fpga·仿真
浩子智控16 小时前
zynq上用verilog实现单稳态电路
fpga开发
xgbing1 天前
在ubuntu中安装modelsim
fpga开发·modelsim
碎碎思1 天前
SURF:SLAC 开源 FPGA 与 ASIC 通用 RTL 框架详解
fpga开发
FPGA小迷弟1 天前
FPGA在工业控制行业的应用,行业研究文章
fpga开发·制造·数据采集·fpga·工业控制