Command-line parameters:
You can use an existent HDL-FSM-Editor project file as command line parameter.
- Parameter "-no_version_check":
- HDL-FSM-Editor will not access the internet to check for a newer version.
- Parameter "-no_message":
- HDL-FSM-Editor will not print a message at start.
- Parameter "-generate_hdl":
- HDL-FSM-Editor will generate HDL for the given file and exit (batch-mode).
Control-Tab:
Here you define several items which control the generation of the HDL-design, which are:
- Module name:
- Will be used inside the generated HDL and for the filenames of the generated files.
- Language:
- Here you can select between VHDL, Verilog, System-Verilog.
- Path for generated HDL:
- In this folder you will find the generated HDL-files.
- Number of files:
- This is only relevant for VHDL design, where entity and architecture can be stored in different files.
- Name of asynchronous reset input port:
- The signal name specified here will be used as asynchronous reset signal name.
- Name of clock input port:
- The signal name specified here will be used as clock signal name.
- Compile command:
- Here you specify a system command which runs your HDL-compiler/simulator on the generated HDL-code.
- Edit command:
- Here you specify a system command which runs your favoured editor (by Ctrl+e) when editing any text box.
For example:
Windows: notepad++.exe -nosession -multiInst
Linux : gvim -f
- Working directory:
- When the compile commands run they create some files. These files are stored in the working directory.
Interface-Tab:
Here you define the interface of your FSM, this means all inputs, outputs, parameters, libraries.
- When you have selected VHDL:
- There is a dedicated text entry field for package-, generic- and port-declarations.
- When you have selected Verilog:
- There is a dedicated text entry field for parameter- and port-declarations.
- When you have selected System-Verilog:
- There is a dedicated text entry field for parameter- and port-declarations.
Internals-Tab:
Here you define the internally used signals of your design.
- When you have selected VHDL:
- There is a text entry field for package-, architecture- (like “type”, “signal”),
clocked process variable-, combinatorial process variable- declarations.
- When you have selected Verilog:
- There is a text entry field for internal declarations,
clocked process local variable-, combinatorial process local variable- declarations.
- When you have selected System-Verilog:
- There is a text entry field for internal declarations,
clocked process local variable-, combinatorial process local variable- declarations.
Diagram-Tab:
Here you draw the graphical representation of your FSM.
The following graphical elements are available:
- State:
- You define a state by clicking the “new State” button and placing the state into the diagram.
You can edit the state name by double clicking it, “Return” ends editing, “Escape” aborts editing.
- State-Action:
- Once you have defined a state you can add a state-action for this state by clicking the right mouse button on the state.
Then you get a state-action block where you can define actions which will be executed in a combinatorial way, when the FSM is in that state.
- Transition:
- Once you have defined two states you can setup a transition between them by first
clicking the “new Transition” button and
then clicking the start state of the transition and
then clicking at the end state of the transition.
If the FSM is in the start state of the transition, at the next positive clock edge
the FSM will jump into the end state of the transition,
if you do not define any condition for the transition.
When you have implemented several transitions which leave all the same start state, then you must define the transition priority order:
By editing the numbers provided in the transition (double-click), you define the priorities (“Return” ends editing, “Escape” aborts editing).
Priority 1 is the highest priority.
- Condition/Action:
- Once you have defined a transition you can setup a condition and/or an action for that transition by clicking the right mouse button on the transition.
When you have defined a condition, the transition will only fire, if the condition is fulfilled.
If you have defined an action, this action will be executed in a clocked way, when the transition fires.
- Connector:
- You can add a connector by clicking the “new Connector” button and placing it into the diagram.
A connector is used to combine different transitions at their way from start state to end state.
So conditions and actions along each possible path from a start state are executed at a single clock edge.
- Reset Entry:
- You can add exactly 1 reset entry to the diagram by clicking “Reset Entry” and placing it into the diagram.
By connecting the reset entry element with a transition to a state, you define what happens when the reset input signal gets active.
Which polarity of the reset input signal is the active polarity, is defined by the condition of this transition.
In the action block of the transition you define which signals of the design are asynchronously reset to which value.
- Default State Actions:
- As state actions are combinatorial actions (without any storing flipflops),
for each state all combinatorial state action signals must be assigned a value.
This is sometime annoying and can be avoided, by inserting a default state action.
There you define a default value for each state action signal and then you only
need to define a state action,
when a state action signal shall not have its default value.
- Global Actions Clocked:
- Often some clocked logic is needed, which does not depend on the active state of the FSM.
For example, if you assign a default value to a signal in the global action clocked block,
which is executed “before” the state machine, then you must specify in the transition actions
only assignments to the signal, when the signal shall not have the default value.
If you put an action into the global action block, which is executed “after” the state machine,
you can for example “override” the signal changes which are provided by the FSM.
- Global Actions Combinatorial:
- Often some combinatorial logic is needed, which does not depend on the active state of the FSM.
This logic must be put it into this action block.
Hint: As the code of this block is not a part of the FSM, you can enter any legal HDL code.
The following editing actions are available:
- Using the right mouse button you can define a rectangle which defines the visible area in your editor window.
- Using “view area” you can define a rectangle which defines the visible area in your editor window.
- Using “view all” shows the complete diagram in your editor window.
- Using “+” or “-“ zooms in or out. Zooming center is the middle of your editor window.
- Using mouse wheel up or down you can scroll.
- Using “Ctrl” plus mouse wheel (up or down) zooms in or out.
- Using "Ctrl" plus holding the left mouse button, allows moving the visible area.
- Using "Ctrl+e" in a text box loads the text into your editor. After exiting your text editor the edited text is copied into the text box.
- “Undo” and “Redo” buttons are available. You can also use the shortcuts “Ctrl+z” and “Ctrl+Z”.
- A "File" menu for reading and writing files is available (shortcuts are implemented).
- A "HDL" menu for generating HDL and executing the compile-command is available (shortcuts are implemented).
Generated HDL-Tab:
Here the generated HDL files are displayed for reading.
Each generation replaces the old code with the new code.
Compile Messages Tab:
The STDOUT and STDERR messages of your compile command appear in this tab.
The tab is only cleared at a new start of HDL-FSM-Editor, or when you switch to a new design (using “open” or “new”).
Here you can find links to several designs which I have created (only 1 design is ready at the moment).
All designs are created by HDL-SCHEM-Editor and HDL-FSM-Editor and all designs are based at VHDL.
Therefore you will find by the link all the needed source-files for both tools and also the generated VHDL-files.
The Cordic module "rotate":
- The module "rotation" can rotate vectors by a given angle (Cordic rotation mode) or to the x-axis (Cordic vectoring mode).
- The module "rotation" can be configured by generics which define the number of bits of all the operands and which define the latency of the module (in clock cycles).
- The module "rotation" can be used to calculate the sine or cosine of an angle.
- The module "rotation" can be used to convert cartesian coordinates into polar coordinates and vice versa.
The multiplication module "multiply":
- The module "multiply" multiplies signed numbers.
- The module "multiply" can be configured by generics which define the number of bits of all the operands and which define the latency of the module (in clock cycles).
- The module "multiply" has an architecture "struct" which implements the classic written multiplication algorithm.
- The module "multiply" has an architecture "fpga" which uses the VHDL multiplication operator.
The Karatsuba multiplication module "multiply_karatsuba":
- The module "multiply_karatsuba" multiplies signed numbers.
- The module "multiply_karatsuba" can be configured by generics which define the number of bits of all the operands.
- The module "multiply_karatsuba" has an architecture "struct" which implements the Karatsuba multiplication algorithm.
- The module "multiply_karatsuba" has an architecture "mul_operator" which uses the VHDL multiplication operator.
License:
HDL-FSM-Editor
Copyright (c) 2023 Matthias Schweikart
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Files:
Python3 source code (Number of downloads =
230 ).
Start the tool by "python3 hdl_fsm_editor.py" or
create an executable with "pyinstaller --onefile hdl_fsm_editor.py":
Executable for Windows 11 (Number of downloads =
270 ):
Executable for Linux (compiled with Linux-Mint) (Number of downloads =
182 ):
Small example project:
Change log:
Version 1.0 (25.09.2022):
Version 1.1 (29.09.2022):
- Verilog is now supported.
- VHDL or Verilog code using upper case characters is now handled correctly.
- When deleting windows from the state diagram, it is now easier to hit the target.
- HDL-Generation: 1 file mode now works.
Version 1.2 (04.10.2022):
- SystemVerilog is now supported.
- Keyword highlighting is supported.
- Verilog: Asynchronous reset is now correct implemented.
Version 1.3 (10.10.2022):
- Bug at highlighting was fixed.
- Find-Button was added.
- When editing text boxes an external editor can be started by Control-e.
- Improvements for moving items in the diagram tab were added.
Version 1.4 (25.10.2022):
- Several small bugs were fixed.
- Static code analysis was added: Not read signals appear in "orange", not written signals appear in "red".
Version 1.5 (08.11.2022):
- A change of the path for the generated HDL is now handled as a design change.
- A bug at moving transitions was fixed.
- The print functionality was removed, as each action window is always printed as a black box.
Version 1.6 (09.12.2022):
- Fixed a bug which showed, when a VHDL port name contains the string "out".
- For text fields now no default font is used anymore (keywords and non-keywords now always use the same font).
Version 1.7 (21.12.2022):
- Fixed: main_window.py from version 1.6 had a doubled "," in line 266 instead of a single one.
Version 1.8 (07.01.2023):
- In Verilog-mode now the temporay file (which is created when ctrl+e is used in a textbox) has the extension ".v" instead of ".vhd".
- The time stamp format used in generated HDL and in the "Compile Messages" tab is now better readable.
Version 1.9 (09.01.2023):
- The error message, which occurs when the reset condition is missing, now gives the user a hint, where the reset condition must be specified.
Version 2.0 (04.05.2023):
- Now the JSON format is used when a design is saved to a file. The file menu has a new entry for reading the old format of Version 1.
- "view area" can now be also done by the right mouse button.
- When a new design is opened by open-file dialog, the old design is not not removed, when the user aborts the opening.
- When selecting the path for the generated HDL, an abort does not remove the old path entry anymore.
- Now also in any Interface/Internals text field Control-o opens a file-dialog, instead of inserting a new line.
- Fixed loading a design by a command line with "hdl_fsm_editor design-file.hfe". This did not work since version 1.4.
- Deleting empty condition&action- and state-action- windows now works.
- After inserting Default-State-Actions, Global-Actions and Global Actions-Combinatorial the escape key must not be pressed anymore.
Version 2.1 (12.05.2023):
- A Verilog wire declaration added in "Internal Declarations" will not cause an (unimportant) Error message anymore.
Version 3.0 (30.05.2023):
- A new algorithm for transforming the transition conditions and actions into HDL is now implemented. The old algorithm caused problems when connectors were used excessively.
- HDL-FSM-Editor now gives a hint, when a newer version is available.
Version 3.1 (19.06.2023):
- In HDL all actions of a transition from a start state to a target state were implemented in the last condition branch of the transition. Now actions which may not have to be executed in this last branch are "moved up" in the branch hierarchy, which leads to shorter and better readable code.
Version 3.2 (20.06.2023):
- Fixed uncritical key error (caused only error messages at StdOut) when using the Internals/Packages entry window. Error was introduced in version 2.0
Version 3.3 (18.09.2023):
- Added command line switch "-no_version_check" to forbid HDL-FSM-Editor to access the internet at start.
- Removed a HDL generation crash, which was caused by a transition with no condition using a connector.
Version 3.4 (21.10.2023):
- At HDL generation correctly defined HDL-constants caused the warning "There is an illegal signal declaration". Fixed.
- Constants were highlighted in red as "not written". Fixed.There is an illegal signal declaration
Version 3.5 (23.10.2023):
- At HDL generation correctly defined functions and types caused the warning "There is an illegal signal declaration". Fixed.
- When a generic is read by an assignment it was colored red, as it was never written. Fixed.
Version 3.6 (08.11.2023):
- Using the "Edit command" (Control-e) under Linux did not work. Fixed.
Version 3.7 (17.11.2023):
- All action blocks could only be moved by touching them near there border. Now they can be touched also inside.
- Connectors were not inserted with the right size after a zoom. Fixed.
Version 3.8 (23.11.2023):
- Now also the Default State Action block can be moved by picking it inside.
- A working directory for the compile commands can now be specified in the control tab.
Version 3.9 (07.03.2024):
- The window-title was changed, so that the filename can be read, if the window is an icon.
- The checking of the command line parameters is now done by ArgParse.
- The new command-line switch -no_message was introduced to prevent HDL-FSM-Editor to print a message at start.
Version 3.10 (13.03.2024):
- Loading a design into HDL-FSM-Editor by command line parameter did not work anymore in version 3.9. Fixed.
- Fixed wrong tool-name in the help-text shown by option "-h".
- Added new command-line parameter "-generate_hdl" for batch-mode HDL generation (used in HDL-SCHEM-Editor).