integer file; initial begin // 파일 열기 (쓰기 모드) file = $fopen("output.txt", "w"); if (!file) $display("Error: Cannot open file."); end always @(M_AXIS_TVALID or M_AXIS_TDATA) begin if (M_AXIS_TVALID) begin // 파일에 데이터 쓰기 $fwrite(file, "%x\n",M_AXIS_TDATA); end end