VHDL output signal in hexadecimal instead of binary

Guest #5698701
Rate this post
• ▲ 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
Guest #5699564
Rate this post
• ▲ 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
Guest #5705176
Rate this post
• ▲ 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

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.