
- •Preface
- •About This Manual
- •Other Information Sources
- •Syntax Conventions
- •Text Command Syntax
- •About the Graphical User Interface
- •Using Menus
- •Using Forms
- •HDL Synthesis Overview
- •HDL Synthesis Flow
- •Read Technology Libraries
- •Read Design Data
- •Build Generic Design
- •Save Generic Netlist
- •Synthesizing Mixed VHDL/Verilog Designs
- •Querying the HDL Design Pool
- •Using get_hdl_top_level Command
- •Using get_hdl_hierarchy Command
- •Using get_hdl_type Command
- •Building Generic Netlists from HDL
- •Multiple Top-Level Designs
- •Building Parameterized Designs
- •Verilog Modeling Styles
- •Modeling Combinational Logic
- •Register Inferencing
- •Latch Inference
- •Flip-Flop Inference
- •case Statements
- •Incomplete case Statement
- •Complete case Statement
- •Use of casex and casez Statements
- •for Statement
- •Synthesis Directives
- •Code Selection Directives
- •Architecture Selection Directive
- •case Statement Directives
- •Module Template Directive
- •Function and Task Mapping Directives
- •Set and Reset Synthesis Directives
- •Verilog Preprocessor Directives
- •Compiler Directives
- •The ‘for Compiler Directive
- •The ‘if Compiler Directive
- •The ‘eval Compiler Directive
- •The ‘{} Compiler Directive
- •Command Line Options
- •VPP Flag Attribute
- •Verilog-Related Commands and Globals
- •VHDL Modeling Style
- •Modeling Combinational Logic
- •Register Inferencing
- •Latch Inference
- •Flip-Flop Inferencing
- •Specifying Clock Edges
- •case Statement
- •Incomplete case Statement
- •Complete case Statement
- •for loop
- •Synthesis Directives
- •Code Selection Directives
- •Architecture Selection Directive
- •case Statement Directive
- •Enumeration Encoding Directive
- •Entity Template Directive
- •Function and Procedure Mapping Directives
- •Signed Type Directive
- •Resolution Function Directives
- •Type Conversion Directives
- •Set and Reset Synthesis Directives
- •Reading VHDL Designs
- •Using Arithmetic Packages From Other Vendors
- •Switching between VHDL’87 / VHDL’93
- •Reusing Previously Analyzed Entities
- •Modifying Case of VHDL Names
- •Writing VHDL Netlists
- •Selecting Bit-Level Representation
- •Selecting Between VHDL’87 and VHDL’93
- •Referring to VHDL Packages in Netlists
- •Writing Component Declarations
- •Hierarchical VHDL Designs
- •Component Instantiations and Bindings
- •Restrictions on Entities with Multiple Architectures
- •Precedence Rules for Architecture Selection
- •VHDL-Related Commands and Globals
- •Finite State Machine Overview
- •BuildGates Synthesis and Finite State Machines
- •Extracting the State Transition Table for the FSM
- •Viewing the State Transition Table for the FSM
- •FSM Optimization Features
- •Unreachable State Removal
- •State Assignment or Re-Encoding
- •State Minimization
- •Terminal State Check
- •Verilog and VHDL FSM Directives
- •Verilog FSM Directives
- •VHDL FSM Directives
- •FSM Coding Styles
- •Using the -reachable Option
- •Avoiding a Simulation Mismatch
- •EDIF Interface
- •Reading EDIF Designs
- •Writing EDIF Designs
- •Representing Power and Ground in EDIF
- •Net Representation for Power and Ground
- •Port Representation for Power and Ground
- •Instance Representation for Power and Ground
- •Verilog Constructs
- •Fully Supported Constructs
- •Declarations
- •Operators and Expressions
- •Partially Supported Constructs
- •Ignored Constructs
- •Unsupported Constructs
- •Summary of Verilog Constructs
- •VHDL Constructs
- •Notes on Supported Constructs

Envisia HDL Modeling Reference
Finite State Machine Structure and Optimization
Table 4-1 state_vector |
Encoding Options, continued |
|
|
Option |
Description |
|
|
preserve_state |
Specifies the states to be preserved and prevents those |
|
states from being removed by the minimize or reachable |
|
options. |
initial_states |
Specifies the states to be set as the initial states of the FSM. |
|
|
State Minimization
This optimization tells the software to perform a minimization on the FSM and validate it. Each state of an FSM typically corresponds to a unique behavior. In some cases, however, two or more equivalent states, having identical I/O behavior, may occur in a state machine. This can be a result of performance reasons (by the designer) or a bug in the design. If equivalent states are found in the design it may mean that the design has a bug. If you are confident that your design does not have any equivalent states, then you can ignore this option and save on runtime. You can invoke state minimization using the following Cadence pragma:
//ambit synthesis state_vector state_reg |
-minimize |
Terminal State Check
A terminal state check is always performed on the extracted FSM. A terminal state is a state of the FSM from which there are no outputs. A well designed state machine should never have a terminal state. If such a state is found in the FSM, it is included in the FSM report (see Viewing the State Transition Table for the FSM on page 92).
Verilog and VHDL FSM Directives
Verilog FSM Directives
When a finite state machine is described, much of the information related to its state encoding is not written in the Verilog HDL model. Two synthesis directives are provided to capture this information. These are the enum and the state_vector directives. Using these directives in your Verilog HDL description causes the FSM to be extracted and optimized when the -extract_fsm option is specified with the do_build_generic command, as follows:
do_build_generic -extract_fsm
September 2000 |
95 |
Product Version 4.0 |

