// This test fixture write a data stream to a file module audioout_tf(input CLK, input reset, input [15:0] data, input dataValid, output takingData); parameter FILENAME = "outfile.dat"; integer file; assign takingData = 1; initial begin file = $fopen(FILENAME); if (file == 0) begin $display("Cannot open output file"); $stop; end end always @(posedge CLK) begin if(reset) begin end else begin if(dataValid) $fdisplay(file, "%h, %h", data, data); end end endmodule