# VHDL Entity

A VHDL entity is a component that can be described using VHDL. It comes with an editor which can be used to edit the entity and to validate it, providing you have Questa Advanced Simulator installed on your system.

## Creating a VHDL entity

To create a new VHDL entity, simply open the HDL IP library in the explorer panel and click on the VHDL Entity component. If the library is not available, you will need to load it: go to the Project menu, Load Library then Build-in Library and select HDL IP from the menu.

## Editing a VHDL entity

A new VHDL entity comes with a default template which contains two inputs and two outputs. The entity can be edited by clicking on the content attribute, as shown below.

The integrated HDL editor can then be used to modify the entity using VHDL directly. You can also import the content of a VHDL file by clicking the Import... button, or export your own code by clicking the Export... button.

As you edit your component, the Validate Content button will light up. It can be used to check if your code is valid, as long as you have Questa Advanced Simulator installed and configured (see Configuring Questa Advanced Simulator for more information). If it is the case, clicking the Validate button will compile the VHDL code, check for errors and display a window with more information if any is found. If your code is valid, the button will simply be deactivated until you make further modifications.

Note: If you don't have Questa Advanced Simulator, or if it is disabled, Logisim will nonetheless make a few checks, mostly on the ports description.

When you are done editing your entity, you can click the Close Window button. The code will be validated by Questa Advanced Simulator if it is installed and enabled, and Logisim will automatically regenerate your entity's symbol, adding, removing or updating any port you might have added, removed or changed in your code. If an error occurs during the validation process, a window containing more information will be displayed, and you will be given three choices:

1. Close anyway and discard all modifications. This is achieved by clicking Yes. Please note any changes done to your entity will be permanently lost.
2. Go back to the editor and correct the error(s). This is achieved by clicking No.
3. Create a backup of your VHDL code and close the editor. This is achieved by clicking the Create backup button, and then by selecting a folder and a name for your backup file.

## Using a VHDL entity

A VHDL entity is used like any other component. The only notable difference is how the entities are handled in the simulation. Please see VHDL simulator for a detailed explanation.

Next: Configuring Questa Advanced Simulator.