[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
相关推荐
Js_cold2 小时前
Verilog函数function
开发语言·fpga开发·verilog
Js_cold4 小时前
Verilog任务task
开发语言·fpga开发·verilog
brave and determined7 小时前
可编程逻辑器件学习(day3):FPGA设计方法、开发流程与基于FPGA的SOC设计详解
嵌入式硬件·fpga开发·soc·仿真·电路·时序·可编程逻辑器件
Lee_yayayayaya10 小时前
锁相环技术及FPGA实现
fpga开发
Js_cold15 小时前
Verilog局部参数localparam
开发语言·fpga开发·verilog
promising-w15 小时前
【FPGA】使用移位实现LED流水灯
fpga开发
爱吃汽的小橘16 小时前
ZYNQ介绍
fpga开发
ThreeYear_s1 天前
电力电子技术学习路径与FPGA/DSP技术结合方向(gemini生成)
学习·fpga开发
奋斗的牛马1 天前
FPGA—ZYNQ学习spi(六)
单片机·嵌入式硬件·学习·fpga开发·信息与通信
GateWorld1 天前
FPGA核心约束类型与语法
fpga开发