Работа с файлами
module file_tb;
integer fd, idx;
string str;
initial begin
fd = $fopen ("filename.ext", "w");
for (int i = 0; i < 5; i++)
$fdisplay (fd, "Iteration = %0d", i);
$fclose(fd);
fd = $fopen ("filename.ext", "r");
$display("fd = %0d", fd);
while ($fscanf (fd, "%s = %d", str, idx) == 2) begin
$display("Line: %s = %0d", str, idx);
end
$fclose(fd);
end
endmoduleLast updated