[HDLBits] Dff16e

Create 16 D flip-flops. It's sometimes useful to only modify parts of a group of flip-flops. The byte-enable inputs control whether each byte of the 16 registers should be written to on that cycle. byteena1 controls the upper byte d15:8, while byteena0 controls the lower byte d7:0.

resetn is a synchronous, active-low reset.

All DFFs should be triggered by the positive edge of clk.

复制代码
module top_module (
    input clk,
    input resetn,
    input [1:0] byteena,
    input [15:0] d,
    output [15:0] q
);
    always@(posedge clk) begin
        if(~resetn)
            q<=16'b0;
        else begin
            if(byteena[0])
                q[7:0]<=d[7:0];
            if(byteena[1])
                q[15:8]<=d[15:8];
        end
    end
endmodule
相关推荐
续写烂尾16 小时前
SD NAND vs SPI NAND:接口协议、坏块管理与开发成本全面对比
fpga开发
叶子野格18 小时前
《Verilog学习:数字系统设计基础》
学习·fpga开发
花 满 楼19 小时前
TPWM — PWM 测量模式(TIM PWM Measurement Mode)
单片机·嵌入式硬件·fpga开发
叶子野格19 小时前
《Verilog学习:前置知识》
学习·fpga开发
科恒盛远1 天前
RFSoC XCZU47DR 100G UDP高速数据传输的实现与调试(PCIE908 板卡技术系列三)
fpga开发
小麦嵌入式2 天前
FPGA入门(十一):受控线性序列机 UART 发送升级
stm32·单片机·嵌入式硬件·mcu·fpga开发·硬件工程
X_xcccc2 天前
2026硬核拆解:高性能异构计算板卡选型指南
fpga开发
tju新生代魔迷3 天前
Verilog HDL 学习笔记(十)| 第10章 时序和延迟
笔记·学习·fpga开发
aprilaaaaa4 天前
(TC397 学习笔记)二、ICU和TIM的时钟计算
笔记·学习·fpga开发
X_xcccc4 天前
2026高端FPGA开发平台权威评测与选型指南
fpga开发