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.

创建 16 D flip-flops。有时只修改一组触发器的一部分很有用。使能字节的输入控制是否应在该周期内写入 16 个寄存器中的每个字节。byteena[1] 控制上字节 d[15:8],而 byteena[0] 控制下字节 d[7:0]。

cs 复制代码
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 <= 0;
            else if(byteena[0])     //从这里开始错误!!!
                q[7:0] <= d[7:0];  
            else if(byteena[1])
                q[15:8] <= d[15:8];  
        end
endmodule
相关推荐
南山维拉9 小时前
【AXI总线专题】AXI-FULL-Master
fpga开发·zynq·axi-full
矿渣渣11 小时前
ZYNQ处理器在发热后功耗增加的原因分析及解决方案
嵌入式硬件·fpga开发·zynq
起床学FPGA14 小时前
异步FIFO的学习
学习·fpga开发
1560820721919 小时前
锁相环HMC830的调试
fpga开发
吸纹鸽20 小时前
蓝桥杯FPGA赛道积分赛
fpga开发·蓝桥杯
&Cheems20 小时前
ZYNQ笔记(二十一): VDMA HDMI 彩条显示
笔记·嵌入式硬件·fpga开发
灵风_Brend2 天前
秋招准备——2.跨时钟相关
fpga开发
希言自然也2 天前
FPGA生成随机数的方法
fpga开发
156082072192 天前
QSFP+、QSFP28、QSFP-DD接口分别实现40G、100G、200G/400G以太网接口
fpga开发·信号处理
&Cheems2 天前
ZYNQ笔记(十九):VDMA VGA 输出分辨率可调
笔记·fpga开发