公司动态

zynq高频小数据量PS闭环 抖动时间的测量

📅 2026/8/5 1:42:22
zynq高频小数据量PS闭环 抖动时间的测量
参考zynq高频小数据量PS闭环的三个实验-第0课目的和目标zynq高频小数据量PS闭环的三个实验-第1课PL搭建zynq高频小数据量PS闭环的三个实验-第2课Vitis裸机测试zynq高频小数据量PS闭环的三个实验-第3课Linux驱动测试测量两个脉冲之间的时间差闭环控制i_pulse2产生高之后还有短暂的确定时间,忽略不计pulse_diff_measure.vmodule pulse_diff_measure ( input wire i_clk, input wire i_rst_n, input wire i_pulse1, // IRQ触发信号拉高开始测量 input wire i_pulse2, // ctrl_done,拉高结束测量 output reg o_pulse_diff ); always (posedge i_clk or negedge i_rst_n) begin if(!i_rst_n) begin o_pulse_diff 1b0; end else begin if(i_pulse2) begin o_pulse_diff 1b0; end else if(i_pulse1) begin o_pulse_diff 1b1; end end end endmoduletb.vtimescale 1ns/1ps module tb; reg i_clk; reg i_rst_n; reg i_pulse1; reg i_pulse2; wire o_pulse_diff; pulse_diff_measure u_pulse_diff_measure ( .i_clk(i_clk), .i_rst_n(i_rst_n), .i_pulse1(i_pulse1), .i_pulse2(i_pulse2), .o_pulse_diff(o_pulse_diff) ); // 100MHz always #5 i_clk ~i_clk; initial begin i_clk 0; i_rst_n 0; i_pulse1 0; i_pulse2 0; #20; i_rst_n 1; // 等几个clk repeat(5) (posedge i_clk); // pulse1 开始 (posedge i_clk); i_pulse1 1b1; (posedge i_clk); i_pulse1 1b0; // 间隔10个clk repeat(10) (posedge i_clk); // pulse2结束 (posedge i_clk); i_pulse2 1b1; (posedge i_clk); i_pulse2 1b0; #100; $stop; end endmodule测试