URL
                    https://opencores.org/ocsvn/openmsp430/openmsp430/trunk
                
            Subversion Repositories openmsp430
[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [src/] [two-op_mov.s43] - Rev 120
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: 111 $ *//* $LastChangedBy: olivier.girard $ *//* $LastChangedDate: 2011-05-20 22:39:02 +0200 (Fri, 20 May 2011) $ *//*===========================================================================*/.set DMEM_BASE, (__data_start ).set DMEM_200, (__data_start+0x00).set DMEM_202, (__data_start+0x02).set DMEM_204, (__data_start+0x04).set DMEM_206, (__data_start+0x06).set DMEM_208, (__data_start+0x08).set DMEM_20A, (__data_start+0x0A).set DMEM_20C, (__data_start+0x0C).set DMEM_20E, (__data_start+0x0E).set DMEM_210, (__data_start+0x10).set DMEM_212, (__data_start+0x12).set DMEM_214, (__data_start+0x14).set DMEM_216, (__data_start+0x16).set DMEM_218, (__data_start+0x18).set DMEM_21A, (__data_start+0x1A).set DMEM_21C, (__data_start+0x1C).set DMEM_21E, (__data_start+0x1E).set DMEM_220, (__data_start+0x20).set DMEM_222, (__data_start+0x22).set DMEM_224, (__data_start+0x24).set DMEM_226, (__data_start+0x26).set DMEM_228, (__data_start+0x28).set DMEM_22A, (__data_start+0x2A).set DMEM_22C, (__data_start+0x2C).set DMEM_22E, (__data_start+0x2E).set DMEM_230, (__data_start+0x30).set DMEM_232, (__data_start+0x32).set DMEM_234, (__data_start+0x34).set DMEM_236, (__data_start+0x36).set DMEM_238, (__data_start+0x38).set DMEM_23A, (__data_start+0x3A).set DMEM_23C, (__data_start+0x3C).set DMEM_23E, (__data_start+0x3E).set DMEM_240, (__data_start+0x40).set DMEM_250, (__data_start+0x50).set DMEM_252, (__data_start+0x52).set DMEM_254, (__data_start+0x54).set DMEM_256, (__data_start+0x56).set DMEM_258, (__data_start+0x58).set DMEM_25A, (__data_start+0x5A).set DMEM_25C, (__data_start+0x5C).set DMEM_25D, (__data_start+0x5D).set DMEM_25E, (__data_start+0x5E).set DMEM_25F, (__data_start+0x5F).set DMEM_260, (__data_start+0x60).set DMEM_261, (__data_start+0x61).set DMEM_262, (__data_start+0x62).set DMEM_263, (__data_start+0x63).set DMEM_264, (__data_start+0x64).set DMEM_265, (__data_start+0x65).set DMEM_266, (__data_start+0x66).set DMEM_267, (__data_start+0x67).global mainmain:/* ---------------------- INITIALIZE REGISTERS --------------------- */mov #0x2222, r2mov #0x3333, r3mov #0x4444, r4mov #0x5555, r5mov #0x6666, r6mov #0x7777, r7mov #0x8888, r8mov #0x9999, r9mov #0xaaaa, r10mov #0xbbbb, r11mov #0xcccc, r12mov #0xdddd, r13mov #0xeeee, r14mov #0x1000, r15/* ---------------------- TEST WHEN SOURCE IS Rn ------------------- */.set Rn_EDE, DMEM_200.set Rn_TONY, DMEM_204mov r4, r3 ;# Overwrite r3 with 0x4444mov #test_Rn_PC, r4br r4nopnopnopnopmov #0x0000, r4 ;# Make sure the jump is takentest_Rn_PC:mov #DMEM_200, r5mov #0x1234, r6mov r6, 16(r5) ;# Write 0x1234 to memory @0x0210mov #0x5678, r7mov r7, Rn_EDE ;# Write 0x5678 to memory @0x0200mov #0x9abc, r8mov r8, &Rn_TONY ;# Write 0x9abc to memory @0x0204mov #0x2000, r15/* ---------------------- TEST WHEN SOURCE IS @Rn ------------------ */.set aRn_EDE, DMEM_200.set aRn_TONY, DMEM_204mov #DMEM_210, r4mov #0x3333, r3mov @r4, r3 ;# r3 takes @0x0210 value: 0x1234mov #test_aRn_PC, r4mov r4, &DMEM_200mov #DMEM_200, r4br @r4nopnopnopmov #0x0000, r4 ;# Make sure the jump is takentest_aRn_PC:mov #DMEM_200, r5mov #DMEM_204, r6mov @r6, 16(r5) ;# Move memory @0x204 (0x9abc) to memory @0x210mov #0xfedc, &DMEM_202mov #DMEM_202, r6mov @r6, aRn_EDE ;# Move memory @0x202 (0xfedc) to memory @0x200mov #0xf1d2, &DMEM_202mov #DMEM_202, r6mov @r6, &aRn_TONY ;# Move memory @0x202 (0xf1d2) to memory @0x204mov #0x3000, r15/* ---------------------- TEST WHEN SOURCE IS @Rn+ ----------------- */.set aRni_EDE, DMEM_200.set aRni_TONY, DMEM_214mov #0x1111, &DMEM_200mov #DMEM_200, r4mov @r4+, r5 ;# Write @0x200 (0x1111) to R5mov #test_aRni_PC, &DMEM_204mov #DMEM_204, r6br @r6+nopnopnopnopmov #0x0000, r6 ;# Make sure the jump is takentest_aRni_PC:mov #0x1234, &DMEM_210mov #0x5678, &DMEM_212mov #0x9abc, &DMEM_214mov #0xdef0, &DMEM_216mov #DMEM_210, r8mov #DMEM_216, r7mov @r7+, 16(r8) ;# Move memory @0x216 (0xdef0) to memory @0x220mov #DMEM_212, r8mov @r8+, aRni_EDE ;# Move memory @0x212 (0x5678) to memory @0x200mov #DMEM_210, r9mov @r9+, &aRni_TONY ;# Move memory @0x210 (0x1234) to memory @0x214mov #0x4000, r15/* ---------------------- TEST WHEN SOURCE IS #N ------------------- */.set N_EDE, DMEM_210.set N_TONY, DMEM_206mov #0x3210, r4 ;# Write 0x3210 to R4mov #0xfcde, r5br #test_N_PCnopnopnopnopmov #0x0000, r5 ;# Make sure the jump is takentest_N_PC:mov #DMEM_200, r6mov #0x5a5a, 48(r6) ;# Move memory 0x5a5a to memory @0x230mov #0x1a2b, N_EDE ;# Move memory 0x1a2b to memory @0x210mov #0x3c4d, &N_TONY ;# Move memory 0x3c4d to memory @0x206mov #0x5000, r15/* ---------------------- TEST WHEN SOURCE IS x(Rn) ---------------- */.set xRn_EDE, DMEM_220.set xRn_TONY, DMEM_208mov #0x8347, &DMEM_210mov #0x1234, &DMEM_200mov #DMEM_200, r4mov 16(r4), r5 ;# Write 0x8347 to R5mov #test_xRn_PC, &DMEM_208mov #0x1234, &DMEM_200mov #0x2345, r6mov #DMEM_200, r4br 8(r4)nopnopnopnopmov #0x0000, r6 ;# Make sure the jump is takentest_xRn_PC:mov #0x4231, &DMEM_210mov #0x1234, &DMEM_200mov #DMEM_200, r7mov #DMEM_202, r8mov 16(r7), 18(r8) ;# Move memory @0x210 (0x4231) to memory @0x214mov #0x7238, &DMEM_204mov #0x1234, &DMEM_200mov #DMEM_200, r7mov 4(r7), xRn_EDE ;# Move memory @0x204 (0x7238) to memory @0x220mov #0x98b2, &DMEM_216mov #0x1234, &DMEM_200mov #DMEM_200, r7mov 22(r4), &xRn_TONY ;# Move memory @0x216 (0x98b2) to memory @0x208mov #0x6000, r15/* ---------------------- TEST WHEN SOURCE IS 'EDE' ---------------- */.set EDE_EDE, DMEM_216.set EDE_TONY, DMEM_212.set EDE_200, DMEM_200.set EDE_202, DMEM_202.set EDE_204, DMEM_204.set EDE_206, DMEM_206.set EDE_208, DMEM_208mov #0xc3d6, &DMEM_200mov #0x1234, &DMEM_202mov #0x4321, r4mov EDE_200, r4 ;# Write 0xc3d6 to R4mov #test_EDE_PC, &DMEM_202mov #0x1234, &DMEM_204mov #0x3456, r6br EDE_202nopnopnopnopmov #0x0000, r6 ;# Make sure the jump is takentest_EDE_PC:mov #DMEM_202, r8mov #0xf712, &DMEM_204mov #0x1234, &DMEM_206mov EDE_204, 18(r8) ;# Move memory @0x204 (0xf712) to memory @0x214mov #0xb3a9, &DMEM_206mov #0x1234, &DMEM_208mov EDE_206, EDE_EDE ;# Move memory @0x206 (0xb3a9) to memory @0x216mov #0x837A, &DMEM_208mov #0x1234, &DMEM_20Amov EDE_208, &EDE_TONY ;# Move memory @0x208 (0x837A) to memory @0x212mov #0x7000, r15/* ---------------------- TEST WHEN SOURCE IS '&EDE' --------------- */.set aEDE_EDE, DMEM_218.set aEDE_TONY, DMEM_202mov #0x23d4, &DMEM_200mov #0x1234, &DMEM_202mov #0x4321, r4mov &DMEM_200, r4 ;# Write 0x23d4 to R4mov #test_aEDE_PC, &DMEM_202mov #0x1234, &DMEM_204mov #0xfb58, r6br &DMEM_202nopnopnopnopmov #0x0000, r6 ;# Make sure the jump is takentest_aEDE_PC:mov #DMEM_202, r7mov #0x481c, &DMEM_204mov #0x1234, &DMEM_206mov &DMEM_204, 18(r7) ;# Move memory @0x204 (0x481c) to memory @0x214mov #0x5c1f, &DMEM_206mov #0x1234, &DMEM_208mov &DMEM_206, aEDE_EDE ;# Move memory @0x206 (0x5c1f) to memory @0x218mov #0xc16e, &DMEM_208mov #0x1234, &DMEM_20Amov &DMEM_208, &aEDE_TONY ;# Move memory @0x208 (0xc16e) to memory @0x202mov #0x8000, r15/* ---------------------- TEST WHEN SOURCE IS CONSTANT ------------- */.set CONST_EDE0, DMEM_220.set CONST_EDE1, DMEM_222.set CONST_EDE2, DMEM_224.set CONST_EDE4, DMEM_226.set CONST_EDE8, DMEM_228.set CONST_EDEm1, DMEM_22A.set CONST_TONY0, DMEM_230.set CONST_TONY1, DMEM_232.set CONST_TONY2, DMEM_234.set CONST_TONY4, DMEM_236.set CONST_TONY8, DMEM_238.set CONST_TONYm1, DMEM_23Amov #0x4444, r4 ;# Initialize registersmov #0x5555, r5mov #0x6666, r6mov #0x7777, r7mov #0x8888, r8mov #0x9999, r9mov #0x0000, r4 ;# Write +0 to R4mov #0x0001, r5 ;# Write +1 to R5mov #0x0002, r6 ;# Write +2 to R6mov #0x0004, r7 ;# Write +4 to R7mov #0x0008, r8 ;# Write +8 to R8mov #0xffff, r9 ;# Write -1 to R9mov #DMEM_202, r10mov #0x1234, r11mov #0x0000, 14(r10) ;# Move +0 to memory @0x210mov #0x0001, 16(r10) ;# Move +1 to memory @0x212mov #0x0002, 18(r10) ;# Move +2 to memory @0x214mov #0x0004, 20(r10) ;# Move +4 to memory @0x216mov #0x0008, 22(r10) ;# Move +8 to memory @0x218mov #0xffff, 24(r10) ;# Move -1 to memory @0x21Amov #0x0000, CONST_EDE0 ;# Move +0 to memory @0x220mov #0x0001, CONST_EDE1 ;# Move +1 to memory @0x222mov #0x0002, CONST_EDE2 ;# Move +2 to memory @0x224mov #0x0004, CONST_EDE4 ;# Move +4 to memory @0x226mov #0x0008, CONST_EDE8 ;# Move +8 to memory @0x228mov #0xffff, CONST_EDEm1 ;# Move -1 to memory @0x22Amov #0x0000, &CONST_TONY0 ;# Move +0 to memory @0x230mov #0x0001, &CONST_TONY1 ;# Move +1 to memory @0x232mov #0x0002, &CONST_TONY2 ;# Move +2 to memory @0x234mov #0x0004, &CONST_TONY4 ;# Move +4 to memory @0x236mov #0x0008, &CONST_TONY8 ;# Move +8 to memory @0x238mov #0xffff, &CONST_TONYm1 ;# Move -1 to memory @0x23Amov #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, DMEM_250.set CONSTL_TONY1, DMEM_252.set CONSTL_TONY2, DMEM_254.set CONSTL_TONY4, DMEM_256.set CONSTL_TONY8, DMEM_258.set CONSTL_TONYm1, DMEM_25A.set CONSTH_TONY0, DMEM_25D.set CONSTH_TONY1, DMEM_25F.set CONSTH_TONY2, DMEM_261.set CONSTH_TONY4, DMEM_263.set CONSTH_TONY8, DMEM_265.set CONSTH_TONYm1, DMEM_267mov #0x4444, &DMEM_250 ;# Initialize Memorymov #0x5555, &DMEM_252mov #0x6666, &DMEM_254mov #0x7777, &DMEM_256mov #0x3535, &DMEM_258mov #0x9999, &DMEM_25Amov #0xaaaa, &DMEM_25Cmov #0xbbbb, &DMEM_25Emov #0xcccc, &DMEM_260mov #0xdddd, &DMEM_262mov #0xeeee, &DMEM_264mov #0x3333, &DMEM_266mov.b #0x0000, &CONSTL_TONY0 ;# Move +0 to memory @0x250mov.b #0x0001, &CONSTL_TONY1 ;# Move +1 to memory @0x252mov.b #0x0002, &CONSTL_TONY2 ;# Move +2 to memory @0x254mov.b #0x0004, &CONSTL_TONY4 ;# Move +4 to memory @0x256mov.b #0x0008, &CONSTL_TONY8 ;# Move +8 to memory @0x258mov.b #0xffff, &CONSTL_TONYm1 ;# Move -1 to memory @0x25Amov.b #0x0000, &CONSTH_TONY0 ;# Move +0 to memory @0x25Dmov.b #0x0001, &CONSTH_TONY1 ;# Move +1 to memory @0x25Fmov.b #0x0002, &CONSTH_TONY2 ;# Move +2 to memory @0x261mov.b #0x0004, &CONSTH_TONY4 ;# Move +4 to memory @0x263mov.b #0x0008, &CONSTH_TONY8 ;# Move +8 to memory @0x265mov.b #0xffff, &CONSTH_TONYm1 ;# Move -1 to memory @0x267mov #0xA000, r15/* ---------------------- END OF TEST --------------- */end_of_test:nopbr #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

