autocomplete

Record Autocomplete

Dealing with records can be cumbersome – if you don't have the right tools. We have re-introduced record-autocomplete, a feature that was originally available in Sigasi HDT 1.0. But since we now have type-time compilation, record autocomplete becomes even more powerful. This feature will be available in the Sigasi 2.1 release, at the end of October 2011.

Context sensitive templates

Because your code gets analyzed as you type, Sigasi knows the region of code that you are editing. The content assist feature (a.k.a. autocomplete) is fully aware of the context and tries to offer you only the relevant templates.

Templates are sensitive to the context of your code. If you type component inside a declarative region, Sigasi offers a component declaration template, based on your existing entities. If you type the same word, component in the body of an architecture, Sigasi offers a component instantiation.

Likewise, if in the architecture body can expand to an if-generate statement, which is a concurrent statement. In a process, this will expand to an if-then statement, which is a sequential statement.

Using Custom Templates in Sigasi HDT

In a previous blog post Using Autocomplete Templates in Sigasi HDT, I introduced Autocomplete Templates in Sigasi HDT and demonstrated how to use the pre-defined templates. In this post I'll explain how to customize these templates and how to create your own. Chances are high that the pre-defined templates slightly differ from your preferred style or that you have your own standard pieces of code that you use on a regular basis.

Edit existing templates

To demonstrate the power of custom templates I will tailor the "process"-template of the example in my previous post to my preferred style. In this elaborated "process" example, I demonstrated how to replace "rst" by "reset" and "clk" by "clock" in the template editing session. If all reset signals in my design are called "reset" instead of "rst" (and "clock" instead of "clk"), it would be better to modify the template, so that the names are correct by default.

The first step is to open the Templates Preference page: Window > Preferences > VHDL > Templates and select the "process" template.

Click Edit... and you will see the template's code.

The syntax is really simple. The template contains text and variables. The text is inserted as is when the template is expanded. Variables, enclosed in curly braces ${ }, become fields that can still be modified by the user once the template is expanded. The name of the variable will be used as the default value.

In this example we want to replace the default of "rst" with "reset" and "clk" with "clock". You can simply achieve this by changing the variable names in the template. Notice that you have to replace all occurrences, otherwise HDT will regard them as different variables.

Press OK (twice) to confirm the changes.

If you now autocomplete the "process" template, you will see that the default names for the clock and reset signals have changed.

Feel free to experiment with more customizations to the templates like adding default comments or changing white space and indentation.

Create new templates

Creating new templates is the evident next step. In the Templates Preference Page (Window > Preferences > VHDL > Templates), simply press New....

First you have to specify a Name for your new template. Choose it carefully because this name will be what you have to start typing when you want to expand the template.

The Description is what you will see next to the template name if there are multiple possible templates that can be expanded.

Next you can insert the actual template. Note that apart from user-defined variables (like ${name}, ${clk} and ${rst} in the above example), you can also use pre-defined template variables. Pre-defined template variables are variables that are filled in by HDT itself when the template is expanded. Examples are ${user} and ${date}. If I would autocomplete a template that contains the ${user} variable it would become "heeckhau" in the expanded template. Note that you can use Ctrl+Space to auto-complete these pre-defined variables when you are editing the template.

Useful examples of custom templates are file headers, default library and use clauses, (others=>'0'), ...

Conclusion

Custom templates can really help you improve you coding speed by assisting you in typing faster, especially for verbose VHDL constructs. Templates are really flexible and can be customized to really suit your needs.

If you create new templates that you think might be useful for other VHDL designers; feel free to share them on our forum or in the comments. I am also very curious to hear which templates you think are still missing as defaults in Sigasi HDT.

Why can't VHDL designers live without block selection mode?

One of the most frequently asked questions we get is :"Does Sigasi HDT support block selection (a.k.a. column selection) mode?".
In this blog post I question the need for this feature since there is a more powerful alternative in most use cases.