The code editor
The window has a code editor for VHDL, in tabs beside the waves. It colors VHDL with the simulator's own lexer, shows the analyzer's errors and warnings as you type, and has the editing tools you expect: several cursors, block editing, split view, find and replace, find in files, folding and a minimap. Every place a message points to (in the terminal, the Problems tab, the insight panels, the Project tab) opens here.
Opening, saving and closing files
- File → Open file in editor… (
Ctrl+E) opens a file in a tab of its own. The dialog offers VHDL files (.vhd,.vhdl,.vht,.vho), and project files and scripts (.f,.pro,.tcl,.do). The first file opens beside the waves; later ones open beside the file you are editing. A file already open comes to the front. - A click on a source location opens the file at that place: a line in the Terminal, a problem in Problems, a match in Search, a source link in an insight panel, a file in the Project tab (double-click).
- A dot after a tab's name means the file has changes not yet saved. Hover over the tab to see the file's path.
- Save file (
Ctrl+S, while the editor has the keyboard) saves it. Save all files (Ctrl+Shift+S) saves every file with changes. Close file (Ctrl+W, or the tab's ×) closes it. - Closing a file with changes asks whether to Save, Don't save or Cancel. Quitting with changes asks whether to Save all and quit, Quit without saving or Cancel.
When another program changes a file that is open, the editor reads it again if you have no changes in it; your cursor stays on its line. If you do have changes, it asks whether to Reload the file (Undo brings your text back) or Keep mine.
The files open, with their cursors and panes, the text size, the minimap and the find options are kept between sessions; with a project open, its files are kept with the project (Each user's state).
The sources of the built-in libraries, opened from a message such as ieee/numeric_std-body.vhdl:120, open read-only; the tab says (built in, read-only) when you hover over it.
What you see
- Highlighting. VHDL files are colored by the simulator's own lexer: reserved words, comments (also
/* */blocks), strings, character and bit string literals, numbers, attribute names after a tick, and PSL's reserved words and operators, in the colors of the theme. Other files show as plain text. - The gutter shows line numbers, a dot on lines with a diagnostic, and arrows to fold regions. Click line numbers to select lines.
- The line of the cursor is highlighted, and so is the bracket matching the one at the cursor.
- The status line under the text shows the cursor's line and column (
Ln 12, Col 8), the number of cursors or of characters selected (or a block's size), the counts of errors and warnings, and, on the right, the file's indentation, encoding, line ends and kind (VHDL or Text), with Read-only for a built-in source.
Encodings and line ends. A file is read as UTF-8 (with or without a byte order mark), or as ISO 8859-1 if it is not valid UTF-8, and saved as it was read. Line ends stay as the file had them, LF or CRLF; a file with both is saved with the kind of its first line.
Indentation. The editor works out a file's indentation from its text: tabs, if more lines start with a tab than with spaces, else the most common step between lines. A file that does not tell gets two spaces. Tabs show four columns wide.
Editing
| Keys | What they do |
|---|---|
Enter |
A new line, indented as the line before; one level more after a line that opens a block (is, begin, then, else, loop, generate, record, (, when ... =>) |
Tab / Shift+Tab |
Indent or outdent the selected lines; Tab without a selection indents to the next stop |
Ctrl+/ |
Comment out the selected lines with --, or take the -- away if every line has one |
Ctrl+D |
Select the word at the cursor; press again to add the next place with the same text as another cursor |
Alt+click |
Add a cursor |
Alt+drag |
Select a block of text in columns (Block editing) |
Alt+Shift+↑ ↓ ← → |
Make a block from the cursor (or the selection), or grow it by a line or a column |
Escape |
Back to one cursor (also out of a block); close the find bar |
Ctrl+Z / Ctrl+Y (or Ctrl+Shift+Z) |
Undo / redo; typing and deleting in a row undo together |
Ctrl+X / Ctrl+C / Ctrl+V |
Cut, copy and paste; without a selection, the whole line (pasted above the cursor's line) |
Ctrl+A |
Select all |
Ctrl+G |
Go to a line: 120, or 120:8 for line and column |
Home, End, Ctrl+← / →, Ctrl+Home / End, Page Up / Down |
Move (with Shift: select). Home goes to the first character that is not a space, then to the start of the line |
Ctrl+Backspace / Ctrl+Delete |
Delete the word before or after the cursor |
Ctrl+↑ / ↓ |
Scroll a line without moving the cursor |
| Double click / triple click | Select a word / a line |
Ctrl+wheel |
Larger or smaller text |
A right-click in the text offers Cut, Copy, Paste, Select all, Toggle comment, Split right and Split down.
Several cursors
Alt+click adds a cursor; Ctrl+D adds the next place with the same text as the selection. With several cursors, typing, deleting, Enter, Tab and pasting act at every cursor; pasting as many lines as there are cursors puts one line at each. Escape goes back to one cursor.
Block editing
Hold Alt and drag the mouse to select a rectangle of text, a block: the same columns on every line, from where you pressed to where you let go (Alt and a click without dragging still adds a cursor). From the keyboard, Alt+Shift and the arrow keys make a block from the cursor, or from the selection, and grow it a line or a character at a time. The block shows as a rectangle with a selection and a cursor on each line, and the status line gives its size: Block: 6 lines × 12 columns. Columns are counted as shown, a tab reaching the next tab stop.
- Typing replaces the block's text on every line and goes on in the same column. A line that ends before the block's left edge has its cursor at its end; when you type, it is first filled with spaces up to the block's edge, so that what you type lines up with the other lines.
- Delete and Backspace delete the block, or the character beside the cursor on each line. They never join lines, and leave lines that end before the block alone.
- Tab indents the block's text one level on each line; Shift+Tab takes up to one level back.
- Copy and cut take the block's lines, one per line. Pasting as many lines as the block has puts one on each line; other text is pasted on every line.
Enter, a click, an arrow key withoutAlt+Shift, or Undo end the block and leave its cursors as several cursors;Escapeends it with one cursor.
Block editing is the quick way to line up port maps, add a prefix to a column of signal names, or fill in a column of constants.
Split view
View → Split the editor right (Ctrl+Shift+I) or Split the editor down (Ctrl+Shift+D), or Split right / Split down in the text's right-click menu, opens the file again in a pane beside (or below) the one you are in.
- Each pane has its own cursors, selection, scroll position and find bar, and they all edit the same text: what you type in one shows in the other at once, Undo takes back the last change whichever pane made it, and saving in either saves the file. Folding is shared.
- To see two files side by side, split, then open the other file (
Ctrl+E, or from the Problems or Search tab): a file opens in the pane you were editing in. You can also drag a tab beside another. - View → Close the editor pane (
Ctrl+Shift+W) closes the pane you are in; its files go to another pane (or beside the waves), and a file open there too just loses its second view. Closing a pane's tab (×,Ctrl+W) closes only that view while the file is open in another pane, without asking. - A place in a file (in Problems, Search or the Terminal) opens in the pane you were editing if it shows that file, else in the pane where you last edited it.
The panes are kept with the layout between sessions, and with a project's layout.
Find and replace
Ctrl+F opens the find bar over the text, with the selected text as what to find; typing finds the first match after the cursor.
EnterorF3goes to the next match,Shift+EnterorShift+F3to the previous one, round the end of the file. The bar shows which match of how many is selected:3 of 12.- The buttons beside the field match case (Aa) and whole words only. Without Aa, letters match regardless of case, as VHDL's own names do (ASCII letters only).
Ctrl+Hopens the bar with a second field for the replacement: Replace (orEnterin that field) replaces the selected match and goes to the next; Replace all replaces every match, as one step to undo.Escapecloses the bar.
Find in files
Edit → Find in files (Ctrl+Shift+F) opens the Search tab beside the terminal. Type what to find and press Enter (or Search). Choose where to look:
- Files of the run: the files of the current run: the sources of the open project, the files of a file list, or the VHDL file run;
- Folder of the file: the folder of the file being edited, and the folders under it: VHDL files, file lists and scripts (
.f,.pro,.tcl,.do).
Match case and Match whole word work as in the find bar. The matches are listed by file, with their line numbers; click one to open the file there. Files open in the editor are searched as you have edited them. A search stops at the first 20,000 matches, and says so.
Folding
The arrow beside a line number folds the region that starts there: a design unit, a process, a subprogram's body, a block, a generate, an if, case or loop up to its end, a record or protected type, or a run of comment lines. A folded region shows … after its first line. Edit → Fold all and Unfold all fold or open every region. A cursor moved into a folded region, by Go to line or by finding, opens it.
Minimap
The right edge of the editor shows the whole file scaled down, with the part on screen marked; click or drag in it to scroll there. View → Show or hide the minimap turns it off or on.
Diagnostics
VHDL files are analyzed by the same analyzer the simulator uses, with the same messages: when they are opened and saved, and a moment after you stop typing (the text as it is, without saving it).
- Errors and warnings are underlined with a wavy line, marked in the gutter and beside the scroll bar, and counted in the status line.
- Hover over one to read the message, with its help and its LRM section.
- View → Show problems (
Ctrl+Shift+M) opens the Problems tab: the problems of every VHDL file open in the editor, by file, with their line and column. Click one to go there.
A file is analyzed as the current run analyzes it (the open project, else the last simulation run), so that names declared in other files are known and the messages are those the run gives:
- A file of the run is analyzed after the run's files before it, into its own library, as its own VHDL version. For a project, that is the version of the file, of its library or of the project, with the project's compatibility mode, PSL comments, conditional analysis identifiers and rule levels. For a file list or a VHDL file, it is the VHDL version and compatibility mode chosen in the Run dialog.
- A file that is not among the run's files is analyzed after all of them, into
work. - With no run, a file is analyzed on its own, into
work, as VHDL-2008.
When the run changes, or its project or file list is saved, the open files are analyzed again.