EmbDev.net

Forum: FPGA, VHDL & Verilog VHDL output signal in hexadecimal instead of binary


Author: Guest (Guest)
Posted on:

Rate this post
0 useful
not useful
Hello.

I am trying to simulate a vhdl Code using a text files. the Output 
Signal is correct except that it's in binary. I would like to know what 
command line I can add to have it in hexadecimal. My Code look like 
this.
file_open(vectors, "input_vectors.txt", read_mode);
file_open(results, "output_results.txt", write_mode);

while not endfile(vectors) loop
   readline(vectors, iline);
   read(iline, a_in);
   ...

   write(oline, output_data); -- it's any modification needed here 
end loop;

file_close(vectors);
file_close(results);

Many thanks

: Edited by Moderator
Author: Duke Scarring (Guest)
Posted on:

Rate this post
0 useful
not useful

Author: Guest (Guest)
Posted on:

Rate this post
0 useful
not useful
Hello.

@moderator thanks for the edit.

Thanks a lot for the link Duke. I have tried one of the example and it 
work. I just have to Change the "write" line to

 hwrite (oline, output_data);

Once again thanks for the help

Author: Guest (Guest)
Posted on:

Rate this post
0 useful
not useful
Hallo again.

I don't know if I should start a new tread or continue here. I am facing 
another Problem. I would like the values I am reading from the input 
text file to appear on the waveform window of the Simulation Software 
(Active-HDL). These Signals only appear as Zero (0) in the waveform. My 
Code look like:

 Signal e_in            : std_logic;
       Signal a_in            : std_logic_vector(31 downto 0);
       Signal b_in            : std_logic_vector(3 downto 0);
      ...
      process
          variable s         : string(1 to 300);
          variable iline     : line;
          variable oline     : line;
          variable e_in      : std_logic;
          variable a_in      : std_logic_vector (31 downto 0);
          variable sapce     : character;
          ...
          file_open(vectors, "input_vectors.txt", read_mode);
          file_open(results, "output_results.txt", write_mode);

         while not endfile(vectors) loop
             readline(vectors, iline);
             if (s(1 to 3)= "#AE") then
             read(iline, space);
             hread(iline, a_in);  --This value to appear on the waveform
             read (iline, space);
             read (iline, e_in);  -- as well as this value
             read (iline, space);
             read (iline, b_in);  -- and this one too
             in_a <= a_in;
             in_e <= e_in;
             in_b <= b_in;
           elsif
              ...

             hwrite(oline, output_data);
             end loop;

            file_close(vectors);
            file_close(results); 

the Content of my Input file
#AE 0000001A 1 0010 
      #CDE 00FC0011 0001 00000274
      ...
      

Many thanks

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig