int rd;
int file = $fopen(path,"wb"); // open in binary mode
if (!file) begin
$error("File could not be open: ", path);
return;
end
$fwrite(file, "%u", 32'h4D424D42);
$fclose(file);
// read back binary data from file
file = $fopen (path,"rb"); // open in binary mode
if (!file) begin
$error("File could not be open: ", path);
return;
end
$fscanf(file,"%u",rd);
$fclose(file);
$display("%h",rd);
systemverilog读写二进制文件
最新推荐文章于 2024-07-06 15:48:27 发布