[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. byteena[1] controls the upper byte d[15:8], while byteena[0] controls the lower byte d[7: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
相关推荐
嵌入式-老费4 小时前
产品开发实践(常见的软硬结合方式)
fpga开发
FakeOccupational13 小时前
【电路笔记 通信】AXI4-Lite协议 FPGA实现 & Valid-Ready Handshake 握手协议
笔记·fpga开发
I'm a winner14 小时前
FPGA+护理:跨学科发展的探索(五)
fpga开发
Turing_kun1 天前
基于FPGA的实时图像处理系统(1)——SDRAM回环测试
fpga开发
I'm a winner2 天前
新手入门Makefile:FPGA项目实战教程(二)
笔记·fpga开发
我爱C编程2 天前
基于FPGA的8PSK+卷积编码Viterbi译码通信系统,包含帧同步,信道,误码统计,可设置SNR
fpga开发·通信·8psk·帧同步·snr·卷积编码·维特比译码
I'm a winner3 天前
新手入门 Makefile:FPGA 项目实战教程(三)
fpga开发
范纹杉想快点毕业3 天前
嵌入式 C 语言编程规范个人学习笔记,参考华为《C 语言编程规范》
linux·服务器·数据库·笔记·单片机·嵌入式硬件·fpga开发
lazyduck3 天前
从半年到一年的 bug 往事:TCP modbus的卡死与补救
fpga开发·modbus
范纹杉想快点毕业3 天前
《嵌入式 C 语言编码规范与工程实践个人笔记》参考华为C语言规范标准
服务器·c语言·stm32·单片机·华为·fpga开发·51单片机