Hello! My name is Tophu.
In my last article, I briefly explained how to use IP.
Since I know how to generate and use basic IP, I have less resistance to design descriptions.
I am also happy to be able to provide support for IP.
The other day, I was asked to provide support for sequencing using state machines.
I hadn't used a state machine since I learned how to write one in training, so I could only imagine how to write one.
I couldn't remember the detailed syntax, etc. "I looked back at the training materials and thought, 'I'm going to have to learn how to write a state machine.
I thought, "Let's look back at the materials from the training..."
and was looking for the materials when I was spotted by a senior.
Senior - "What are you looking for?"
Tophu - "These are the materials from the training. I forgot how to write the state machine. ......"
Senior "I know how to write it faster than looking for the material and there is an easy way to describe it."
He told me how to do it.
It is a useful feature called Design Template.
I will explain how to use it this time. It is very easy.
1. How to use Design Template
1-1. Open the Text editor and click the Insert template symbol at the top of the Editor ( Figure 1 )
Figure 1. open the text editor
1-2. A screen similar to Figure 2 will appear, so select the template you want to insert.
In this example, we will insert a state machine template.
Select Verilog → Full Designs → State Machines → 4 - State Mealy State Machine (HDL will appear in the preview screen) and click Insert.
Figure 2. Design template screen
1-3. The selected design will be inserted into the text editor (Figure 3).
Figure 3. editor screen after design insertion
All that remains is to edit the module name, signal name, etc. to match your circuit specifications and describe the state machine operation! It is very easy.
Other templates that can be inserted include hardware languages such as VHDL and System Verilog, as well as tcl commands and SDC constraint commands.
I was impressed by this convenience, and as I looked at the various items, I noticed something.
As I looked at the various items, I noticed something: each item has a User.
As the name suggests, this function allows users to create and save templates. I will explain how to use it in this article. (I thought all I had to do was select the User item and enter the code in Preview, but that was not the case...)
2. how to create a user template
2-1. First select the base template. This time, select again 4 - State Mealy State Machine, which was also selected in the previous example. ( Figure 4 )
Figure 4: Screen after selecting an arbitrary template
2-2. Edit in the Preview window and select close. In this case, we added the statement "s4 = 4 "as an example. ( Figure 5 )
Figure 5. modified template screen
2-3. After clicking Close, a message will appear asking if you want to save the template as a user template. Click Yes ( Figure 6 ).
Then enter a name for the template in the User template name field. (Figure 7)
Figure 6. save execution selection screen
Figure 7: User template name entry screen
2-4. The template will be added to the User item. ( Figure 8 )
Figure 8. added template
In addition to editing an existing template and saving it as a user template, a new template can be created by right-clicking on the User item and selecting New. (Figure 9 )
Figure 9. Creating a User Template from New
2-5. Specify the directory where the user template will be saved.
The location of the user templates can be changed by specifying the destination directory in the User templates library directory in Tools → Options → Text Editor (default is in the project directory).
User templates can also be used in another project.
In this case, the directory where the user templates are stored will be specified when the new project is created.
I had no idea such a useful feature was hidden at the top of the editor screen.
Conclusion
・Design templates can be used to reduce design man-hours.
・Templates include not only RTL descriptions, but also SDC constraint commands and Tcl commands, which are useful when you have forgotten some commands.
・You can create your own original templates and use them around.
New Engineer's Blush Blog Article List