Hi, I am now currently working with a CPU. Now I want to write the RAM's MEM into a .txt file.
reg [31:0] mem [ 0 : (32'h0000_5000 / 4)-1 ] // To .txt integer test_file; initial begin test_file = $fopen("result_file.txt","w"); end //the MEM part always @ (posedge wb_clk_i) begin if (ram_we) begin mem[adr] <= wr_data; $fwrite(test_file,"%b\n",mem); // I have only added this part end end
I have tried to change it to %p. But it print out somethings like dec number. I prefer the test_file.txt will got all the binary number from MEM.
Could anyone seen the problem?
Thanks for the help