filmov
tv
How to create your first VHDL program: Hello World!
Показать описание
In this video you will learn how to print text in VHDL. Creating a "Hello World" program is the most common way to start learning a new programming language.
Blog post for this video:
VHDL is a hardware description language, used for designing digital logic for FPGAs and ASICs. While this is true, VHDL is also just another programming language. A parallel programming language, or a concurrent programming language if you like.
When developing VHDL, you will most of the time be running your code in a VHDL simulator. And it is certainly possible to print text from VHDL inside of the simulator!
The bare minimum of a VHDL file includes an empty "entity" declaration. The entity of a VHDL file defines the inputs to and outputs from the module. While the entity is mandatory, it can also be empty. That's why we declare an empty entity in this video.
The "architecture" part of the VHDL file is where most of the code is written.
Inside of the architecture we can declare "processes". A process is a collection of code which is executed sequentially. VHDL is a parallel programming language, remember? But inside of each process, the code is executed line by line.
In this video we declared a single process.
Within our process we first typed in a line of code saying: 'report "Hello World!";'. This is one of the ways to output text in VHDL. This caused the text "Hello World!" to be printed to the console window in the ModelSim simulator.
Finally, after the Hello World line, we had to add a single line containing the text: "wait;". The reason for this is that it is a requirement in VHDL that every process contains some sort of Wait-statement. The single "wait;" caused the program to wait forever at this line.
When we run code in a VHDL simulator, like ModelSim, code runs in simulation-time. Real-time doesn't matter, because it's a simulation. All statements except for Wait-statements consume zero simulation time.
If we had not included any Wait-statements in our process, the program would loop indefinitely from start to end of our process. But the simulation time would always be zero, because Report-statements consume zero simulation time. The simulator would never be able to figure out what happens after the first initial timestep, and that wouldn't work. In fact, ModelSim would complain with the compilation error: "Process contains no WAIT statement".
Blog post for this video:
VHDL is a hardware description language, used for designing digital logic for FPGAs and ASICs. While this is true, VHDL is also just another programming language. A parallel programming language, or a concurrent programming language if you like.
When developing VHDL, you will most of the time be running your code in a VHDL simulator. And it is certainly possible to print text from VHDL inside of the simulator!
The bare minimum of a VHDL file includes an empty "entity" declaration. The entity of a VHDL file defines the inputs to and outputs from the module. While the entity is mandatory, it can also be empty. That's why we declare an empty entity in this video.
The "architecture" part of the VHDL file is where most of the code is written.
Inside of the architecture we can declare "processes". A process is a collection of code which is executed sequentially. VHDL is a parallel programming language, remember? But inside of each process, the code is executed line by line.
In this video we declared a single process.
Within our process we first typed in a line of code saying: 'report "Hello World!";'. This is one of the ways to output text in VHDL. This caused the text "Hello World!" to be printed to the console window in the ModelSim simulator.
Finally, after the Hello World line, we had to add a single line containing the text: "wait;". The reason for this is that it is a requirement in VHDL that every process contains some sort of Wait-statement. The single "wait;" caused the program to wait forever at this line.
When we run code in a VHDL simulator, like ModelSim, code runs in simulation-time. Real-time doesn't matter, because it's a simulation. All statements except for Wait-statements consume zero simulation time.
If we had not included any Wait-statements in our process, the program would loop indefinitely from start to end of our process. But the simulation time would always be zero, because Report-statements consume zero simulation time. The simulator would never be able to figure out what happens after the first initial timestep, and that wouldn't work. In fact, ModelSim would complain with the compilation error: "Process contains no WAIT statement".
Комментарии