Monday, August 12, 2013

VHDL printing output to a File


Once a vhdl testbench is written we would like to print the input and output signals to a file for debugging.

In the below code :

> To print a string use  string'( " Din = ")  function .
> To print a bit vector use bit_vector'("10101000011") function.
> file_open(f_status, outfile, "logfile.txt", write_mode) will open a file named logfile.txt in 
   write_mode  and outfile is the  file descriptor. Different type of modes are read_mode ,write_mode 
   and append_mode.
write(buf, string'(" Din  = ")) will write the string to buffer (of type LINE).
writeline(outfile, buf) this will print buffer contents to a file (i.e., logfile.txt).

VHDL CODE :-

  

No comments:

Post a Comment