vivado仿真数据导出用于matlab处理
在tb文件中增加代码
integer save_file;
initial begin
save_file = $fopen("tx_fifo_data.txt", "w"); // Open or create a text file for writing
if (save_file == 0) begin
$display("Error: Cannot open file.");
$stop;
end
end
// Generate some test data
always @(posedge tx_clk) begin
if (tx_fifo_valid) begin // 当 fifo_out_valid 有效时记录数据
$fwrite(save_file, "Time: %0t, tx_fifo_data: %0h\n", $time, tx_fifo_data); // 以16进制输出 fifo_out
end
end
// Close the files at the end of the simulation
initial begin
#4000000 ; // Run for 4000000 time units (you can adjust this as needed)
// Close all files
$fclose(save_file);
// End the simulation
$stop;
end
文件路径:自己工程下找sim;


更多推荐



所有评论(0)