[Vivado] 用ILA采集低速信號


Low frequency debug with ILA cores and Logic Analyzer in Vivado

need a slow clock for ILA

問題

FPGA驅動AD7606進行信號采集,想用ILA看看采回來的信號是多少,奈何主時鍾是50 MHz,默認的情況下ILA會以50 MHz的采樣率去采樣並記錄。但是AD7606的采樣率只有200kHz,如果用50MHz的ILA的采樣率去查看AD7606的信號,會有大部分的采用是重復的點,因此急需讓ILA的采樣率降低到200kHz。但是ILA要求ILA的時鍾頻率是JTAG的2倍以上,這樣就意味着不能靠降低ILA輸入時鍾的方法來降低ILA的速率。

Capture control

在設置ILA ip core的時候,有一個Capture control的選擇,可以勾選,使得ILA在trigger為1的時候進行采用。這樣可以利用AD7606的數據有效信號(data valid)來實現低頻率采樣,具體操作如下。

image

首先要勾選Capture ControlAdvanced Trigger

之后需要兩個輸入,一個是32位的數據線,一個是1位的觸發線

image

手中暫時沒有AD7606,我就簡單寫了個demo,來測試效果。

點擊查看代碼
module led(
    input sys_clk_p,
    input sys_clk_n,
    input rst,
    output reg[3:0] led
    );

reg[31:0] timer_cnt;
wire sys_clk;
clk cl(sys_clk_p, sys_clk_n, sys_clk);

always@(posedge sys_clk or negedge rst)
begin
    if(rst)
    begin
        led <= 4'd0;
        timer_cnt <= 32'd0;
    end
    else if(timer_cnt >= 32'd49_999_999)
    begin
        led <= ~led;
        timer_cnt <= 32'd0;
    end
    else
    begin
        led <= led;
        timer_cnt <= timer_cnt + 32'd1;
    end
end
wire trigger;
reg [31:0] trigger_cnt;
always@(posedge sys_clk or negedge rst)begin
    if(rst) begin;
        trigger_cnt <= 32'd0;
    end 
    else if(trigger_cnt >= 32'd700) begin
        trigger_cnt <= 32'd0;
    end
    else begin
        trigger_cnt <= trigger_cnt + 32'd1;
    end
end

assign trigger = (trigger_cnt==32'd700);
ila_0 your_instance_name (
	.clk(sys_clk), // input wire clk


	.probe0(timer_cnt), // input wire [31:0]  probe0  
	.probe1(trigger) // input wire [0:0]  probe1
);

endmodule



module clk(
	input clk_p,
	input clk_n,
	wire clk
	);
begin
	IBUFGDS CLK_U(
		.I(clk_p),
		.IB(clk_n),
		.O(clk)
	);
end
endmodule

用ILA來檢測計數器的值,其中trigger每700個時鍾高電平一周期,所以用來做trigger信號。

效果

在Vivado中調用ILA,需要配置觸發模式與Capture信號

image

之后可以看到采用是隔700個時鍾采樣一次。

AD7606的實驗之后補上。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM