Subversion Repositories openmsp430
[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [src/] [two-op_add_rom-rd.s43] - Rev 141
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 *//* *//*===========================================================================*//* ADD: DATA READ ACCESS FROM ROM *//*---------------------------------------------------------------------------*//* Test the ADD instruction with all addressing modes making a read access *//* to the ROM. *//* *//* Author(s): *//* - Olivier Girard, olgirard@gmail.com *//* *//*---------------------------------------------------------------------------*//* $Rev: 141 $ *//* $LastChangedBy: olivier.girard $ *//* $LastChangedDate: 2012-05-05 23:22:06 +0200 (Sat, 05 May 2012) $ *//*===========================================================================*/.include "pmem_defs.asm".global mainmain:/* ---------------------- TEST WHEN SOURCE IS @Rn ------------------ */.set aRn_EDE, DMEM_212.set aRn_TONY, DMEM_214mov #data_aRn_0x1111, r4mov #0x6666, r5add @r4, r5 ;# Add @r4+r5 (0x1111+0x6666=0x7777)mov #data_aRn_0x000a, r4add @r4, r0nopnopnopmov #0x1234, r4 ;# Make sure the jump is takentest_aRn_PC:mov #0x5432, &DMEM_210mov #DMEM_200, r6mov #data_aRn_0x1234, r7add @r7, 16(r6) ;# Write 0x1234+0x5432=0x6666 to memory @0x0210mov #0x8e1c, &DMEM_212mov #data_aRn_0x5f12, r7add @r7, aRn_EDE+PMEM_LENGTH ;# Write 0x5f12+0x8e1c=0xed2e to memory @0x0212mov #0x1541, &DMEM_214mov #data_aRn_0x3112, r8add @r8, &aRn_TONY ;# Write 0x3112+0x1541=0x4653 to memory @0x0214mov #0x1000, r15/* ---------------------- TEST WHEN SOURCE IS @Rn+ ----------------- */.set aRni_EDE, DMEM_212.set aRni_TONY, DMEM_214mov #data_aRni_0x2222, r4mov #0x8888, r5add @r4+, r5 ;# Add @r4+r5 (0x2222+0x8888=0xaaaa)add @r4+, r5 ;# Add @r4+r5 (0x3333+0xaaaa=0xdddd)mov #0xaaaa, r7mov #data_aRni_0x000a, r6add @r6+, r0nopnopnopmov #0x1234, r7 ;# Make sure the jump is takentest_aRni_PC1:add @r6+, r0nopnopnopnopnopmov #0x1234, r7 ;# Make sure the jump is takentest_aRni_PC2:mov #0x5432, &DMEM_210mov #DMEM_200, r8mov #data_aRni_0x1234, r10add @r10+, 16(r8) ;# Write 0x1234+0x5432=0x6666 to memory @0x0210add @r10+, 16(r8) ;# Write 0x2345+0x6666=0x89AB to memory @0x0210mov #0x8e1c, &DMEM_212mov #data_aRni_0x5f12, r8add @r8+, aRni_EDE+PMEM_LENGTH ;# Write 0x5f12+0x8e1c=0xed2e to memory @0x0212add @r8+, aRni_EDE+PMEM_LENGTH ;# Write 0x6345+0xed2e=0x5073 to memory @0x0212mov #0x1541, &DMEM_214mov #data_aRni_0x3112, r9add @r9+, &aRni_TONY ;# Write 0x3112+0x1541=0x4653 to memory @0x0214add @r9+, &aRni_TONY ;# Write 0x1123+0x4653=0x5776 to memory @0x0214mov #0x2000, r15/* ---------------------- TEST WHEN SOURCE IS x(Rn) ---------------- */.set xRn_EDE, DMEM_220.set xRn_TONY, DMEM_208mov #0x1234, r5mov #data_xRn_0x8347, r4add 16(r4), r5 ;# Write 0x8347+0x1234=0x957b to R5mov #data_xRn_0x000a, r4mov #0x1234, r6add 8(r4), r0nopnopnopnopmov #0x0000, r6 ;# Make sure the jump is takentest_xRn_PC:mov #0x1535, &DMEM_214mov #data_xRn_0x4241, r7mov #DMEM_202, r8add 16(r7), 18(r8) ;# Write 0x4241+0x1535=0x5776 to memory @0x214mov #0x2143, &DMEM_220mov #data_xRn_0x7238, r7add 4(r7), xRn_EDE+PMEM_LENGTH ;# Write 0x7238+0x2143=0x937b to memory @0x220mov #0x1432, &DMEM_208mov #data_xRn_0x98b2, r4add 22(r4), &xRn_TONY ;# Write 0x0x98b2+0x1432=0xace4 to memory @0x208mov #0x3000, r15/* ---------------------- TEST WHEN SOURCE IS 'EDE' ---------------- */.set EDE_EDE, DMEM_216.set EDE_TONY, DMEM_212mov #0x4321, r4add data_EDE_0xc3d6, r4 ;# Write 0xc3d6+0x4321=0x06f7 to R4mov #0x3456, r6add data_EDE_0x000a, r0nopnopnopnopmov #0x0000, r6 ;# Make sure the jump is takentest_EDE_PC:mov #DMEM_202, r8mov #0x1234, &DMEM_214mov #0x0000, &DMEM_208add data_EDE_0xf712, 18(r8) ;# Write 0xf712+0x1234=0x0946 to memory @0x214mov #0x058a, &DMEM_216mov #0x1234, &DMEM_208add data_EDE_0xb3a9, EDE_EDE+PMEM_LENGTH ;# Write 0xb3a9+0x058a=0xb933 to memory @0x216mov #0xA738, &DMEM_212mov #0x1234, &DMEM_20Aadd data_EDE_0x837a, &EDE_TONY ;# Write 0x837A+0xA738=0x2ab2 to memory @0x212mov #0x4000, r15/* ---------------------- TEST WHEN SOURCE IS '&EDE' --------------- */.set aEDE_EDE, DMEM_218.set aEDE_TONY, DMEM_202mov #0x4321, r4add &data_aEDE_0x23d4, r4 ;# Write 0x23d4+0x4321=0x66f5 to R4mov #0x3456, r6add &data_aEDE_0x000a, r0nopnopnopnopmov #0x0000, r6 ;# Make sure the jump is takentest_aEDE_PC:mov #DMEM_202, r7mov #0x3ab5, &DMEM_214mov #0x1234, &DMEM_206add &data_aEDE_0x481c, 18(r7) ;# Write 0x481c+0x3ab5=0x82d1 to memory @0x214mov #0x6e2f, &DMEM_218mov #0x1234, &DMEM_208add &data_aEDE_0x5c1f, aEDE_EDE+PMEM_LENGTH ;# Write 0x5c1f+0x6e2f=0xca4e to memory @0x218mov #0x51ca, &DMEM_202mov #0x1234, &DMEM_20Aadd &data_aEDE_0xc16e, &aEDE_TONY ;# Write 0xc16e+0x51ca=0x1338 to memory @0x202mov #0x5000, r15end_of_test:nopbr #0xffff/* ---------------------- DATA TABLE --------------- */data_aRn_0x1111:.word 0x1111data_aRn_0x000a:.word 0x000adata_aRn_0x1234:.word 0x1234data_aRn_0x5f12:.word 0x5f12data_aRn_0x3112:.word 0x3112data_aRni_0x2222:.word 0x2222.word 0x3333data_aRni_0x000a:.word 0x000a.word 0x000edata_aRni_0x1234:.word 0x1234.word 0x2345data_aRni_0x5f12:.word 0x5f12.word 0x6345data_aRni_0x3112:.word 0x3112.word 0x1123data_xRn_0x8347:.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x8347data_xRn_0x000a:.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x000adata_xRn_0x4241:.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x4241data_xRn_0x7238:.word 0x0000.word 0x0000.word 0x7238data_xRn_0x98b2:.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x0000.word 0x98b2data_EDE_0xc3d6:.word 0xc3d6data_EDE_0x000a:.word 0x000adata_EDE_0xf712:.word 0xf712data_EDE_0xb3a9:.word 0xb3a9data_EDE_0x837a:.word 0x837adata_aEDE_0x23d4:.word 0x23d4data_aEDE_0x000a:.word 0x000adata_aEDE_0x481c:.word 0x481cdata_aEDE_0x5c1f:.word 0x5c1fdata_aEDE_0xc16e:.word 0xc16e/* ---------------------- 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
