[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
相关推荐
松小白song3 小时前
FPGA开发三大铁律:位宽、逻辑与连接,为何仿真通过上板却挂?
fpga开发
FPGA小徐16 小时前
FPGA 时钟频率计算与单位换算
fpga开发
h×316 小时前
FPGA视频4分屏项目 - 系统架构详细讲解
fpga开发·音视频
秋916 小时前
硬件工程师全岗位薪资全景解析(2026版):IC设计·嵌入式·板级硬件·FPGA·晶圆制造
fpga开发·制造
博览鸿蒙16 小时前
FPGA 工程师到底有哪些方向?每个岗位都在干什么?一篇给你讲清楚
fpga开发
xiaojiaohuazi1 天前
国产安陆EG4S20 FPGA实现千兆以太网TCP/IP:AD7606C 8通道1 MSPS采集、SDRAM缓存与Python上位机
tcp/ip·缓存·fpga开发
尤老师FPGA1 天前
HDMI数据的接收发送实验(二十四)
fpga开发
MDYFPGA1 天前
明德扬 Kintex-7 FPGA核心板及多接口扩展底板介绍
fpga开发·fpga
I'm a winner1 天前
【源码】一文读懂 TDOA 无源时差定位原理
fpga开发
FPGA小迷弟1 天前
FPGA复位策略深度解析:异步复位、同步释放与设计最佳实践
fpga开发·fpga