[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
相关推荐
叶子野格2 小时前
《FPGA基本知识累积:看开发指南要懂的术语》
学习·fpga开发
泛联新安3 小时前
VHawk-CDC:FPGA跨时钟域检查怎么选?
fpga·亚稳态·fpga验证
傻童:CPU4 小时前
vivado中ILA出现no connect
fpga开发
松小白song16 小时前
【硬核排错实录】FPGA DDS 波形卡死:寄存器有值但正弦 / 三角 / 自定义波形完全不输出(双通道失效终极解决)
fpga开发
星夜离尘5618 小时前
UART偶发乱码:波特率分频误差之外,还要算采样漂移
fpga开发·uart
hexiaoyan8271 天前
271-基于JFM7VX690T36 的四路40Gbps的PCIeX8 全国产化卡
fpga开发·软件无线电处理平台·硬件加速器·jfm7vx690t36·全国产化卡·7vx690t36
Terasic友晶科技2 天前
答疑解惑|Agilex 5如何指定Boot Core及设定Core的运行频率?
fpga开发·hps·terasic·cortex-a55·cortex-a76·boot core
辰丁电子2 天前
allegro入门教程-菜单栏Route
fpga开发·pcb工艺·pcb·layout·allegro软件
星夜离尘562 天前
流水线 valid 对齐自检:输入气泡和中途复位怎么测
fpga·systemverilog·流水线·vivado·testbench
吉他英雄一里2 天前
FPGA工具篇--ILA
fpga开发