[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. byteena[1] controls the upper byte d[15:8], while byteena[0] controls the lower byte d[7: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
相关推荐
FPGA_小田老师18 小时前
PCIe XDMA数据传输:三种工作模式详解(ARM发起 → FPGA自主)
fpga开发·pcie·xdma·c2h·fpga触发传输
宇哥啊18 小时前
UVM静态函数(Static Function)用法详解
fpga
GateWorld20 小时前
LCD显示技术完全指南:原理·制造·驱动·FPGA实现之驱动四
fpga开发·lcd显示·fpga点亮屏幕·minilvds·fpga点屏
喵喵苗20 小时前
【Vivado2024.2】纯PL端128×128 Sobel边缘检测IP封装 | 单AXI4-Stream接口设计与仿真验证
人工智能·fpga开发
szxinmai主板定制专家2 天前
基于ZYNQ MPSOC图像采集与压缩系统总体设计方案
linux·arm开发·人工智能·嵌入式硬件·fpga开发
hhb_6182 天前
VHDL设计难点与实战案例精解
fpga开发
阳排2 天前
FT2232芯片通过JTAG连接Xilinx FPGA
fpga开发
szxinmai主板定制专家2 天前
基于ZYNQ MPSOC ARM+FPGA的超高清实时图像采集与压缩系统设计
linux·运维·服务器·arm开发·人工智能·嵌入式硬件·fpga开发
GateWorld2 天前
LCD显示技术完全指南:原理·制造·驱动·FPGA实现之驱动三
fpga开发·lcd显示·fpga点亮屏幕·minilvds
FPGA的花路3 天前
基于脚本的ModelSim自动化仿真(Xilinx FPGA篇)
fpga开发·xilinx·自动化脚本·modelsim仿真