Basic Tutorial

This tutorial provides a step by step walk-through of the e Language development environment.

Switch to the DVT Perspective

The DVT Perspective provides a workbench layout with many useful views and shortcuts at hand for developing e code, for example the type browser, extensions browser etc.

From menu Window ‣ Open Perspective ‣ Other… choose DVT

../../_images/dvt-open-perspective.png

You can customize and save a perspective. In order to further speed-up the development, at any time you can switch between various perspectives with different tool (views) layouts. For example you can use one perspective for writing e code (the editor will take most of the real estate) and another perspective for code navigation (type browser will be a significant component).

The default DVT perspective looks like this:

../../_images/dvt-default-perspective.png

Open a Project

A project corresponds to a specific directory on the disk. The project is presented in the Navigator View - a file browser component that helps you browse the project directory contents.

Create a New Project

Invoke the New Project Wizard: Choose menu File ‣ New ‣ DVT Project.

../../_images/new-project-wizard.png
  1. Specify the Project Directory It can be a directory that already contains sources or a new directory that will be created.

  2. Specify the Project Name By default, the project’s name is the last segment of the project’s directory path (e.g. /tmp/path1/path2/p_name > p_name). You can change this name by selecting Custom.

    Note

    If Project Directory points to an existing project, you cannot change its name.

  3. Open a Predefined Project You may open one of the predefined projects that DVT ships with and continue to explore the DVT features. For more details see Predefined Projects.

  4. Specify the Project Nature. If the project does not exist or it does not contain any nature, you must select at least one nature. This way DVT will compile the respective sources.

Configure the Build

As soon as you create a project, you’ll be notified there is nothing to build.

../../_images/no-default-build.png

To configure the build follow the link in the build notification dialog or open the .dvt/default.build file.

In order to provide advanced functionality (like hyperlinks, autocomplete, design and class hierarchy, error signaling, etc.) DVT analyzes the source code files in your project. This analysis process is called build.

By default, DVT doesn’t build anything. In order to build, DVT uses the arguments that you specify in one of the <name>.build files located in the .dvt folder of your project.

The default build configuration is .dvt/default.build. Here you list compilation directives in a similar way you would pass arguments to any simulator.

Build the Project

Once you specified the files you want to compile, the specman path to be used and so on, you should rebuild the project. In general, every time you change the .build configuration, you should rebuild.

In order to rebuild you click the Rebuild button rebuild-icon.

While editing source files, a project is incrementally compiled as soon as you save, unless the menu option Project ‣ Build Automatically is un-checked.

The building progress is reported in the Progress View. Depending on your configuration, you may also see detailed information in the Console View.

../../_images/edt-get_started-buid-progress.png

Inspect the Compilation Errors

Syntax errors are detected as you type.

../../_images/edt-get_started-type_err-err.png

They are indicated in the vertical bars of the editor (left - for the visible code, right - for the full file). If you keep the mouse over the marker on the left you’ll see more details about the error.

../../_images/edt-get_started-type_err-label.png

Same tooltip will appear if you keep the mouse over the marker on the editor right bar. You can also click on the marker to jump to the error.

../../_images/edt-get_started-type_err-marker.png

If a project contains errors, for example syntax errors, it will be indicated using decorators:

../../_images/edt-get_started-browse_err-navigator.png

You can use the Problems View to inspect the errors. You can show the Problems View from menu Window ‣ Show View ‣ Other… ‣ General ‣ Problems. Double clicking on some error will jump to the source location.

../../_images/edt-get_started-browse_err-fullscreen.png

See Comments in Tooltips

When you position the mouse over a type, method, field etc., a tooltip will pop-up showing information on corresponding declaration.

Some examples are presented below. In a similar way you’ll see information on fields, events, variables etc., predefined or not.

Type Info

../../_images/edt-get_started-tooltips-typeinfo.png

Method Info

../../_images/edt-get_started-tooltips-methodinfo.png

The information presented in the tooltip is created using the comment on top of the declaration.

For example, given the following declaration of an event:

../../_images/edt-get_started-tooltips-event_decl.png

the corresponding tooltip will look like this:

../../_images/edt-get_started-tooltips-event_tooltip.png

For predefined entities, the tooltip presents the description from the e language reference manual.

../../_images/edt-get_started-tooltips-predefined.png

Quickly Open a Type (Struct, Unit)

You can quickly open a specific type definition, just press Ctrl+Shift+T.

The Quick Types View will pop-up and you can enter any regular expression to locate a type. Select and press Enter or Click to jump to its definition.

../../_images/edt_quick_types_view.png

Quickly Open a File

You can quickly open a file imported via the top files. Just press Ctrl+I.

The Quick Compile Order View will pop-up and you can enter any regular expression to locate a file. Select and press Enter or Click to open the file.

../../_images/edt_quick_compile_order_view.png

You can also see the compile order of the files in your project in the Compile Order View. Open the view from menu Window ‣ Show View ‣ Other… ‣ DVT ‣ Compile Order.

../../_images/edt_compile_order_view.png

