For Iterator — Private/Subsystem Components
Private/Subsystem_Components/For_Iterator · 0 input / 1 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.
For Iterator
Control Systems / Ports And Subsystems
Makes the subsystem it sits in a For Iterator subsystem: each step, the subsystem runs a counted number of times, and what is seen outside is the last pass. Simulink’s For Iterator block (BlockType=ForIterator). To make one, place this block in a subsystem, or insert the ready-made For Iterator Subsystem from the library’s Subsystem Templates.
Ports
- Inputs – none while Iteration source is internal; one, the count, while it is external. Add or remove it to match.
- Outputs – one, the iteration number, while Show iteration port is On (the default); none while it is Off.
Parameters
- Reset states – held (default) carries states from one step to the next; reset re-seeds them once per step, before the first pass, never between passes.
- Iteration source – internal (default) counts to the Iteration limit; external reads the count from the input port.
- Iteration limit – the count, when internal. 0 runs nothing.
- External increment – Off (default).
- Show iteration port – On (default) gives the iteration-number output.
- Index mode – One-based (default): the output reads 1..N; zero-based reads 0..N-1.
- Iteration variable data type – int32 (default). It bounds the count: int8 allows 0 to 126.
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: Python, MATLAB, Java, Rust,
C, C++ and PLC Structured Text carry every limit and an
external count. VHDL, Verilog and SystemVerilog run at
most one pass per clock tick, so they carry an internal Iteration limit of 0 or
1 and refuse any other by name. Reset states reset is
carried wherever the loop is. A block that keeps its own clock is set back
before every pass, since every pass runs at the step’s time.
Simulink bridge
Import and export, mapped to built-in/ForIterator; the
library’s For Iterator Subsystem imports with what R2026a puts in it (an
In1, the For Iterator, an Out1, In1 wired to Out1, atomic). Every parameter
crosses: Reset states to ResetStates, Iteration
source to IterationSource, Iteration limit to
IterationLimit, External increment to
ExternalIncrement, Show iteration port to
ShowIterationPort, Index mode to IndexMode and
Iteration variable data type to IterationVariableDataType.
Its ports follow its parameters on both sides.
Code facts#
| Fact | Value |
|---|---|
| registered type | Private/Subsystem_Components/For_Iterator |
| family | Private/Subsystem_Components |
| solver environment class | ICoreBlock_0_Private_1_Subsystem_Components_2_For_Iterator |
| source | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Private/Subsystem_Components/For_Iterator/ICoreBlock_0_Private_1_Subsystem_Components_2_For_Iterator.cpp |
| header | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Private/Subsystem_Components/For_Iterator/ICoreBlock_0_Private_1_Subsystem_Components_2_For_Iterator.h |
| default size on canvas | 90 × 60 px |
| ports at insert | 0 in, 1 out |
| code generators implemented | Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text |
Ports#
| # | Direction | Signal type | Description label |
|---|---|---|---|
| 1 | out | ICoreDouble | iteration |
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 variable | Default | Simulink parameter |
|---|---|---|
Reset states | held%~%reset~~held | ResetStates |
Iteration source | internal%~%external~~internal | IterationSource |
Iteration limit | 5 | IterationLimit |
External increment | Off%~%On~~Off | ExternalIncrement |
Show iteration port | Off%~%On~~On | ShowIterationPort |
Index mode | One-based%~%Zero-based~~One-based | IndexMode |
Iteration variable data type | int32%~%uint32%~%int16%~%uint16%~%int8%~%uint8%~%double~~… | IterationVariableDataType |
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.
Simulink bridge#
| support | Support::Both |
| Simulink path | built-in/ForIterator |
| port-count rule | PortsParam::IteratorPorts |
SampleTime parameter | no — the counterpart defines none; the rate stays on the ICore side |
| ICore config | Simulink parameter | Value translation |
|---|---|---|
Reset states | ResetStates | held → held, reset → reset |
Iteration source | IterationSource | internal → internal, external → external |
Iteration limit | IterationLimit | passes through |
External increment | ExternalIncrement | Off → off, On → on |
Show iteration port | ShowIterationPort | Off → off, On → on |
Index mode | IndexMode | One-based → One-based, Zero-based → Zero-based |
Iteration variable data type | IterationVariableDataType | int32 → int32, uint32 → uint32, int16 → int16, uint16 → uint16, int8 → int8, uint8 → uint8, double → double |
Caveat (shown to the user): Simulink's For Iterator (built-in/ForIterator) inside the subsystem it iterates, and the library's For Iterator Subsystem made with what R2026a puts in it (FEATURES_TO_ADD.md BF9.6). Its ports follow its parameters on both sides: the count input with an external source, the iteration output 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.