OpenCores
URL https://opencores.org/ocsvn/openmsp430/openmsp430/trunk

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [src/] [c-jump_jc.s43] - Rev 53

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        */
/*                                                                           */
/*===========================================================================*/
/*                 CONDITIONAL JUMP: JC INSTRUCTION                          */
/*---------------------------------------------------------------------------*/
/* Test the JC instruction.                                                  */
/*                                                                           */
/* 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:
        /* -------------- TEST JUMP FORWARD AND BACKWARD ------------------- */

        mov     #0x0001, r2
        mov     #0x1234, r4
        jc      test_jc_fwrd1
        mov     #0x0000, r4
        mov     #0x0000, r4
        mov     #0x0000, r4
test_jc_bckwrd:
        mov     #0x9abc, r6
        jc      test_jc_fwrd2
        mov     #0x0000, r4
        mov     #0x0000, r4
        mov     #0x0000, r4
        mov     #0x0000, r5
        mov     #0x0000, r5
        mov     #0x0000, r5
        mov     #0x0000, r6
        mov     #0x0000, r6
        mov     #0x0000, r6
test_jc_fwrd1:
        mov     #0x5678, r5
        jc      test_jc_bckwrd
        mov     #0x0000, r4
        mov     #0x0000, r4
        mov     #0x0000, r4
        mov     #0x0000, r5
        mov     #0x0000, r5
        mov     #0x0000, r5

test_jc_fwrd2:

        mov     #0x1000, r15

        /* -------------- TEST JUMP FOR ALL FLAG CONFIGURATIONS ------------ */

        mov     #0x0000, r2             ;# {V,N,Z,C} = 4'b0000
        mov     #0x1234, r4
        jc      test_jc_0
        mov     #0x0000, r4
test_jc_0:
        mov     #0x2000, r15

        mov     #0x0001, r2             ;# {V,N,Z,C} = 4'b0001
        mov     #0x1234, r4
        jc      test_jc_1
        mov     #0x0000, r4
test_jc_1:
        mov     #0x2001, r15

        mov     #0x0002, r2             ;# {V,N,Z,C} = 4'b0010
        mov     #0x1234, r4
        jc      test_jc_2
        mov     #0x0000, r4
test_jc_2:
        mov     #0x2002, r15

        mov     #0x0003, r2             ;# {V,N,Z,C} = 4'b0011
        mov     #0x1234, r4
        jc      test_jc_3
        mov     #0x0000, r4
test_jc_3:
        mov     #0x2003, r15

        mov     #0x0004, r2             ;# {V,N,Z,C} = 4'b0100
        mov     #0x1234, r4
        jc      test_jc_4
        mov     #0x0000, r4
test_jc_4:
        mov     #0x2004, r15

        mov     #0x0005, r2             ;# {V,N,Z,C} = 4'b0101
        mov     #0x1234, r4
        jc      test_jc_5
        mov     #0x0000, r4
test_jc_5:
        mov     #0x2005, r15

        mov     #0x0006, r2             ;# {V,N,Z,C} = 4'b0110
        mov     #0x1234, r4
        jc      test_jc_6
        mov     #0x0000, r4
test_jc_6:
        mov     #0x2006, r15

        mov     #0x0007, r2             ;# {V,N,Z,C} = 4'b0111
        mov     #0x1234, r4
        jc      test_jc_7
        mov     #0x0000, r4
test_jc_7:
        mov     #0x2007, r15

        mov     #0x0100, r2             ;# {V,N,Z,C} = 4'b1000
        mov     #0x1234, r4
        jc      test_jc_8
        mov     #0x0000, r4
test_jc_8:
        mov     #0x2008, r15

        mov     #0x0101, r2             ;# {V,N,Z,C} = 4'b1001
        mov     #0x1234, r4
        jc      test_jc_9
        mov     #0x0000, r4
test_jc_9:
        mov     #0x2009, r15

        mov     #0x0102, r2             ;# {V,N,Z,C} = 4'b1010
        mov     #0x1234, r4
        jc      test_jc_A
        mov     #0x0000, r4
test_jc_A:
        mov     #0x200A, r15

        mov     #0x0103, r2             ;# {V,N,Z,C} = 4'b1011
        mov     #0x1234, r4
        jc      test_jc_B
        mov     #0x0000, r4
test_jc_B:
        mov     #0x200B, r15

        mov     #0x0104, r2             ;# {V,N,Z,C} = 4'b1100
        mov     #0x1234, r4
        jc      test_jc_C
        mov     #0x0000, r4
test_jc_C:
        mov     #0x200C, r15

        mov     #0x0105, r2             ;# {V,N,Z,C} = 4'b1101
        mov     #0x1234, r4
        jc      test_jc_D
        mov     #0x0000, r4
test_jc_D:
        mov     #0x200D, r15

        mov     #0x0106, r2             ;# {V,N,Z,C} = 4'b1110
        mov     #0x1234, r4
        jc      test_jc_E
        mov     #0x0000, r4
test_jc_E:
        mov     #0x200E, r15

        mov     #0x0107, r2             ;# {V,N,Z,C} = 4'b1111
        mov     #0x1234, r4
        jc      test_jc_F
        mov     #0x0000, r4
test_jc_F:
        mov     #0x200F, r15


        /* ----------------------         END OF TEST        --------------- */
        mov     #0x5000, r15
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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.