在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;

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