summaryrefslogtreecommitdiff
path: root/tests/fixtures/model-lifecycle.s
diff options
context:
space:
mode:
authorkx <kx@radix-linux.su>2026-10-09 18:00:15 +0300
committerkx <kx@radix-linux.su>2026-10-09 18:00:15 +0300
commit065da3509019b15dd0e678072e6be629e5330bef (patch)
tree69c934c9e786ac048b4fbe8f4c4c5571661521f4 /tests/fixtures/model-lifecycle.s
parentd130fe27fa753be02ed76fd9b277aa3c3d928eb9 (diff)
downloadlibmcpu-0.4.0.tar.xz
Version 0.4.00.4.0
Diffstat (limited to 'tests/fixtures/model-lifecycle.s')
-rw-r--r--tests/fixtures/model-lifecycle.s53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/fixtures/model-lifecycle.s b/tests/fixtures/model-lifecycle.s
new file mode 100644
index 0000000..4c190d5
--- /dev/null
+++ b/tests/fixtures/model-lifecycle.s
@@ -0,0 +1,53 @@
+; Build from examples/:
+; ../utils/mcpu-as -o model-lifecycle.o model-lifecycle.s
+; ../utils/mcpu-ld --stack-size=512 -o model-lifecycle model-lifecycle.o
+;
+; Run one INIT-only pass or one LIFE step:
+; ../utils/mcpu-run --init-only --int-reg=r64@0x00000 model-lifecycle
+; ../utils/mcpu-run --steps=1 --int-reg=r64@0x00000 model-lifecycle
+;
+; Expected outputs: 40 and 42 respectively.
+;
+; LibCPU lifecycle/model-segment example.
+; cpu-run --steps=1 --int-reg=r64@0x00000 model-lifecycle -> 42
+; cpu-run --init-only --int-reg=r64@0x00000 model-lifecycle -> 40
+
+.control
+model_step:
+ .real 64, 1.0
+
+.input
+external_delta:
+ .integer 64, 2
+
+.output
+current_state:
+ .integer 64, 0
+
+.trace
+telemetry_state:
+ .integer 64, 0
+
+.init
+_start:
+ LDI r64@0x00000, 40
+ END
+
+.text
+_life:
+loop:
+ LEA r64@0x00008, external_delta
+ LOADP r64@0x00010, r64@0x00008
+ IADD r64@0x00000, r64@0x00000, r64@0x00010
+
+ LEA r64@0x00018, current_state
+ STOREP r64@0x00018, r64@0x00000
+ LEA r64@0x00020, telemetry_state
+ STOREP r64@0x00020, r64@0x00000
+
+ END
+ JMP loop
+
+.fini
+_fini:
+ END