[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
相关推荐
upper20201 天前
从零开始动手做Verilog实验--04--11阶FIR滤波器
fpga开发
nuoxin1141 天前
SSD201-富利威
arm开发·驱动开发·fpga开发·ffmpeg·射频工程
哄娃睡觉1 天前
FPGA、ARM、MCU、DSP的区别
fpga开发
不会武功的火柴2 天前
ModelSim入门实战(三): 批处理一键仿真与波形调试
嵌入式硬件·fpga·仿真·modelsim·ic验证·rtl
nature_forest2 天前
vivado2018.2固化程序方法之.bin文件固化法
windows·fpga开发
m0_46644103詹湛2 天前
FPGA时序优化与高速接口实战手册
笔记·学习·fpga开发·硬件架构·verilog
upper20202 天前
从零开始做Verilog实验--01--4位计数器
fpga开发
upper20202 天前
从零开始动手做Verilog实验--02--模为60的BCD加法器
fpga开发
nbwenren2 天前
基于AD9250数据接收的FPGA纯Verilog实现JESD204B协议及三套工程源码支持
fpga开发
upper20202 天前
从零开始动手做Verilog实验--03--自动售卖机
fpga开发