03-10-2009 03:03 PM
How do I edit the testbench vhw file. I made a waveform for test vhdl code and I want to use the vhw code to write the results into a text file. The vhw generated by xilinx declares the results.txt file but does not make use of it.
how do I change it.
Also any tutorials on writing test benches?
03-10-2009 10:56 PM
VHW files are generated as read-only. If you need to modify it, either change the permissions on the file, or perform a "Save As" in order to save the file as .vhd instead of .vhw. You'll then be able to modify the file as any other source file.
Refer to the following Xilinx Application Note for creating test benches:
Hope this helps.
03-11-2009 10:00 AM
Can I run the teshbench on modelsim?
I am testing a vhd file with a testbench thats also vhd. Will running the testbench vhd, result in simulation?
03-12-2009 12:36 PM
One more question - is there a tutorial/app note on writing the test results to files?
The vhw files from the waveform do contain results.txt declaration, but they don't contain the code to write to txt file.
03-12-2009 05:40 PM - edited 03-12-2009 05:41 PM
In VHDL, you can use the "File" type to declare input and output "file" variables, pointing to disk files. Check out the following link for a general example.
In Verilog, you can use the $fwrite system task to write out to a file. A google search on "fwrite verilog syntax" should yield you a lot of internet literature on the use of this system task.
Hope this helps.
03-12-2009 06:19 PM
I got that part. I need help formatting-
I have 3 variables - clk, din, dout
How do I write them to a file one next to other, with lables in the first line - clk din dout
I can't write more than one variable to a line variable.
This is what I have now and it writes one after the other.
write(L1, linenumber, right, 2);
WRITE(L1, clk, right, 2);
write(L2, din, right, 2);
write(L3, dout,right, 2);
03-12-2009 07:05 PM
Instead of "writeline", can you not just use "write" so you can continually append the variable values?
I haven't used write / writeline much more than just to write a variable to a text file, but it's worth a try.
03-13-2009 11:24 AM
Now I have a new problem-
When I run the testbench, the waveform and the result.txt output do not match. The result file is one clock cycle delayed.
In the waveform, dout goes high after 4 clock cycles after din. But in the results file, it goes high after 5 clock cycles.
This is a 4 bit falling edge shift register.
I am writing to the results file on falling edge of clock in a process.
The results file is like below -
Line#, CLK, din, dout
1 0 1 U
2 0 0 0
3 0 0 0
4 0 0 0
5 0 0 0
6 0 0 1
7 0 0 0