[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
相关推荐
free-elcmacom6 小时前
FPGA学习笔记<1>FPGA的开发流程
fpga开发·硬件工程·hdl
明德扬6 小时前
AD9653单通道波形怎么看?幅度、频率与基础测量入门
学习·fpga开发·fpga
ERROR:997 小时前
GPT Images 2.5将手稿转时序图效果不佳
fpga开发
尤老师FPGA7 小时前
声学相机介绍
fpga开发
科恒盛远14 小时前
ZU902 FMC194 可编程宽带信号源实测
fpga开发·硬件工程·信号处理
大盛供应链·卢生18 小时前
哪些国产芯片可以替代进口芯片,哪些替代不了
fpga开发·容器
ALINX技术博客1 天前
跨越 1819 公里,ALINX 携 AI 异构平台、电子后视镜及 HIL 仿真方案亮相深圳国际电子展
ai·fpga开发·汽车
Enclustra_China1 天前
FMC为何成为FPGA生态的“万能扩展接口”?
fpga开发·fpga解决方案
tju新生代魔迷1 天前
Verilog HDL 学习笔记(十七)| 附录B:PLI子程序清单
fpga开发
tju新生代魔迷1 天前
Verilog HDL 学习笔记(十五)| 第15章 高级验证技术
fpga开发