[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-elcmacom21 分钟前
FPGA学习笔记<2>Verilog输入
fpga开发·硬件工程
学习FPGA的电气小兴兴3 小时前
基于FPGA的CORDIC向量模式实现arctan运算,Verilog HDL实现
嵌入式硬件·fpga开发·数字信号处理·verilog·fpga·cordic·arctan
FPGA小迷弟1 天前
FPGA 应用技术能力的完整闭环(1-4)
fpga开发·dsp开发·fpga·sdr·无线电
NamoAmitabha1281 天前
vivado时序报红/插入流水线寄存器/降低扇出
fpga·vivado
Eloudy1 天前
FPGA 开发与 IC 数字前端设计
fpga开发
tju新生代魔迷1 天前
Verilog HDL 学习笔记(十八)| 附录C:关键字、系统任务和编译指令
fpga开发
free-elcmacom1 天前
FPGA学习笔记<1>FPGA的开发流程
fpga开发·硬件工程·hdl
明德扬1 天前
AD9653单通道波形怎么看?幅度、频率与基础测量入门
学习·fpga开发·fpga
ERROR:991 天前
GPT Images 2.5将手稿转时序图效果不佳
fpga开发
尤老师FPGA1 天前
声学相机介绍
fpga开发