在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

中国智能体开发者社区,聚焦智能体与大模型开发,提供前沿资讯、实用工具链、开源项目及行业案例。通过技术沙龙、开发者大赛等活动,促进经验交流与协作,助力开发者快速构建创新智能应用。

更多推荐