Generated reference › While Iterator — Private/Subsystem Components
kind: generated#block#private-subsystem-components

While Iterator — Private/Subsystem Components

while

Private/Subsystem_Components/While_Iterator · 2 input / 0 output port(s) at insert · exports to Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text

Description#

The block's own DESCRIPTION_HTML, rendered verbatim — the same text the config dialog's info panel and the library navigator show. Fix a wrong sentence in the block's .cpp (R-D9), never here.

While Iterator

Control Systems / Ports And Subsystems

Makes the subsystem it sits in a While Iterator subsystem: each step, the subsystem runs again while its condition holds, up to a maximum, and what is seen outside is the last pass. Simulink’s While Iterator block (BlockType=WhileIterator). To make one, place this block in a subsystem, or insert the ready-made While Iterator Subsystem from the library’s Subsystem Templates.

Ports

  • Inputs – cond, driven from inside the subsystem and tested after each pass, and, for a while loop, IC, the condition before the first pass. A do-while loop takes only cond.
  • Outputs – none while Show iteration number port is Off (the default); one, the number of passes, while it is On.

Parameters

  • Maximum number of iterations – 5 (default). The cap stops the loop silently; -1 is no limit; 0 runs nothing.
  • While loop type – while (default) tests the IC before the first pass; do-while always runs one.
  • Reset states – held (default) or reset, once per step before the first pass.
  • Show iteration number port – Off (default).
  • Output data type – int32 (default).

Notes

  • A subsystem is iterated by one iterator block at most, and the block has to sit inside a subsystem, never at the top level. A port count or a count that disagrees with the parameters is refused before a run, by name.
  • A simulation runs the subsystem’s blocks once per pass, all at the step’s time, and what is seen outside is the last pass. Inside, every block inherits its rate (-1) or is constant; a continuous block, a block with its own rate and a Discrete-Time Integrator (elapsed time) are refused by name, as R2026a refuses them.

Code export

The subsystem exports as a loop around its blocks, with the same passes as the simulation, the condition tested after each one: Python, MATLAB, Java, Rust, C, C++ and PLC Structured Text. A Maximum number of iterations of -1 is refused by name, since exported code must finish every step. VHDL, Verilog and SystemVerilog run at most one pass per clock tick and refuse a While subsystem by name. Reset states reset is carried wherever the loop is.

Simulink bridge

Import and export, mapped to built-in/WhileIterator; the library’s While Iterator Subsystem imports with what R2026a puts in it (an In1, an IC Inport wired to the block’s IC input, the While Iterator, an Out1, In1 wired to Out1, atomic; the condition input left open). Every parameter crosses: Maximum number of iterations to MaxIters, While loop type to WhileBlockType, Reset states to ResetStates, Show iteration number port to ShowIterationPort and Output data type to OutputDataType. Its ports follow its parameters on both sides.

Code facts#

FactValue
registered typePrivate/Subsystem_Components/While_Iterator
familyPrivate/Subsystem_Components
solver environment classICoreBlock_0_Private_1_Subsystem_Components_2_While_Iterator
sourcesrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Private/Subsystem_Components/While_Iterator/ICoreBlock_0_Private_1_Subsystem_Components_2_While_Iterator.cpp
headersrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Private/Subsystem_Components/While_Iterator/ICoreBlock_0_Private_1_Subsystem_Components_2_While_Iterator.h
default size on canvas90 × 60 px
ports at insert2 in, 0 out
code generators implementedPython, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text

Ports#

#DirectionSignal typeDescription label
1inICoreDoublecond
2inICoreDoubleIC

Ports the constructor creates. A block whose port list changes with its configuration adds or removes ports at load time; the count above is the one a freshly inserted block has.

Configuration variables#

Config variableDefaultSimulink parameter
Maximum number of iterations5MaxIters
While loop typewhile%~%do-while~~whileWhileBlockType
Reset statesheld%~%reset~~heldResetStates
Show iteration number portOff%~%On~~OffShowIterationPort
Output data typeint32%~%uint32%~%int16%~%uint16%~%int8%~%uint8%~%double~~…OutputDataType

Every block also carries Sampling Time (s) from ICoreBlockSolverEnvironment: zero or less inherits the solver's rate, a positive value runs the block at that period.

supportSupport::Both
Simulink pathbuilt-in/WhileIterator
port-count rulePortsParam::IteratorPorts
SampleTime parameterno — the counterpart defines none; the rate stays on the ICore side
ICore configSimulink parameterValue translation
Maximum number of iterationsMaxIterspasses through
While loop typeWhileBlockTypewhile → while, do-while → do-while
Reset statesResetStatesheld → held, reset → reset
Show iteration number portShowIterationPortOff → off, On → on
Output data typeOutputDataTypeint32 → int32, uint32 → uint32, int16 → int16, uint16 → uint16, int8 → int8, uint8 → uint8, double → double

Caveat (shown to the user): Simulink's While Iterator (built-in/WhileIterator) inside the subsystem it iterates, and the library's While Iterator Subsystem made with what R2026a puts in it (FEATURES_TO_ADD.md BF9.6). A do-while has no IC input on either side; the iteration output appears when shown.

Catalog contract: src/ICoreBlocks/ICoreCoder/ICoreCommandSystem/SimulinkBridge/ICoreSimulinkBlockCatalog.h

Description vs code#

tools/docs/check_block_descriptions.py (P7.1) could not be run when this page was generated, so no verdict is shown. Run it yourself; a page cannot claim an agreement it did not measure.

The verdict above is tools/docs/check_block_descriptions.py (P7.1), which compares LISTS. It cannot read a sentence: "stateless" on a block with a state, an initial-value semantic the recursion does not implement, a "not synthesizable" caveat the HDL banner contradicts. That is the agent audit (P7.3) on BLOCK_DESCRIPTION_AUDIT.md, and this tool's green is not a substitute for one.

Sample results#

No sample run is committed for this block. Samples come from the headless harness (DOCS_PLAN.md P8.1) into docs/generated/samples/; until one exists this block's behaviour is witnessed by the parity and export-verification suites, not by a plot here.