State Machine Modeling For HDLs

Note:

To be able to generate code from behavioral models, all behavioral constructs should be contained within a Class.

For efficient code generation from State Machine models into Hardware Description Languages (HDL) such as VHDL, Verilog and Systems C, apply the design practices outlined in this topic.

In an HDL State Machine model, the following are expected:

  • Designate Driving Triggers
  • Establish PortTrigger Mapping
  • Active State Logic

Designate Driving Triggers

The top level State Machine diagram should be used to model the different modes of a hardware component, and the associated triggers that drive them, as shown in the following diagram.

HWStateMachine

Asynchronous Triggers

Asynchronous triggers should be modeled according to the following pattern:

  1. The trigger should be of type Change (specification: true / false)
  2. The active state (Submachine State) should have a transition trigger by it.
  3. The target state of the triggered transition should have a self transition with the same trigger

Clock

A trigger of type time, which triggers the transitions to the active state (Submachine State) is deemed as the Clock. The specification of this trigger should be specific to the target language.

Clock Trigger Specifications

Trigger Type

Language

Specification

Positive Edge Triggered

Negative Edge Triggered

 

Time

VHDL

rising_edge

falling_edge

Verilog

posedge

negedge

SystemC

positive

negative

Establish Port Trigger Mapping

After successfully modeling the different operating modes of the component, and the triggers associated with them, you must associate the triggers with the component's ports as shown in the following diagram.

Class_HDL

A Dependency relationship from the Port to the associated trigger should be used to signify their association.

See Also:

Active State Logic

The first two aspects, above, put in place the preliminaries required for efficient interpretation of the hardware components. The actual State Machine logic is now modeled within the Active (Submachine) state.

active_state_logic

Note:

The current code generation engine supports only one clock trigger for a component.