OpenCores

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 main

main:
        /* ---------------------- TEST WHEN SOURCE IS @Rn ------------------ */
.set   aRn_EDE,  DMEM_212
.set   aRn_TONY, DMEM_214

        
        mov   #data_aRn_0x1111, r4
        mov            #0x6666, r5
        add                @r4, r5         ;# Add @r4+r5 (0x1111+0x6666=0x7777)

        mov   #data_aRn_0x000a, r4
        add                @r4, r0
        nop
        nop
        nop
        mov            #0x1234, r4         ;# Make sure the jump is taken
test_aRn_PC:

        mov            #0x5432, &DMEM_210
        mov          #DMEM_200, r6
        mov   #data_aRn_0x1234, r7
        add                @r7, 16(r6)     ;# Write 0x1234+0x5432=0x6666 to memory @0x0210

        mov            #0x8e1c, &DMEM_212
        mov   #data_aRn_0x5f12, r7
        add                @r7, aRn_EDE+PMEM_LENGTH    ;# Write 0x5f12+0x8e1c=0xed2e to memory @0x0212

        mov            #0x1541, &DMEM_214
        mov   #data_aRn_0x3112, r8
        add                @r8, &aRn_TONY  ;# Write 0x3112+0x1541=0x4653 to memory @0x0214

        mov            #0x1000, r15



        /* ---------------------- TEST WHEN SOURCE IS @Rn+ ----------------- */
.set   aRni_EDE,  DMEM_212
.set   aRni_TONY, DMEM_214

        mov   #data_aRni_0x2222, r4
        mov             #0x8888, r5
        add                @r4+, r5        ;# Add @r4+r5 (0x2222+0x8888=0xaaaa)
        add                @r4+, r5        ;# Add @r4+r5 (0x3333+0xaaaa=0xdddd)

        mov             #0xaaaa, r7
        mov   #data_aRni_0x000a, r6
        add                @r6+, r0
        nop
        nop
        nop
        mov             #0x1234, r7        ;# Make sure the jump is taken
test_aRni_PC1:
        add                @r6+, r0
        nop
        nop
        nop
        nop
        nop
        mov             #0x1234, r7        ;# Make sure the jump is taken
test_aRni_PC2:

        mov             #0x5432, &DMEM_210
        mov           #DMEM_200, r8
        mov   #data_aRni_0x1234, r10
        add               @r10+, 16(r8)    ;# Write 0x1234+0x5432=0x6666 to memory @0x0210
        add               @r10+, 16(r8)    ;# Write 0x2345+0x6666=0x89AB to memory @0x0210

        mov             #0x8e1c, &DMEM_212
        mov   #data_aRni_0x5f12, r8
        add                @r8+, aRni_EDE+PMEM_LENGTH   ;# Write 0x5f12+0x8e1c=0xed2e to memory @0x0212
        add                @r8+, aRni_EDE+PMEM_LENGTH   ;# Write 0x6345+0xed2e=0x5073 to memory @0x0212

        mov             #0x1541, &DMEM_214
        mov   #data_aRni_0x3112, r9
        add                @r9+, &aRni_TONY ;# Write 0x3112+0x1541=0x4653 to memory @0x0214
        add                @r9+, &aRni_TONY ;# Write 0x1123+0x4653=0x5776 to memory @0x0214

        mov             #0x2000, r15


        /* ---------------------- TEST WHEN SOURCE IS x(Rn) ---------------- */
.set   xRn_EDE,  DMEM_220
.set   xRn_TONY, DMEM_208

        mov            #0x1234, r5
        mov   #data_xRn_0x8347, r4
        add             16(r4), r5         ;# Write 0x8347+0x1234=0x957b to R5

        mov   #data_xRn_0x000a, r4
        mov            #0x1234, r6
        add              8(r4), r0
        nop
        nop
        nop
        nop
        mov            #0x0000, r6         ;# Make sure the jump is taken
test_xRn_PC:

        mov            #0x1535, &DMEM_214
        mov   #data_xRn_0x4241, r7
        mov          #DMEM_202, r8
        add             16(r7), 18(r8)     ;# Write 0x4241+0x1535=0x5776 to memory @0x214

        mov            #0x2143, &DMEM_220
        mov   #data_xRn_0x7238, r7
        add              4(r7), xRn_EDE+PMEM_LENGTH    ;# Write 0x7238+0x2143=0x937b to memory @0x220

        mov            #0x1432, &DMEM_208
        mov   #data_xRn_0x98b2, r4
        add             22(r4), &xRn_TONY  ;# Write 0x0x98b2+0x1432=0xace4 to memory @0x208

        mov            #0x3000, r15


        /* ---------------------- TEST WHEN SOURCE IS 'EDE' ---------------- */
.set   EDE_EDE,  DMEM_216
.set   EDE_TONY, DMEM_212


        mov              #0x4321, r4
        add      data_EDE_0xc3d6, r4          ;# Write 0xc3d6+0x4321=0x06f7 to R4

        mov              #0x3456, r6
        add      data_EDE_0x000a, r0
        nop
        nop
        nop
        nop
        mov              #0x0000, r6          ;# Make sure the jump is taken
test_EDE_PC:

        mov            #DMEM_202, r8
        mov              #0x1234, &DMEM_214
        mov              #0x0000, &DMEM_208
        add      data_EDE_0xf712, 18(r8)      ;# Write 0xf712+0x1234=0x0946 to memory @0x214

        mov              #0x058a, &DMEM_216
        mov              #0x1234, &DMEM_208
        add      data_EDE_0xb3a9, EDE_EDE+PMEM_LENGTH     ;# Write 0xb3a9+0x058a=0xb933 to memory @0x216

        mov              #0xA738, &DMEM_212
        mov              #0x1234, &DMEM_20A
        add      data_EDE_0x837a, &EDE_TONY   ;# Write 0x837A+0xA738=0x2ab2 to memory @0x212

        mov              #0x4000, r15



        /* ---------------------- TEST WHEN SOURCE IS '&EDE' --------------- */
.set   aEDE_EDE,  DMEM_218
.set   aEDE_TONY, DMEM_202

        mov                #0x4321, r4
        add      &data_aEDE_0x23d4, r4          ;# Write 0x23d4+0x4321=0x66f5 to R4

        mov                #0x3456, r6
        add      &data_aEDE_0x000a, r0
        nop
        nop
        nop
        nop
        mov                #0x0000, r6          ;# Make sure the jump is taken
test_aEDE_PC:

        mov              #DMEM_202, r7
        mov                #0x3ab5, &DMEM_214
        mov                #0x1234, &DMEM_206
        add      &data_aEDE_0x481c, 18(r7)      ;# Write 0x481c+0x3ab5=0x82d1 to memory @0x214

        mov                #0x6e2f, &DMEM_218
        mov                #0x1234, &DMEM_208
        add      &data_aEDE_0x5c1f, aEDE_EDE+PMEM_LENGTH    ;# Write 0x5c1f+0x6e2f=0xca4e to memory @0x218

        mov                #0x51ca, &DMEM_202
        mov                #0x1234, &DMEM_20A
        add      &data_aEDE_0xc16e, &aEDE_TONY  ;# Write 0xc16e+0x51ca=0x1338 to memory @0x202

        mov                #0x5000, r15


        
end_of_test:
        nop
        br #0xffff


        /* ----------------------            DATA TABLE      --------------- */
data_aRn_0x1111:
        .word 0x1111
data_aRn_0x000a:
        .word 0x000a
data_aRn_0x1234:
        .word 0x1234
data_aRn_0x5f12:
        .word 0x5f12
data_aRn_0x3112:
        .word 0x3112

data_aRni_0x2222:
        .word 0x2222
        .word 0x3333
data_aRni_0x000a:
        .word 0x000a
        .word 0x000e
data_aRni_0x1234:
        .word 0x1234
        .word 0x2345
data_aRni_0x5f12:
        .word 0x5f12
        .word 0x6345
data_aRni_0x3112:
        .word 0x3112
        .word 0x1123

data_xRn_0x8347:
        .word 0x0000
        .word 0x0000
        .word 0x0000
        .word 0x0000
        .word 0x0000
        .word 0x0000
        .word 0x0000
        .word 0x0000
        .word 0x8347
data_xRn_0x000a:
        .word 0x0000
        .word 0x0000
        .word 0x0000
        .word 0x0000
        .word 0x000a
data_xRn_0x4241:
        .word 0x0000
        .word 0x0000
        .word 0x0000
        .word 0x0000
        .word 0x0000
        .word 0x0000
        .word 0x0000
        .word 0x0000
        .word 0x4241
data_xRn_0x7238:
        .word 0x0000
        .word 0x0000
        .word 0x7238
data_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 0x98b2
        
data_EDE_0xc3d6:
        .word 0xc3d6
data_EDE_0x000a:
        .word 0x000a
data_EDE_0xf712:
        .word 0xf712
data_EDE_0xb3a9:
        .word 0xb3a9
data_EDE_0x837a:
        .word 0x837a

data_aEDE_0x23d4:
        .word 0x23d4
data_aEDE_0x000a:
        .word 0x000a
data_aEDE_0x481c:
        .word 0x481c
data_aEDE_0x5c1f:
        .word 0x5c1f
data_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

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2014 OpenCores.org, equivalent to ORSoC AB, all rights reserved. OpenCores®, registered trademark.