Envisia HDL Modeling Reference
Finite State Machine Structure and Optimization
The directives are described in detail in the following section. For optimization examples, see FSM Optimization Features on page 92.
Enumeration Directive
The enum synthesis directive is used to enumerate state assignments and to bind the state assignments to the state vector. A name for the enumeration is defined using the directive. It is bound to the state vector when the state vector (current state and next state) is declared.
The following is the syntax for the enum synthesis directive:
// ambit synthesis enum enumeration_name
The example below shows how to use the enum synthesis directive to represent state vector values.
module myfsm (clk, out, reset); input clk, reset;
output [1:0] out;
parameter [1:0] // ambit synthesis enum state_info STATE0 = 2’b00,
STATE1 = 2’b01,
STATE2 = 2’b10,
reg [1:0] /* ambit synthesis enum state_info */ state;
reg [1:0] /* ambit synthesis enum state_info */ next_state; reg [1:0] out;
// ambit synthesis state_vector state -encoding one_hot always @ (posedge clk) begin
if (reset)
state = STATE0; else
state = next_state;
end
always @ (state or reset) begin case (state)
STATE0 : begin next_state = STATE1; out = 2’b01;
end
STATE1: begin next_state = STATE2; out = 2’b10;
end
September 2000 |
96 |
Product Version 4.0 |

Envisia HDL Modeling Reference
Finite State Machine Structure and Optimization
STATE2: begin next_state = STATE0; out = 2’b10;
end
default: begin //represents the unreachable (invalid) states of the FSM // next_state = STATE0;
out = 2’bxx; end
endcase end endmodule
Using the enum directive with parameter declarations results in each parameter being taken as an enumeration of the state. The enum directive is used to associate the state vector (state and next_state above) with the state assignments enumerated by the parameter declaration. A warning is generated if the FSM is extracted with more states than the parameters specified as state enumeration.
If the enum synthesis directive is specified with the state vector declaration but has no enumeration of state encoding, the valid state assignments are derived automatically from the model.
Verilog state_vector Directive
The state_vector synthesis directive enables you to specify the state vector and to specify the method of encoding and optimizing the FSM.
The syntax for the synthesis state_vector directive is:
// ambit synthesis state_vector sig state_vector_flag
where sig is the name of the signal representing the state vector. The state_vector_flag is defined using one or more of the following options:
■encoding [binary|gray|one_hot|random|input|output|combined | area |timing]
■minimize
■reachable
■preserve_state
■initial_state
The state_vector encoding options are defined in Table 4-1.
September 2000 |
97 |
Product Version 4.0 |

Envisia HDL Modeling Reference
Finite State Machine Structure and Optimization
The following example defines the Verilog state_vector directive.
library IEEE;
use IEEE.std_logic_1164.all; library ambit;
use ambit.attributes.all;
entity fsm is port (
clk, rst : in std_logic;
data : out std_logic_vector(1 downto 0) ); end entity fsm;
architecture rtl of fsm is
type COLOR is (red, blue, green, yellow);
signal STATE, NEXT_STATE : COLOR;
attribute STATE_VECTOR |
of STATE |
: signal is |
true; |
|||
attribute PRESERVE |
of STATE |
: signal is |
"red, blue"; |
|||
attribute INITIAL |
of STATE |
: signal is |
"red"; |
|||
attribute |
REACHABLE |
of |
STATE |
: signal |
is |
true; |
attribute |
MINIMIZE |
of |
STATE |
: signal |
is |
true; |
begin
state_p: process (clk, rst) begin
if (rst = ’1’) then STATE <= red;
elsif (rising_edge(clk)) then STATE <= NEXT_STATE;
end if;
end process state_p;
next_state_p: process(state)
begin |
|
|
|
case (STATE) is |
|
|
|
when red => |
data |
<= "01"; |
|
NEXT_STATE <= blue; |
|
||
when blue => |
data |
<= |
"10"; |
September 2000 |
98 |
Product Version 4.0 |