Skip to content
STIMSMITH

Next State Function

Concept WIKI v1 · 5/26/2026

A next state function is the function in a finite-state model that computes the next state from an input and the current state. In the cited hardware-verification and instruction-set-simulator context, it also appears as an ITL macro, `next_state`, that updates architectural state according to the current decoded instruction and serves as the core of a formally checkable ISA description.

Definition

In the finite-state-machine model of a synchronous circuit, the next state function is denoted Δ. The circuit is modeled as M = (I, S, S0, Δ, Λ, O), where I is the input alphabet, S is the finite set of states, S0 is the set of initial states, Λ is the output function, and O is the output alphabet. The next state function has the type:

Δ : B^n × B^m → B^m

It maps an input value and a current state to a next state. In this setting, the transition relation of the circuit is given by:

T(s, s′) = ∃x ∈ B^n : s′ ≡ Δ(x, s)

This relation states that s′ is a possible successor of s when there exists an input x for which the next state function produces s′ from s.

Role in architectural modeling

In the architectural-style formulation described in the evidence, a macro named next_state is explicitly defined to capture the effects of instructions and interrupts on the architectural state. The architectural state is represented as a user-defined VHDL record that combines elements such as the register file, status flags, and program counter. Interface data types for memories and ports are similarly defined.

The next_state macro returns the architectural state modified by execution of the current instruction. For example, the cited text describes a case in which an ADD instruction updates the register file of the current architectural state with the sum of source operands. In this usage, next_state is described as forming the core of the ISA.

Use in equivalence checking

The evidence describes an equivalence-proof structure relating an RTL CPU implementation to an ISA-level model. An abstraction function vstate maps implementation state to ISA architectural state. The proof goal is that applying the implementation transition relation T and then mapping the resulting CPU state to the ISA state corresponds to applying next_state at the ISA level.

A representative architectural property freezes:

instr       = decode(instruction) @ t
isa_state   = vstate @ t
isa_state_p = vstate @ t+1
nstate      = next_state(isa_state, instr) @ t

and proves:

at t+1: isa_state_p = nstate

This expresses that the ISA state observed at the next time point equals the state produced by next_state from the current ISA state and decoded instruction.

Use in instruction set simulator generation

The cited work uses the architectural-style property and its next_state function as the starting point for automatic generation of a C++ instruction set simulator. The generated simulator core is a C++ class that contains instruction-execution code and holds the architectural state. Generation steps include producing public functions for next_state, decode, and interface macros; producing private functions for remaining macros; generating a member variable for architectural state; replacing ITL/HDL types and operations by C++ equivalents; and replacing update expressions with direct array or structure overwrites in C++.

The update keyword is used in ITL to explicitly model write access to an array or record data structure, which is important for expressing how next_state modifies architectural state.

CITATIONS

9 sources
9 citations
[1] A synchronous circuit can be modeled as an FSM containing input alphabet, state set, initial states, output function, next state function, and output alphabet. Generating an Efficient Instruction Set Simulator from a Complete Property Suite
[2] The next state function has type Δ : B^n × B^m → B^m and defines the transition relation T(s, s′) = ∃x ∈ B^n : s′ ≡ Δ(x, s). Generating an Efficient Instruction Set Simulator from a Complete Property Suite
[3] Architectural-style modeling explicitly defines a macro next_state that captures effects of instructions and interrupts on architectural state. Generating an Efficient Instruction Set Simulator from a Complete Property Suite
[4] Architectural state is represented as a user-defined VHDL record combining elements such as register file, status flags, and program counter. Generating an Efficient Instruction Set Simulator from a Complete Property Suite
[5] The next_state macro returns the architectural state modified by execution of the current instruction and forms the core of the ISA. Generating an Efficient Instruction Set Simulator from a Complete Property Suite
[6] The equivalence proof relates RTL transition behavior to ISA-level next_state behavior through the abstraction function vstate. Generating an Efficient Instruction Set Simulator from a Complete Property Suite
[7] A property using next_state can capture all behavior of the verified design and provide a formally checkable ISA description for ISS generation. Generating an Efficient Instruction Set Simulator from a Complete Property Suite
[8] ISS generation includes public functions for next_state, decode, and interface macros, a member variable for architectural state, C++ replacements for ITL/HDL types and operations, and replacement of update expressions by direct array or structure overwrites. Generating an Efficient Instruction Set Simulator from a Complete Property Suite
[9] The ITL update keyword explicitly defines write access to an array or record data structure. Generating an Efficient Instruction Set Simulator from a Complete Property Suite