URL
https://opencores.org/ocsvn/openmsp430/openmsp430/trunk
Subversion Repositories openmsp430
[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [src/] [two-op_mov.s43] - Rev 83
Go to most recent revision | Compare with Previous | Blame | View Log
/*===========================================================================*/
/* Copyright (C) 2001 Authors */
/* */
/* This source file may be used and distributed without restriction provided */
/* that this copyright statement is not removed from the file and that any */
/* derivative work contains the original copyright notice and the associated */
/* disclaimer. */
/* */
/* This source file is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU Lesser General Public License as published */
/* by the Free Software Foundation; either version 2.1 of the License, or */
/* (at your option) any later version. */
/* */
/* This source is distributed in the hope that it will be useful, but WITHOUT*/
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
/* License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with this source; if not, write to the Free Software Foundation, */
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
/* */
/*===========================================================================*/
/* TWO-OPERAND ARITHMETIC: MOV INSTRUCTION */
/*---------------------------------------------------------------------------*/
/* Test the MOV instruction with all addressing modes */
/* */
/* Author(s): */
/* - Olivier Girard, olgirard@gmail.com */
/* */
/*---------------------------------------------------------------------------*/
/* $Rev: 19 $ */
/* $LastChangedBy: olivier.girard $ */
/* $LastChangedDate: 2009-08-04 23:47:15 +0200 (Tue, 04 Aug 2009) $ */
/*===========================================================================*/
.global main
main:
/* ---------------------- INITIALIZE REGISTERS --------------------- */
mov #0x2222, r2
mov #0x3333, r3
mov #0x4444, r4
mov #0x5555, r5
mov #0x6666, r6
mov #0x7777, r7
mov #0x8888, r8
mov #0x9999, r9
mov #0xaaaa, r10
mov #0xbbbb, r11
mov #0xcccc, r12
mov #0xdddd, r13
mov #0xeeee, r14
mov #0x1000, r15
/* ---------------------- TEST WHEN SOURCE IS Rn ------------------- */
.set Rn_EDE, __data_start
.set Rn_TONY, 0x0204
mov r4, r3 ;# Overwrite r3 with 0x4444
mov #test_Rn_PC, r4
br r4
nop
nop
nop
nop
mov #0x0000, r4 ;# Make sure the jump is taken
test_Rn_PC:
mov #0x0200, r5
mov #0x1234, r6
mov r6, 16(r5) ;# Write 0x1234 to memory @0x0210
mov #0x5678, r7
mov r7, Rn_EDE ;# Write 0x5678 to memory @0x0200
mov #0x9abc, r8
mov r8, &Rn_TONY ;# Write 0x9abc to memory @0x0204
mov #0x2000, r15
/* ---------------------- TEST WHEN SOURCE IS @Rn ------------------ */
.set aRn_EDE, __data_start
.set aRn_TONY, 0x0204
mov #0x0210, r4
mov #0x3333, r3
mov @r4, r3 ;# r3 takes @0x0210 value: 0x1234
mov #test_aRn_PC, r4
mov r4, &0x0200
mov #0x0200, r4
br @r4
nop
nop
nop
mov #0x0000, r4 ;# Make sure the jump is taken
test_aRn_PC:
mov #0x0200, r5
mov #0x0204, r6
mov @r6, 16(r5) ;# Move memory @0x204 (0x9abc) to memory @0x210
mov #0xfedc, &0x202
mov #0x0202, r6
mov @r6, aRn_EDE ;# Move memory @0x202 (0xfedc) to memory @0x200
mov #0xf1d2, &0x202
mov #0x0202, r6
mov @r6, &aRn_TONY ;# Move memory @0x202 (0xf1d2) to memory @0x204
mov #0x3000, r15
/* ---------------------- TEST WHEN SOURCE IS @Rn+ ----------------- */
.set aRni_EDE, __data_start
.set aRni_TONY, 0x0214
mov #0x1111, &0x200
mov #0x0200, r4
mov @r4+, r5 ;# Write @0x200 (0x1111) to R5
mov #test_aRni_PC, &0x204
mov #0x0204, r6
br @r6+
nop
nop
nop
nop
mov #0x0000, r6 ;# Make sure the jump is taken
test_aRni_PC:
mov #0x1234, &0x210
mov #0x5678, &0x212
mov #0x9abc, &0x214
mov #0xdef0, &0x216
mov #0x0210, r8
mov #0x0216, r7
mov @r7+, 16(r8) ;# Move memory @0x216 (0xdef0) to memory @0x220
mov #0x0212, r8
mov @r8+, aRni_EDE ;# Move memory @0x212 (0x5678) to memory @0x200
mov #0x0210, r9
mov @r9+, &aRni_TONY ;# Move memory @0x210 (0x1234) to memory @0x214
mov #0x4000, r15
/* ---------------------- TEST WHEN SOURCE IS #N ------------------- */
.set N_EDE, (__data_start+0x0010)
.set N_TONY, 0x0206
mov #0x3210, r4 ;# Write 0x3210 to R4
mov #0xfcde, r5
br #test_N_PC
nop
nop
nop
nop
mov #0x0000, r5 ;# Make sure the jump is taken
test_N_PC:
mov #0x0200, r6
mov #0x5a5a, 48(r6) ;# Move memory 0x5a5a to memory @0x230
mov #0x1a2b, N_EDE ;# Move memory 0x1a2b to memory @0x210
mov #0x3c4d, &N_TONY ;# Move memory 0x3c4d to memory @0x206
mov #0x5000, r15
/* ---------------------- TEST WHEN SOURCE IS x(Rn) ---------------- */
.set xRn_EDE, (__data_start+0x0020)
.set xRn_TONY, 0x0208
mov #0x8347, &0x0210
mov #0x1234, &0x0200
mov #0x0200, r4
mov 16(r4), r5 ;# Write 0x8347 to R5
mov #test_xRn_PC, &0x0208
mov #0x1234, &0x0200
mov #0x2345, r6
mov #0x0200, r4
br 8(r4)
nop
nop
nop
nop
mov #0x0000, r6 ;# Make sure the jump is taken
test_xRn_PC:
mov #0x4231, &0x0210
mov #0x1234, &0x0200
mov #0x0200, r7
mov #0x0202, r8
mov 16(r7), 18(r8) ;# Move memory @0x210 (0x4231) to memory @0x214
mov #0x7238, &0x0204
mov #0x1234, &0x0200
mov #0x0200, r7
mov 4(r7), xRn_EDE ;# Move memory @0x204 (0x7238) to memory @0x220
mov #0x98b2, &0x0216
mov #0x1234, &0x0200
mov #0x0200, r7
mov 22(r4), &xRn_TONY ;# Move memory @0x216 (0x98b2) to memory @0x208
mov #0x6000, r15
/* ---------------------- TEST WHEN SOURCE IS 'EDE' ---------------- */
.set EDE_EDE, (__data_start+0x0016)
.set EDE_TONY, 0x0212
.set EDE_200, (__data_start+0x0000)
.set EDE_202, (__data_start+0x0002)
.set EDE_204, (__data_start+0x0004)
.set EDE_206, (__data_start+0x0006)
.set EDE_208, (__data_start+0x0008)
mov #0xc3d6, &0x0200
mov #0x1234, &0x0202
mov #0x4321, r4
mov EDE_200, r4 ;# Write 0xc3d6 to R4
mov #test_EDE_PC, &0x0202
mov #0x1234, &0x0204
mov #0x3456, r6
br EDE_202
nop
nop
nop
nop
mov #0x0000, r6 ;# Make sure the jump is taken
test_EDE_PC:
mov #0x0202, r8
mov #0xf712, &0x0204
mov #0x1234, &0x0206
mov EDE_204, 18(r8) ;# Move memory @0x204 (0xf712) to memory @0x214
mov #0xb3a9, &0x0206
mov #0x1234, &0x0208
mov EDE_206, EDE_EDE ;# Move memory @0x206 (0xb3a9) to memory @0x216
mov #0x837A, &0x0208
mov #0x1234, &0x020A
mov EDE_208, &EDE_TONY ;# Move memory @0x208 (0x837A) to memory @0x212
mov #0x7000, r15
/* ---------------------- TEST WHEN SOURCE IS '&EDE' --------------- */
.set aEDE_EDE, (__data_start+0x0018)
.set aEDE_TONY, 0x0202
mov #0x23d4, &0x0200
mov #0x1234, &0x0202
mov #0x4321, r4
mov &0x0200, r4 ;# Write 0x23d4 to R4
mov #test_aEDE_PC, &0x0202
mov #0x1234, &0x0204
mov #0xfb58, r6
br &0x0202
nop
nop
nop
nop
mov #0x0000, r6 ;# Make sure the jump is taken
test_aEDE_PC:
mov #0x0202, r7
mov #0x481c, &0x0204
mov #0x1234, &0x0206
mov &0x0204, 18(r7) ;# Move memory @0x204 (0x481c) to memory @0x214
mov #0x5c1f, &0x0206
mov #0x1234, &0x0208
mov &0x0206, aEDE_EDE ;# Move memory @0x206 (0x5c1f) to memory @0x218
mov #0xc16e, &0x0208
mov #0x1234, &0x020A
mov &0x0208, &aEDE_TONY ;# Move memory @0x208 (0xc16e) to memory @0x202
mov #0x8000, r15
/* ---------------------- TEST WHEN SOURCE IS CONSTANT ------------- */
.set CONST_EDE0, (__data_start+0x0020)
.set CONST_EDE1, (__data_start+0x0022)
.set CONST_EDE2, (__data_start+0x0024)
.set CONST_EDE4, (__data_start+0x0026)
.set CONST_EDE8, (__data_start+0x0028)
.set CONST_EDEm1, (__data_start+0x002A)
.set CONST_TONY0, 0x0230
.set CONST_TONY1, 0x0232
.set CONST_TONY2, 0x0234
.set CONST_TONY4, 0x0236
.set CONST_TONY8, 0x0238
.set CONST_TONYm1, 0x023A
mov #0x4444, r4 ;# Initialize registers
mov #0x5555, r5
mov #0x6666, r6
mov #0x7777, r7
mov #0x8888, r8
mov #0x9999, r9
mov #0x0000, r4 ;# Write +0 to R4
mov #0x0001, r5 ;# Write +1 to R5
mov #0x0002, r6 ;# Write +2 to R6
mov #0x0004, r7 ;# Write +4 to R7
mov #0x0008, r8 ;# Write +8 to R8
mov #0xffff, r9 ;# Write -1 to R9
mov #0x0202, r10
mov #0x1234, r11
mov #0x0000, 14(r10) ;# Move +0 to memory @0x210
mov #0x0001, 16(r10) ;# Move +1 to memory @0x212
mov #0x0002, 18(r10) ;# Move +2 to memory @0x214
mov #0x0004, 20(r10) ;# Move +4 to memory @0x216
mov #0x0008, 22(r10) ;# Move +8 to memory @0x218
mov #0xffff, 24(r10) ;# Move -1 to memory @0x21A
mov #0x0000, CONST_EDE0 ;# Move +0 to memory @0x220
mov #0x0001, CONST_EDE1 ;# Move +1 to memory @0x222
mov #0x0002, CONST_EDE2 ;# Move +2 to memory @0x224
mov #0x0004, CONST_EDE4 ;# Move +4 to memory @0x226
mov #0x0008, CONST_EDE8 ;# Move +8 to memory @0x228
mov #0xffff, CONST_EDEm1 ;# Move -1 to memory @0x22A
mov #0x0000, &CONST_TONY0 ;# Move +0 to memory @0x230
mov #0x0001, &CONST_TONY1 ;# Move +1 to memory @0x232
mov #0x0002, &CONST_TONY2 ;# Move +2 to memory @0x234
mov #0x0004, &CONST_TONY4 ;# Move +4 to memory @0x236
mov #0x0008, &CONST_TONY8 ;# Move +8 to memory @0x238
mov #0xffff, &CONST_TONYm1 ;# Move -1 to memory @0x23A
mov #0x9000, r15
/* ---------------- TEST WHEN SOURCE IS CONSTANT IN BYTE MODE ------ */
#
# NOTE: The following section would not fit in the smallest ROM
# configuration for the "two-op_mov-b.s43" pattern.
# It is therefore executed here.
#
.set CONSTL_TONY0, 0x0250
.set CONSTL_TONY1, 0x0252
.set CONSTL_TONY2, 0x0254
.set CONSTL_TONY4, 0x0256
.set CONSTL_TONY8, 0x0258
.set CONSTL_TONYm1, 0x025A
.set CONSTH_TONY0, 0x025D
.set CONSTH_TONY1, 0x025F
.set CONSTH_TONY2, 0x0261
.set CONSTH_TONY4, 0x0263
.set CONSTH_TONY8, 0x0265
.set CONSTH_TONYm1, 0x0267
mov #0x4444, &0x0250 ;# Initialize Memory
mov #0x5555, &0x0252
mov #0x6666, &0x0254
mov #0x7777, &0x0256
mov #0x3535, &0x0258
mov #0x9999, &0x025A
mov #0xaaaa, &0x025C
mov #0xbbbb, &0x025E
mov #0xcccc, &0x0260
mov #0xdddd, &0x0262
mov #0xeeee, &0x0264
mov #0x3333, &0x0266
mov.b #0x0000, &CONSTL_TONY0 ;# Move +0 to memory @0x250
mov.b #0x0001, &CONSTL_TONY1 ;# Move +1 to memory @0x252
mov.b #0x0002, &CONSTL_TONY2 ;# Move +2 to memory @0x254
mov.b #0x0004, &CONSTL_TONY4 ;# Move +4 to memory @0x256
mov.b #0x0008, &CONSTL_TONY8 ;# Move +8 to memory @0x258
mov.b #0xffff, &CONSTL_TONYm1 ;# Move -1 to memory @0x25A
mov.b #0x0000, &CONSTH_TONY0 ;# Move +0 to memory @0x25D
mov.b #0x0001, &CONSTH_TONY1 ;# Move +1 to memory @0x25F
mov.b #0x0002, &CONSTH_TONY2 ;# Move +2 to memory @0x261
mov.b #0x0004, &CONSTH_TONY4 ;# Move +4 to memory @0x263
mov.b #0x0008, &CONSTH_TONY8 ;# Move +8 to memory @0x265
mov.b #0xffff, &CONSTH_TONYm1 ;# Move -1 to memory @0x267
mov #0xA000, r15
/* ---------------------- END OF TEST --------------- */
end_of_test:
nop
br #0xffff
/* ---------------------- INTERRUPT VECTORS --------------- */
.section .vectors, "a"
.word end_of_test ; Interrupt 0 (lowest priority) <unused>
.word end_of_test ; Interrupt 1 <unused>
.word end_of_test ; Interrupt 2 <unused>
.word end_of_test ; Interrupt 3 <unused>
.word end_of_test ; Interrupt 4 <unused>
.word end_of_test ; Interrupt 5 <unused>
.word end_of_test ; Interrupt 6 <unused>
.word end_of_test ; Interrupt 7 <unused>
.word end_of_test ; Interrupt 8 <unused>
.word end_of_test ; Interrupt 9 <unused>
.word end_of_test ; Interrupt 10 Watchdog timer
.word end_of_test ; Interrupt 11 <unused>
.word end_of_test ; Interrupt 12 <unused>
.word end_of_test ; Interrupt 13 <unused>
.word end_of_test ; Interrupt 14 NMI
.word main ; Interrupt 15 (highest priority) RESET
Go to most recent revision | Compare with Previous | Blame | View Log