[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
相关推荐
FPGA-ADDA8 小时前
第一篇:软件无线电(SDR)概念与架构演进
fpga开发·信号处理·软件无线电·rfsoc·47dr
FPGA-ADDA15 小时前
第二篇:RFSoC芯片架构详解——处理系统(PS)与可编程逻辑(PL)
嵌入式硬件·fpga开发·信号处理·fpga·47dr
fei_sun16 小时前
同步FIFO
fpga开发
水云桐程序员20 小时前
电子自动化技术(EDA技术)FPGA概述
运维·fpga开发·自动化
lf28248143120 小时前
05 AD9361 LVDS数字接口简介
fpga开发
Flamingˢ21 小时前
ZYNQ+OV5640+VDMA+HDMI视频链路搭建实录:从摄像头采集到实时显示
arm开发·嵌入式硬件·fpga开发·vim·音视频
Flamingˢ1 天前
基于 FPGA 的帧间差分运动检测
人工智能·目标跟踪·fpga开发
fei_sun1 天前
时序逻辑电路设计基础
fpga开发
知识充实人生2 天前
FPGA设计杂谈之十一:时序报告中时钟的上升沿与下降沿详解
fpga开发·时序分析·rise·fall·negedge·posedge
FPGA小迷弟3 天前
FPGA工程师面试题汇总(二十五)
网络协议·tcp/ip·fpga开发·verilog·fpga