[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
相关推荐
如夏倾城16 小时前
FPGA 与可信固件:既是“守护者”,也是“被保护对象”
运维·fpga开发·硬件架构·fpga·可信计算技术·安全架构·信任链
好家伙VCC17 小时前
JFMSP45T900 核心板硬件架构拆解
fpga开发
FPGA小迷弟2 天前
PID 算法全解:从历史渊源到 FPGA 硬件实现
算法·fpga开发·硬件架构·fpga·sm4
SYHC_CSDN2 天前
HDLCross:穿透 IP 核的 HDL 跨时钟域分析平台,补齐 CDC 验证短板
网络协议·tcp/ip·fpga开发
Answer1st2 天前
【FPGA学习】VSCode 写 Verilog 操作指南(XII)
vscode·学习·fpga开发
s09071363 天前
FPGA 按键消抖为什么会误触发?用连续三次采样验证计数清零和临界拍
fpga开发·verilog·vivado·按键消抖·时钟使能
青山_FPGA3 天前
通过FPGA如何控制232芯片引脚和485芯片引脚?
fpga开发
Terasic友晶科技3 天前
【教程】掰开揉碎讲FIFO(七)——异步FIFO的Verilog设计(含仿真)
fpga开发·异步fifo·verilog设计·异步fifo仿真·空满判断
repokey-Yao3 天前
AD9361 改采样率后怎么快速恢复LVDS接口对齐?
人工智能·fpga开发·ad9361
星夜离尘563 天前
FPGA 双槽弹性缓冲:切断 ready 组合路径,为什么满槽恢复时输入要等一拍?
fpga开发