[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
相关推荐
Szime6 小时前
高速 ADC 国产替代选型:通信、雷达、仪器仪表项目要看哪些参数?
单片机·嵌入式硬件·fpga开发
Szime7 小时前
国产高速ADC推荐与选型观察:从进口依赖到国产替代评估,深智微科技提供项目导入支持
科技·fpga开发
森旺电子15 小时前
Vivado使用心得
fpga开发
FPGA小徐16 小时前
AI 浪潮下,FPGA 如何实现自我重塑与行业变革
人工智能·fpga开发
FPGA小徐16 小时前
[FPGA IP系列] FPGA常用存储资源大全(RAM、ROM、CAM、SRAM、DRAM、FLASH
fpga开发
Szime17 小时前
AD9218 国产替代方向:双通道 10 位 105MSPS ADC 选型支持
单片机·嵌入式硬件·fpga开发·汽车
ALINX技术博客18 小时前
ALINX VD100+Simulink 快速实现 FPGA 图像处理 Sobel 边缘检测
图像处理·人工智能·fpga开发
FPGA小徐18 小时前
FPGA开发中的常用通信协议与通信接口区别与联系
fpga开发
Szime20 小时前
深智微40Gsps高速数据采集系统进入工程化阶段
科技·单片机·嵌入式硬件·fpga开发
2601_961845422 天前
2027考研数学大纲|数一数二数三
考研·fpga开发·ar·vr·mr·oneflow