How to Use DVT AI Assistant Snippets in VS Code

Overview

Snippets are DVT-specific constructs that dynamically expand within prompts, enabling reuse and leveraging compilation data. This video demonstrates examples of built-in Snippets and guides you on creating custom ones.

Details

DVT IDE AI Assistant enables seamless interaction with Large Language Models. Snippets are DVT-specific prompt constructs that expand to different pieces of text depending on their purpose, allowing you to quickly and conveniently provide additional prompt context.

The AI Assistant provides a library of predefined prompt snippets. Simply insert @ in the chat prompt to see the list of available snippets. Some of them make use of the information collected by DVT during compilation while others are just reusable instructions you can use in your requests. Keep typing to filter the list, select the one you wish to insert, and press enter. You can easily inspect the expansion of a snippet by clicking the Preview Message button.

Prompt Examples Using Snippets

You can easily generate constraints for a UVM Sequence Item by using the @outline of snippet which will expand to a structured overview of the item class.

The AI Assistant can also help develop source code that should be consistent with other sections of the project. For instance, consider this empty uart_tx_driver. Its contents can be generated by leveraging existing UVM drivers within your project.
DVT Incremental Compilation will assist in identifying and resolving potential errors in the LLM`s response.

LLMs are usually good at understanding and replicating patterns. Take this task call for example. You can easily generate continuations of it using the @replicate selected pattern snippet.

Custom Snippets

Alongside predefined snippets, you can create custom ones to be reused and shared across the team. A reusable snippet can be something as simple as an introductory phrase. The easiest way to create a custom snippet is by saving a chat request using the Save Message as Snippet button.

More advanced snippets can also be developed. Take this @create vif custom snippet for example. It instructs the LLM to generate a virtual interface for a given module, instantiate the interface and connect it to the DUT module, and set its reference in the uvm_config_db. Once the LLM's response is complete, you can easily place each block of code into its corresponding section of the project.