EmbDev.net

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


von Guest (Guest)


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.
1
file_open(vectors, "input_vectors.txt", read_mode);
2
file_open(results, "output_results.txt", write_mode);
3
4
while not endfile(vectors) loop
5
   readline(vectors, iline);
6
   read(iline, a_in);
7
   ...
8
9
   write(oline, output_data); -- it's any modification needed here 
10
end loop;
11
12
file_close(vectors);
13
file_close(results);

Many thanks

: Edited by Moderator
von Duke Scarring (Guest)


Rate this post
0 useful
not useful

von Guest (Guest)


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

von Guest (Guest)


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:

1
 Signal e_in            : std_logic;
2
       Signal a_in            : std_logic_vector(31 downto 0);
3
       Signal b_in            : std_logic_vector(3 downto 0);
4
      ...
5
      process
6
          variable s         : string(1 to 300);
7
          variable iline     : line;
8
          variable oline     : line;
9
          variable e_in      : std_logic;
10
          variable a_in      : std_logic_vector (31 downto 0);
11
          variable sapce     : character;
12
          ...
13
          file_open(vectors, "input_vectors.txt", read_mode);
14
          file_open(results, "output_results.txt", write_mode);
15
16
         while not endfile(vectors) loop
17
             readline(vectors, iline);
18
             if (s(1 to 3)= "#AE") then
19
             read(iline, space);
20
             hread(iline, a_in);  --This value to appear on the waveform
21
             read (iline, space);
22
             read (iline, e_in);  -- as well as this value
23
             read (iline, space);
24
             read (iline, b_in);  -- and this one too
25
             in_a <= a_in;
26
             in_e <= e_in;
27
             in_b <= b_in;
28
           elsif
29
              ...
30
31
             hwrite(oline, output_data);
32
             end loop;
33
34
            file_close(vectors);
35
            file_close(results);

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

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]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.