OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 4142|回复: 3

[XILINX] 怎么将自己采集到的数据通过axis stream data fifo和axis dma传到ps端呢

[复制链接]

7

主题

20

帖子

0

精华

初级会员

Rank: 2

积分
65
金钱
65
注册时间
2018-11-23
在线时间
17 小时
发表于 2022-1-5 17:51:24 | 显示全部楼层 |阅读模式
10金钱
我用zynq7020采集2个ad7606模块的数据,在pl通过仿真看2个ad7606是可以采集到数据,现在要发送到ps端通过以太网发出去我现在有2个问题
1   我定义output        reg        [255:0]        m_axis_tdata, 这样会导致引脚不够,但是这个我又不是真正的需要引脚引出去,只是想接到axis stream data fifo的数据端口
     如果我不定义在参数列表中,但是我又确实想output输出,我该怎么办?
     我看黑金的资料
     在参数列表中定义为output                m_axis_tdata,
     然后在参数列表下面定义reg        [255:0]        m_axis_tdata,这样对不对呀
2   怎么将自己的数据通过dma发出去(或者自己的数据怎么和axis stream data fifo的数据端口关联上),网上这方面的资料太少了


3   
我整体的思路是2个ad7606采集到数据然后写入到axis stream data fifo中
我整体的框架(block design)如附件图

我整体的代码如下:
module ad7606_double(
    input               sys_clk,
    input               sys_rst_n,

    //=================dev_a====================//
    input   [15:0]      ad_a_data,
    input               ad_a_busy,
    input               ad_a_first_data,        //要等到这个信号才能读取数据

    output  reg         ad_a_cs_n,
    output  reg         ad_a_rd_n,
    output  reg         ad_a_rst,
    output  reg         ad_a_convstab,

    //=================dev_b====================//
    input   [15:0]      ad_b_data,
    input               ad_b_busy,
    input               ad_b_first_data,        //要等到这个信号才能读取数据

    output  reg         ad_b_cs_n,
    output  reg         ad_b_rd_n,
    output  reg         ad_b_rst,
    output  reg         ad_b_convstab,


    // Axi4-stream bus interface
    //这种情况下,ad7606为fifo的主设备,fifo为ad7606的从设备
        input                        s_axis_tready,            //表示从设备准备好
        output        reg                m_axis_tvalid,            //表示主设备可以发数据给从设备
        //output        reg        [255:0]        m_axis_tdata,             //这个数据是发给fifo的
        output             m_axis_tdata,             //这个数据是发给fifo的
        (* X_INTERFACE_INFO = "xilinx.com:signal:clock:1.0 clk_out CLK" *)
        output                       clk_out,                     //这个时钟是给axis data fifo的s_axis_clk?
        output                       rst_out
    );
       
        reg        [255:0]        m_axis_tdata;
       
        ...
       
        中间省略就是采集程序
        然后想在这里条用fifo模块,给他写数据
        然后在这里例化axis_data_fifo_0模块,就是图片的axis_data_fifo_0
       
        //===========================================================================这个是给fifo写数据
        always @(posedge sys_clk or negedge sys_rst_n) begin
           if(!sys_rst_n)  begin
                rst_cnt <= 16'b0;
                ad_a_rst  <= 1'b0;
                ad_b_rst  <= 1'b0;
           end
           else if((ad_a_data_valid_to_pc==1)&&(ad_b_data_valid_to_pc==1)) begin                    //如果数据可以了         
                m_axis_tvalid    <= 1'b1;   //先告诉从设备(FIFO),主机可以发数据了
               
                if(s_axis_tready==1) begin //先判断从设备即fifo是否准备好
                   m_axis_tdata    <= {ad_a_ch1,ad_a_ch2,ad_a_ch3,ad_a_ch4,ad_a_ch5,ad_a_ch6,ad_a_ch7,ad_a_ch8,ad_b_ch1,ad_b_ch2,ad_b_ch3,ad_b_ch4,ad_b_ch5,ad_b_ch6,ad_b_ch7,ad_b_ch8};
                end
                else begin
                        //是不是这里需要拉低2个模块,不让采了了?
                       
                        m_axis_tdata  <= 256'b0;
                end
           end
           else                                                
                m_axis_tdata  <= 256'b0;
                m_axis_tvalid    <= 1'b0;
        end

        //------------<例化被测试模块>----------------------------------------       
axis_data_fifo_0 axis_data_fifo_0_inst (
//系统端口
        .s_axis_aresetn                (rst_out                ),                  // input wire s_axis_aresetn
        .s_axis_aclk                (clk_out                ),              // input wire s_axis_aclk
//写FIFO端口         
        .s_axis_tvalid                (m_axis_tvalid                ),                   
        .s_axis_tready                (s_axis_tready                ),                    // output wire s_axis_tready
        .s_axis_tdata                (m_axis_tdata                )                     // input wire [7 : 0] s_axis_tdata
/*        .s_axis_tlast                (s_axis_tlast                ),                     // input wire s_axis_tlast
        .axis_wr_data_count        (axis_wr_data_count        ),                          // output wire [31 : 0] axis_wr_data_count
        .almost_empty                (almost_empty                ),              // output wire almost_empty
*/
//读FIFO端口  
/*        .m_axis_tvalid                (m_axis_tvalid                ),                    // output wire m_axis_tvalid
        .m_axis_tready                (m_axis_tready                ),                    // input wire m_axis_tready
        .m_axis_tdata                (m_axis_tdata                ),                    // output wire [7 : 0] m_axis_tdata
        .m_axis_tlast                (m_axis_tlast                ),                    // output wire m_axis_tlast
        .axis_rd_data_count        (axis_rd_data_count        ),                          // output wire [31 : 0] axis_rd_data_count
        .almost_full                (almost_full                )               // output wire almost_full
*/
);

endmodule



然后提示我找不到axis_data_fifo_0 这个模块

4    还是将自己的代码封装成一个ip核,然后在block design中添加封装的核?
     如果是这样的话,我该把自己的ip封装成axis stream master还是slave型的呢,或者说我的block design图中的axis_data_fifo_0的S_AXIS_0是主还是从呢

2.PNG
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

7

主题

20

帖子

0

精华

初级会员

Rank: 2

积分
65
金钱
65
注册时间
2018-11-23
在线时间
17 小时
 楼主| 发表于 2022-1-5 17:59:51 | 显示全部楼层
这个是工程

zynq_ad7606_pro_back - 副本.zip

17.41 MB, 下载次数: 38

回复

使用道具 举报

3

主题

1979

帖子

0

精华

资深版主

Rank: 8Rank: 8

积分
5520
金钱
5520
注册时间
2018-10-21
在线时间
1561 小时
发表于 2022-1-6 09:05:15 | 显示全部楼层
应该是要自定义一个带AXI4-Stream的IP核,这个IP核的一端和AD数据对接,一端和AXI4-Sream Data Fifo对接
回复

使用道具 举报

7

主题

20

帖子

0

精华

初级会员

Rank: 2

积分
65
金钱
65
注册时间
2018-11-23
在线时间
17 小时
 楼主| 发表于 2022-1-6 09:35:06 | 显示全部楼层
QinQZ 发表于 2022-1-6 09:05
应该是要自定义一个带AXI4-Stream的IP核,这个IP核的一端和AD数据对接,一端和AXI4-Sream Data Fifo对接

嗯嗯,谢谢,我正在弄
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2024-10-3 22:20

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表