Generated reference › Memory — Control Systems/Discrete
kind: generated#block#control-systems-discrete

Memory — Control Systems/Discrete

Control_Systems/Discrete/Memory · 1 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.

Memory

Control Systems / Discrete

Holds its input for one step and emits it on the next:

y[k] = u[k−1]

Before the first step has been taken there is no previous input, so the block emits the configured Initial Condition instead. Its usual job is to break an algebraic loop – a feedback path with no storage in it, which the solver cannot resolve – by putting exactly one step of delay in the way.

Ports

  • Input – the signal u to hold, of any size [m,n]. Every entry is held independently; the entries do not interact.
  • Output – the held signal y, the SAME size [m,n] as the input.

Parameters

  • Initial Condition – a scalar, what the block emits on the first step, before any input has been stored. Defaults to 0. It is broadcast to every entry of the signal, so one value seeds a matrix signal whatever its size.
  • Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period. Note that this one does not cross to Simulink – see the bridge section below.

Code export

All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text. Each carries one held matrix as its state, seeded with the initial condition, which is baked into the core at export time rather than exposed as a tunable parameter – it seeds a state rather than scaling arithmetic.

The three HDL targets need no special handling: the state write is a registered assignment, so reading the state signal within the same tick returns its pre-clock contents – exactly the previous sample. The delay falls out of the register rather than having to be arranged around it.

Simulink bridge

Import and export, mapped to simulink/Discrete/Memory. "Initial Condition" to InitialCondition, and InheritSampleTime is always emitted as off – this block always holds for one step of its own rate, so there is no choice to offer behind that parameter.

"Sampling Time (s)" does not cross. Simulink's Memory block defines no SampleTime parameter at all, unlike almost every other block in the library, so the pair that is mapped globally is suppressed for this entry. That is not a simplification: set_param on a parameter a block does not define is a hard error in MATLAB that aborts the whole generated script, so emitting it would break the export rather than degrade it. The rate stays on the ICore side, and a block configured with an explicit positive rate reports that it did not cross.

Notes

  • Stateful: one held matrix, the input from the previous step.
  • Discrete by nature – the state advances once per step, so the block is never pushed through a continuous solver's stages.
  • Memory vs. Unit Delay. Both compute y[k] = u[k−1] and the arithmetic is identical; the difference is the RATE. Unit Delay delays by its own configured "Sampling Time (s)" and crosses that period to Simulink; Memory delays by one step of whatever drives it and carries no rate across at all. Reach for Unit Delay when the delay length is something you want to state, and for Memory when you just need a break in an algebraic loop at whatever rate the surrounding model happens to run.
  • Deliberately carries no state space. A pure delay is the transcendental factor e^(−sT), which no finite continuous A/B/C/D expresses, so fabricating one would let the model-reduction commands absorb a delay into a plant as though it were a gain. The block runs its discrete realization – A=[0], B=[1], C=[1], D=[0] – directly, which also keeps it able to carry the matrix signals an ICoreStateSpace column vector could not.

Code facts#

FactValue
registered typeControl_Systems/Discrete/Memory
familyControl_Systems/Discrete
solver environment classICoreBlock_0_Control_Systems_1_Discrete_2_Memory
sourcesrc/ICoreSDK/ICoreBlockLibrary/Blocks/Control_Systems/Discrete/Memory/ICoreBlock_0_Control_Systems_1_Discrete_2_Memory.cpp
headersrc/ICoreSDK/ICoreBlockLibrary/Blocks/Control_Systems/Discrete/Memory/ICoreBlock_0_Control_Systems_1_Discrete_2_Memory.h
default size on canvas90 × 70 px
ports at insert1 in, 1 out
code generators implementedPython, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text

Ports#

#DirectionSignal typeDescription label
1inICoreDouble
2outICoreDouble

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
Initial Condition0InitialCondition

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 pathsimulink/Discrete/Memory
port-count rulePortsParam::None
SampleTime parameterno — the counterpart defines none; the rate stays on the ICore side
always setInheritSampleTime = off
ICore configSimulink parameterValue translation
Initial ConditionInitialConditionpasses through

Caveat (shown to the user): Simulink's Memory block has NO SampleTime parameter (verified against the R2026a block dialog), so "Sampling Time (s)" does not cross - the block holds for one step of the surrounding Simulink rate

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

Description vs code#

The lists agree. check_block_descriptions.py finds no disagreement between the description's Ports, Parameters, Code export and Simulink bridge lists and the code's.

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.

File banner (developer view)#

The top comment of the block's .cpp — the maths, the realization and the export strategy, addressed to whoever changes it. It must not contradict the description above (P7.5).

Memory block — y[k] = u[k-1], one step of storage Emits the input from the PREVIOUS step and stores the current one; before the first step has been taken it emits the configured Initial Condition. The signal may be any size [m,n] and the output matches it exactly.

y[k] = held (held = the initial condition until the first step) held = u[k]

MEMORY vs. UNIT DELAY. The recursion is identical, and the two are the most confusable pair in this family. The difference is what "one step" MEANS, and it is a rate question rather than an arithmetic one: Unit Delay delays by its own configured "Sampling Time (s)" and says so on its dialog, whereas Memory delays by one step of whatever is driving it. That is why Simulink's Memory block carries no SampleTime parameter at all -- verified against the R2026a dialog -- and why this block's Simulink entry sets hasSampleTimeParam = false: a set_param('SampleTime') on it is a hard MATLAB error, not a warning.

Code export: all ten targets. On the three HDL backends the delay falls straight out of the register -- the state write is REGISTERED, so reading the state signal in the same tick returns its pre-clock contents, which is precisely the previous sample.

Sample results#

Memory — Step: 0 -> 1 at t = 1 sMemory — Step: 0 -> 1 at t = 1 s00.51012345t (s)in ICoreDouble-Out-0out ICoreDouble-Out-0

The same rig also ran:

StimulusWhat it isOutput range
impulseImpulse: one sample of 1 at k = 5, 0 elsewhere (Repeating Sequence Stair)0 … 1
rampRamp: slope 1 from t = 00 … 5.7
sineSine Wave: amplitude 1, 2 rad/s, no phase, no bias-1 … 0.9996
tableRepeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample-2 … 3

Plotted: step — Step: 0 -> 1 at t = 1 s

Category dynamic · sample time 0.1 · 60 steps · commit ccf005c8 · produced by docsSample --out <folder> --steps 60 · data docs/generated/samples/Control_Systems__Discrete__Memory.json · the SVG is generated from those numbers by tools/docs/plot_svg.py, so it is a run and not a drawing (R-D10).