Debian Codegraph @

Source/DSPSpy/tests/cr_test.ds

raw
1 incdir "tests"
2 include "dsp_base.inc"
3
4 ; Tests the behavior of SI, SRS, and LRS when CR is changed
5
6 ; Register that is writable but with contents that doesn't matter (COEF_A1_0)
7 TEST_REG: equ 0xFFA0 ; 0xFF00 (not writable)
8 ; This is separate because SRS and SI currently require value 0..7f or ff80..ffff,
9 ; though the actual behavior doesn't match that
10 TEST_ADDR: equ 0xFFA0 ; 0x0000
11 ; Memory addresses
12 TEST_MEM: equ 0x00A0 ; 0x0000
13 TEST_MEM_2: equ 0x01A0 ; 0x0100
14
15 test_main:
16 LRI $AC0.L, #0xf00f
17 SR @TEST_REG, $AC0.L
18 SR @TEST_MEM, $AC0.L
19 SR @TEST_MEM_2, $AC0.L
20 CALL send_regs
21
22 ; Observed: writes to TEST_REG
23 SI @TEST_ADDR, #0xf11f
24 CALL send_regs
25
26 LRI $AC0.L, #0xf22f
27 ; Observed: writes to TEST_REG
28 SRS @TEST_ADDR, $AC0.L
29 CALL send_regs
30
31 LRI $CR, #0x0000
32 ; Observed: still writes to TEST_REG
33 SI @TEST_ADDR, #0xf33f
34 CALL send_regs
35
36 LRI $AC0.L, #0xf44f
37 ; Observed: writes to TEST_MEM
38 SRS @TEST_ADDR, $AC0.L
39 CALL send_regs
40
41 LRI $CR, #0x0001
42 ; Observed: still writes to TEST_REG
43 SI @TEST_ADDR, #0xf55f
44 CALL send_regs
45
46 LRI $AC0.L, #0xf66f
47 ; Observed: writes to TEST_MEM_2
48 SRS @TEST_ADDR, $AC0.L
49 CALL send_regs
50
51 ; At this point, TEST_REG should be f55f, TEST_MEM should be f44f,
52 ; and TEST_MEM_2 should be f66f. Test the behavior of LRS.
53 ; Changes to prod.l are for display only.
54 LRI $CR, #0x00ff
55 LRI $prod.l, #0xf55f
56 LRS $AC0.L, @TEST_ADDR
57 CALL send_regs
58
59 LRI $CR, #0x0000
60 LRI $prod.l, #0xf44f
61 LRS $AC0.L, @TEST_ADDR
62 CALL send_regs
63
64 LRI $CR, #0x0001
65 LRI $prod.l, #0xf66f
66 LRS $AC0.L, @TEST_ADDR
67 CALL send_regs
68
69 ; We're done, DO NOT DELETE THIS LINE
70 JMP end_of_test
71
72 send_regs:
73 ; For display purposes only
74 LRI $prod.m1, #TEST_REG
75 LRI $prod.h, #TEST_MEM
76 LRI $prod.m2, #TEST_MEM_2
77 ; Actual registers
78 LR $AC1.L, @TEST_REG
79 LR $AC0.M, @TEST_MEM
80 LR $AC1.M, @TEST_MEM_2
81 CALL send_back
82 RET