Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

storing values from vhdl wave

Status
Not open for further replies.

214

Junior Member level 2
Joined
Feb 22, 2016
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
247
my output values are displayed in vhdl wave window. I s there any possible way to store values directly from this wave window ???
 

In what sense? Modelsim will store the whole waveform file for you during a simulation run.
If you're trying to store a trace to a text file for stimulus later, you will need to do that in your VHDL code.
 
  • Like
Reactions: 214

    214

    Points: 2
    Helpful Answer Positive Rating
i need to store the values in text file. Is it not possible directly from the waveform itself ?



since all values are in sfixed format, it will be very difficult....
 

what are you trying to do? it is pretty straightoforward to store numbers in a text file as the fixed_pkg provides the to_string function for the sfixed type.
If you want to store it as a decimal number, you can easily convert it to real:


Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
library ieee;
use ieee.std_logic_1164.all;
use ieee.fixed_pkg.all;
 
entity str_test is
end entity str_test;
 
architecture test of str_test is
begin
    process
        variable a : sfixed(3 downto -4) := b"1101_1100";
    begin
        report "literal is " & to_string(a);
        report "real is " & real'image(to_real(a));
        wait;
    end process;
 
end architecture test;



Code:
# ** Note: literal is 1101.1100
#    Time: 0 ps  Iteration: 0  Instance: /str_test
# ** Note: real is -2.250000e+000
#    Time: 0 ps  Iteration: 0  Instance: /str_test
 

A simple way to dump values of specific signals in a text file is by using a list window.
 

I want to write the values(sfixed ) in text file
 

I want to write the values(sfixed ) in text file

The code in post #4 shows how to convert sfixed to string as a binary or as a real type. There are many TEXTIO tutorials on the web, and writing sfixed to a file is a simple extension on this.
 

but how it will be saved in my system.... in which format. I want the output values in text file. so that i can reconstruct it in MATLAB
 

but how it will be saved in my system.... in which format. I want the output values in text file. so that i can reconstruct it in MATLAB

using TEXTIO you store it as a text file. How you format it is up to you (by how you write your code).
 

using TEXTIO you store it as a text file. How you format it is up to you (by how you write your code).

can u please write a sample code for me.... I am really stuck with this kind of output values. thanks in advance
 

Using the code I did in #4


Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
library ieee;
use ieee.std_logic_1164.all;
use ieee.fixed_pkg.all;
 
entity str_test is
end entity str_test;
 
architecture test of str_test is
begin
    process
        file f : text open write_mode is "some_file.txt";
        variable l : line;
        variable a : sfixed(3 downto -4) := b"1101_1100";
    begin
        write(l, "literal is " & to_string(a) & lf);
        write(l, "real is " & real'image(to_real(a)) );
        writeline(f, l);
 
        wait;
    end process;
 
end architecture test;



I highly recommend YOU look up a textio tutorial - there are plenty on google.
 

What if i have more data and we have to write them in one single line(like 100 sfixed values) and after every 10 values we have to put a comma sign
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top