Quickly Move Inside the Editor

Press Ctrl+O to open the Quick Outline for an overview of your file. You can enter any regular expression to locate an entity to jump in the current file.

../../_images/edt-reference-views-quick_outline_view.png

You can also see the outline in the Outline View. Open the view from menu Window ‣ Show View ‣ Other… ‣ General ‣ Outline.

../../_images/edt-reference-views-outline_view.png

Browse Through All the Available Types (Structs, Units, Enumerations)

You can explore all the types (enums, structs, units) defined or extended in your project using the Types View.

Go to menu Window ‣ Show View ‣ Other… ‣ DVT ‣ Types to open the Types View.

../../_images/edt_types_view.png

Browse the AOP Extensions

You can view all the extensions (layers) of a specific type, method, event etc. Position the cursor on the relevant name and press Shift+F3 or right click and chose Show ‣ Layers from the menu.

The Layers View will present information about all the extensions including:

  • extension kind (when subtype, is first or is also etc.)

  • source location (file, line)

  • documentation (extracted from the comment lines above the layer definition)

../../_images/edt-layers-view.png

You can also quickly jump to a specific extension. Press Ctrl+Shift+O with the cursor positioned on the name.

../../_images/edt_quick_layers_view.png

Inspect the Struct Hierarchy and Struct Members

Position the cursor on the relevant name and press F4 or right click and chose Show ‣ Hierarchy from the menu.

The Type Hierarchy View will present information about a struct including:

  • parents

  • children

  • members

../../_images/edt_type_hierarchy_view.png

You can also quickly jump to a specific parent or child. Press Ctrl+T with the cursor positioned on the name.

../../_images/edt_quick_type_hierarchy_view.png

Inspect the Verification Hierarchy

Position the cursor on a unit name and press Shift+F6 or right click and chose Show ‣ Verification Hierarchy from the menu.

The Verification Hierarchy View opens with the chosen unit set as the top of the hierarchy.

../../_images/e-verification-hierarchy-presentation.png

Search for Entities

You can search for a specific type, method etc. in the current project or whole workspace. Press Ctrl+H to pop-up the search dialog.

../../_images/edt-get_started-search-window.png

The results are presented in the Search View.

../../_images/edt-get_started-search-view.png

Use Content Assist (Autocomplete)

Content assist (autocomplete) can be triggered explicitly if you press Ctrl+Space in any code context.

Some of the contexts when content assist is triggered automatically as you type are:

  • when you type a dot (.) for accessing a struct member (field, method etc) as in bfm.do_write()

../../_images/edt_concepts_autocomplete_1.png
  • when you type a colon (:) in a field declaration as in smp : signal map

../../_images/edt_concepts_autocomplete_3.png
  • when you type a compare (==) in an expression as in if (mode ==…)

../../_images/edt_concepts_autocomplete_2.png

Proposals are presented in a list for you to choose from. Moving through proposals you can quickly see the related documentation.

Press Enter or Click to select a proposal or Esc to cancel the assist.

Use Code Templates

When you trigger autocomplete using Ctrl+Space, template suggestions may appear in the proposal list.

../../_images/global-code-templates-e-proposal.png

To define templates go to the DVT ‣ Code Templates preference page (via menu Window ‣ Preferences) and select e Language from Select Nature.

../../_images/global-code-templates-pref-page.png

Click the New button to define a new template. The template name is important for proposal filtering based on already typed text.

../../_images/code-templates-edit-template.png

Track Tasks using TODO Markers

If you place TODO markers in your code they are recognized and presented in the Tasks View. This is a mean to insert reminders, preserve, track and share them with your team.

You can use TODO markers inside comments. FIXME (high priority), TODO and XXX (low priority) are recognized.

Go to menu Window ‣ Show View ‣ Other… ‣ General ‣ Tasks to open the Tasks View.

Double click on a task to jump to the marker definition.

../../_images/edt-reminders-CodeTasksView.png

Format the Source Code

You can format the selected code or the whole current file, if no selection, from the right click menu Source ‣ Format Source.

Quickly See the Current Scope in the Status Bar

The scope (method or struct) at the cursor is always presented in the status bar.

../../_images/edt-get_started-scope.png

Current Scope in Status Bar

Locate the Matching Bracket

Position the cursor after the bracket and press Ctrl+Shift+P to jump to the pair bracket.

Double click after the bracket to highlight the code section up/down to the matching bracket.

../../_images/edt-get_started-brackets-selection.png

Fold Code Regions in Order to Improve Readability

Use the Expand All expand-icon button or the Collapse All collapse-icon button from the toolbar or from right click menu Source ‣ Folding to unfold/fold the current file.

../../_images/edt-get_started-brackets-expand.png

Load in Specman

Quick Launch

Right click on a file in Navigator (usually top or test) and from menu Run As choose Load in Specman.

../../_images/edt-concepts-run_configurations-load_in_Specman.png

Explore Output

The invocation output is dumped to the Console View.

Click on hyperlinks in the Console View to jump directly to the to source location.

../../_images/edt-console-hyperlinks.png