[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
相关推荐
zlinear数据采集卡14 分钟前
从0到1硬核拆解:工业级数据采集卡的隔离设计与Modbus通信实战
arm开发·单片机·嵌入式硬件·fpga开发·开源
FakeOccupational6 小时前
fpga系列 HDL:Microchip FPGA开发软件 Libero Soc FPGA 在线逻辑分析
fpga开发
FPGA技术联盟13 小时前
如何在跨时钟域分析中处理好复位信号?
fpga开发
国科安芯13 小时前
基于ASM1042S2S的箭载通信网络抗辐射加固方案研究
服务器·网络·嵌入式硬件·fpga开发·架构·信号处理
YYRAN_ZZU1 天前
Lattice 自定义IP业务逻辑核
嵌入式硬件·fpga开发
FPGA小徐2 天前
FPGA FIFO一篇完整解释
fpga开发
I'm a winner2 天前
【IP核】 Xilinx FPGA LVDS 高速接口,含验证工程与板级测试用例
tcp/ip·fpga开发·测试用例
I'm a winner2 天前
基于Xilinx FPGA的LVDS高速串行通信系统 - 完整源码解决方案(一)(文末附源码)
fpga开发
国科安芯2 天前
航天器多路并联大功率电源系统设计与ASP4644均流特性分析
单片机·嵌入式硬件·fpga开发·安全性测试
techdashen3 天前
从网络栈继续往下:micro:bit、2.4GHz、调制方式,以及一个不太靠谱但很有趣的想法
网络·fpga开发