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
相关推荐
9527华安5 小时前
FPGA实现40G网卡NIC,基于PCIE4C+40G/50G Ethernet subsystem架构,提供工程源码和技术支持
fpga开发·架构·网卡·ethernet·nic·40g·pcie4c
search77 小时前
写Verilog 的环境:逻辑综合、逻辑仿真
fpga开发
search713 小时前
Verilog 语法介绍 1-1结构
fpga开发
小眼睛FPGA18 小时前
【RK3568+PG2L50H开发板实验例程】Linux部分/FPGA dma_memcpy_demo 读写案例
linux·运维·科技·ai·fpga开发·gpu算力
幸运学者18 小时前
xilinx axi datamover IP使用demo
fpga开发
搬砖的小码农_Sky19 小时前
XILINX Zynq-7000系列FPGA的架构
fpga开发·架构
热爱学习地派大星1 天前
FPGA矩阵算法实现
fpga开发
热爱学习地派大星1 天前
Xilinx FPGA功耗评估
fpga开发·verilog·vivado·fpga功耗·xpe
搬砖的小码农_Sky1 天前
XILINX Ultrascale+ Kintex系列FPGA的架构
fpga开发·架构
XvnNing1 天前
【Verilog硬件语言学习笔记4】FPGA串口通信
笔记·学习·fpga开发