[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
相关推荐
星夜离尘563 小时前
FPGA 三点中值滤波:不补零、不丢背压样本的流式实现
fpga开发
t_niu_niu7 小时前
bilateral_filter_paper
图像处理·verilog·双边滤波器
hexiaoyan82711 小时前
互联卡设计方案:504-PCIE X16 金手指 FPGA Aurora协议互联卡
fpga开发·测试载板·互联卡·fpga aurora协议·夹板连接器·板卡互联
星夜离尘5611 小时前
FPGA 二进制数如何变成十进制显示:可背压的逐位 BCD 转换器
fpga开发
匠行科技11 小时前
基于VPX架构的4路10GSPS ADC信号采集处理板
fpga开发
FPGA小徐11 小时前
【FPGA数字信号处理】离散信源香农熵计算:原理详解 + 纯Verilog可综合实现 + 全套仿真代码
fpga
幻智星科技2 天前
蒙哥马利模乘FPGA优化实战
fpga开发·密码学
星夜离尘562 天前
FPGA 多通道 DAC 目标码影子寄存器:成组提交、同拍写入与快照边界
fpga开发
t_niu_niu2 天前
基于多帧累加平均的图像传感器暗电流抑制方法与 FPGA 实现
fpga开发·ram·fpn·固定模式噪声·image sensor
幻智星科技2 天前
FPGA纯硬件UDP桥接:微秒级响应新范式
c++·fpga开发·硬件架构