I am creating a state machine using the FSM editor and I am having a difficult time placing codes into the state machine by hand. As the state machine grows, I have to keep adding larger codes for each state. Am I doing something wrong? Is there an easier way?
By default, encoding data (i.e. coding of the machine states) is saved and stored in a state diagram document (*.asf). However, the State Diagram Editor allows saving and reading encoding data from an external Comma-Separated Value file (*.csv).
The *.csv file can be generated by the State Diagram Editor or you can create it manually by using any text editor. The file contains the detailed information about the names of machine states, the values of state code, and optional radix separated with the commas. The format of a single row in the *.csv file is as follows:
<state_name> defines the name of the state. The names of machine states are case-sensitive in projects of Verilog state machines and case-insensitive if VHDL is selected as a target HDL of a state machine.
<code> determines the value of the state register when a state machine transits to a state defined by the <state_name> parameter. The value of state code can be specified as a binary value (string of [0|1] characters) or a hexadecimal value (string of [0-9a-fA-F] characters preceded with 0x).
<radix> is an optional parameter for specifying the radix for the <code> parameter. The following strings are allowed: bin, oct, dec, and hex. This parameter determines a subset of characters that can be used while specifying the value of the state register, i.e. [0|1] if <code>=bin, [0-7] for oct, [0-9] for dec, or [0-9a-fA-F] for hex. Other characters are illegal.
If the format of the file is incorrect or it contains illegal parameters, the State Diagram Editor will report an error or a warning to the Console window, for example:
# Warning: Incorrect line <line_no>: <string>. Line omitted.
Note that if you choose to import or export encoding data by using the commands of the FSM menu, select a machine from the Machine list box prior to loading or saving the encoding file (*.csv).
To export encoding data to a file:
Choose the Save FSM Encoding option from the FSM menu, or
Click on the Save button in the General tab of the Machine Properties dialog box
Select the location of the file and specify its name in the Save dialog box. Then, click the Save button.
To import encoding data from a file:
Choose the Load FSM Encoding option from the FSM menu, or
Click on the Load button in the General tab of the Machine Properties dialog box
Select the location of the file and specify its name in the Open dialog box. Then, click the Open button.