I want to write a binary file (meaning that it needs to be opened in a hex editor). I want to write one byte at a time in SystemVerilog. I currently am only able to write 32-bits (4 bytes) at a time. This does not work for me. Here's the code I'm working with:
task t_Write_File(input string i_File_Name);
int n_File_ID;
n_File_ID = $fopen(i_File_Name, "wb");
for (int i=0; i<n_Active_Rows; i++)
begin
for (int j=0; j<n_Active_Cols; j++)
begin
$fwrite(n_File_ID, "%u", r_Frame[i][j]);
end
end
$fclose(n_File_ID);
endtask : t_Write_File
The problem here is that r_Frame is bytes, so it pads the heck out of the data (out to 32-bits). I do not want padding.