[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
相关推荐
ALINX技术博客9 小时前
【期刊共读】如何应对 FPGA 短缺常态?
嵌入式硬件·fpga开发·fpga
1560820721911 小时前
短波接收机灵敏度测试
fpga开发
Riwuarua1 天前
从近似0基础开始FPGA开发 -- part.6 逻辑设计与状态机
fpga开发
LCG元1 天前
【实战】Vivado FPGA 从零实现 UART 串口收发:波特率生成、状态机设计与仿真调试
fpga开发
郭郭的柳柳在学FPGA1 天前
紫光DDR3工程仿真遇到的坑
fpga开发
国科安芯1 天前
ASC8T245S:把 8 位并行总线稳稳“跨过“电压域的双电源收发器
网络·分布式·单片机·嵌入式硬件·fpga开发·架构
HUSTCH20211 天前
DW IP详解
fpga开发
明德扬1 天前
Xilinx下载文件里的BIT、BIN、MCS有什么区别?先分清JTAG配置和Flash启动
fpga开发·fpga
IT信息时代1 天前
FPGA技术未来竞争发展出路
fpga开发
昆山森启智能科技有限公司1 天前
FPGA控制器
fpga开发