Forum Discussion
7 Replies
- Altera_Forum
Honored Contributor
In your testbench write your vector to a text file. use textio as usual.
first write sample to a line then to file. You can do that on every clock edge for example. in Matlab read the text file as follows: load filename.txt data = filename(:,1); %all rows of column 1 for example plot(data,'.-') - Altera_Forum
Honored Contributor
First of all, thank you so much for your reply.
I save my vector waveform file into another file type called vector table output file (*.tbl). I get the list of of input and output values of my simulation. However, the value read out does not synchronous with the clock pulse positive edge. Several data were recorded in each clock cycle. How do I do the make sure the sample only be read out for each clock pulse. for instance, I want to record the data at each 10ns interval from 1715ns to 2355ns. May I know what do you mean by the command of textio? where to apply this command? Hope to receive your reply soon. Thank you. - Altera_Forum
Honored Contributor
Most designers use testbench to read/write text files.
you can write your data at will to a file. textio is a vhdl library that allows you access fileio from within vhdl code. .tbl is a pain and I am not sure anybody uses it for any serious work. Matlab can read any text file provided it is only figures (no alphabet or hex), so remove any header text. If you are lucky, your tbl may be just be table of figures then you can read any rows or columns. If your data value is repeated because of valid or clockenable then you can select in Matlab: data = data(find(valid == 1)); or manually choose: data1 = data(1:4:end); %get first sample then discard 3 samples ... - Altera_Forum
Honored Contributor
For the testbench, Is it opened from the tcl script?
If I would like to learn more about the testbench, could you suggest some reference for me to start learning from the basics. The tbl file I obtained contain header, some symbol like >, = and alphabet x which made me difficult to extract the data via matlab. Is truly troublesome to use the tbl file for manipulating data. Thanks for your advice and I learnt something from it. - Altera_Forum
Honored Contributor
This is a simple introduction:
http://www.tkt.cs.tut.fi/kurssit/1216/k06/luennot/lecture5.pdf - Altera_Forum
Honored Contributor
I am currently using Altera Quartus II 9.1 to do my project. Does it support vhdl test bench function?
- Altera_Forum
Honored Contributor
No, use ModelSim