How do I write to file? Testbench basics for beginners in Verilog!

preview_player
Показать описание
Hi, I'm Stacey, and in this video I talk about writing a testbench in verilog!

Subreddit:
Google form to give me your feedback:

Ending music: Faith by David van Niekerk

0:00 Intro
0:26 Why we need a testbench
1:35 Clock Generation
1:51 Delays in simulation
3:00 Initial vs Always block
3:14 Reset Generation
3:58 Tripod Malfunction
4:15 Writing to file Module Start
5:24 Opening File
5:52 Casting data to Floating Point
6:43 Minor Fixed Point Detour
7:29 Writing to File
7:52 Summary
8:04 I have a subreddit!
8:33 Outro

Рекомендации по теме
Комментарии
Автор

Hi All! I'll be doing a file-reading video - that's going to be its own thing. It'll be part of the DSP example series that's coming up.

FPGAsforBeginners
Автор

Hi Stacey,
Thanks for showing how to dump data to a file in a testbench 👍
Can you also show how to inject stimulus to the DUT by reading through a file?
Thanks

varunsharma
Автор

Amazingly helpful channel, keep going !

mateuszlesko
Автор

Hi Stacey
Do you run your test bench in Vivado or something else?

cccmmm
Автор

Hi Stacy! what a bunch of nice videos you have here for us noobs!. I've just discovered your channel, but will watch them all.

You showed here opening a file, but what about interaction? I'm using icarus verilog on linux (and windows) as I'd like to get some simple mcu from opencores or the internet that I could write an assembler and disassembler for (and test it until it works). What workflow would you suggest to be able send binary to the simulator and to get back data from it? Also, can you tell me about which standard to stick to? I've been using 1995 up to now, but I find it lacking enums and such. Thanks!.

stupid-handle
Автор

Does forcing clocks and inputs in the behavioral simulation of vivado works the same as writing a testbench and the running the simulation?

enriqeat
Автор

Hi Stacey. Can you do a video tutorial on writing testbench for xadc IP?

psp_online
Автор

EDIT: THANKS A LOT. :)

Also, do I need to create a text file separately first or is that going to be created during the simulation?
EDIT: Also, where are you supposed to call the write_to_file module? Inside the test bench? Or inside our top module?
EDIT: One more question, If we are supposed to create a text file ourselves? Where do we put the file? A vivado project has multiple folders.
EDIT: I figured out everything.
EDIT: One last question: How to run the simulation for a specified duration of time?

deathmaster
Автор

Was wondering whether something like this has happened to you.
I encountered an issue trying to read a .txt file from a test bench in vivado simulation. There was a file descriptor error, which was only solved by giving the absolute path of the file. What would be the way around this? Thanks

tomo