FIFO 位宽转换

从8位转32位

c 复制代码
module tb_fifo(

    );

reg clk,rst;   
initial begin
    clk=0;
    forever #4.545 clk=~clk;
end
initial begin
    rst=1;
    #9.09 rst=0;
end

reg [31:0] cnts;
always @ (posedge clk or posedge rst)
begin
    if(rst)
    begin
    cnts <= 32'd0;
    end
    
    else
    begin
    cnts <= cnts + 1'b1;
    end
end

reg  [7:0] din;
reg  wr_en;

reg  rd_en;
wire [31:0] dout;

wire [12:0] rd_data_count;
wire [14:0] wr_data_count;

fifo_ICBR_8_32 FIFO (
  .rst(rst),                      // input wire rst
  .wr_clk(clk),                // input wire wr_clk
  .rd_clk(clk),                // input wire rd_clk
  .din(din),                      // input wire [7 : 0] din
  .wr_en(wr_en),                  // input wire wr_en
  .rd_en(rd_en),                  // input wire rd_en
  .dout(dout),                    // output wire [31 : 0] dout
  .full( ),                    // output wire full
  .empty( ),                  // output wire empty
  .rd_data_count(rd_data_count),  // output wire [12 : 0] rd_data_count
  .wr_data_count(wr_data_count)  // output wire [14 : 0] wr_data_count
);

always @ (posedge clk or posedge rst)
begin
    if(rst)
    begin
    din <= 8'd0;
    wr_en <= 1'b0;
    rd_en <= 1'b0;
    end
    
    else
    begin
    case(cnts)
    32'd33: begin din<=8'h11;wr_en<=1'b1; end
    32'd34: begin din<=8'h22;wr_en<=1'b1; end
    32'd35: begin din<=8'h33;wr_en<=1'b1; end
    32'd36: begin din<=8'h44;wr_en<=1'b1; end
    32'd37: begin            wr_en<=1'b0; end
    32'd60: begin rd_en<=1'b1; end
    32'd61: begin rd_en<=1'b0; end
    default:begin din<=din;wr_en<=wr_en;rd_en<=rd_en; end
    endcase
    end
end
相关推荐
s09071368 小时前
FPGA中CIC设计注意事项
算法·fpga开发·cic滤波器
Aaron15888 小时前
RFSOC+VU13P在无线信道模拟中的技术应用分析
数据结构·人工智能·算法·fpga开发·硬件架构·硬件工程·射频工程
碎碎思9 小时前
BerkeleyLab Bedrock:为 FPGA 与加速计算打造的开源基石
fpga开发·开源
zidan14129 小时前
xilinx常用文档说明
fpga开发
ShiMetaPi9 小时前
GM-3568JHF丨ARM+FPGA异构开发板系列教程:外设教程 04 WIFI
网络·arm开发·fpga开发·智能路由器·fpga
FPGA_小田老师9 小时前
FPGA基础知识(二十):Xilinx Block Memory IP核(5)--ROM 详解
fpga开发·rom·coe文件格式·导入coe·block memory
FPGA_无线通信10 小时前
压缩解压缩算法 BFP-8bit
fpga开发
红糖果仁沙琪玛11 小时前
AD7616驱动开发-FPGA
驱动开发·fpga开发
坏孩子的诺亚方舟11 小时前
FPGA系统架构设计实践13_FPGA系统功能安全
fpga开发·系统架构·功能安全概念
ALINX技术博客11 小时前
【新品解读】5G/6G 基带系统级验证,AXVU13G 如何缩短高速系统研发周期
5g·fpga开发·fpga