Forum Discussion
Altera_Forum
Honored Contributor
14 years agoModel sim testbench
Hello,
I have a test bench that simulate a 32bit data bus interfacing my fpga. I would like my test bench to be able to inject data to fpga from a file. so, testbench will read data from a file and transmit it to the fpga entity. my code is in vhdl. Does anybody know how to do that? thanks5 Replies
- Altera_Forum
Honored Contributor
You cannot transmit data to the FPGA from the simulator. You will need to build a link for that, like via RS232
nless you're just trying to test your design in the simulator and do file IO for simulation purposes (not on real hardware) - Altera_Forum
Honored Contributor
I am just trying to test my design in the modelsim simulator.
I have this code in my test bench, the code increment data and drive it to my design. while ( cnt_loop < 256 ) loop data_sig <= data_sig + '1' ; usb_data_out <=usb_data_out +'1'; wait for 10 ns; cnt_loop := cnt_loop + 1; Instead of increment data I would like this test bench to pull data from a file. This way I can make any kind of file. its very comfortable. Do you know how to do that? - Altera_Forum
Honored Contributor
you can use the std.textio library for file IO. it works very well with text files. There are plenty of tutorials on textio if you google it.
- Altera_Forum
Honored Contributor
- do you have an example for std.textio commands?
read,write from a file ? - where sould I place this file? - Altera_Forum
Honored Contributor