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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [sw/] [tests/] [or1200/] [sim/] [or1200-sf.S] - Diff between revs 619 and 672

Only display areas with differences | Details | Blame | View Log

Rev 619 Rev 672
/*
/*
        Basic l.sfxx comparison instruction tests.
        Basic l.sfxx comparison instruction tests.
        Does not cover set-flag-against-immediate
        Does not cover set-flag-against-immediate
        Julius Baxter, ORSoC AB, 
        Julius Baxter, ORSoC AB, 
*/
*/
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
////                                                              ////
////                                                              ////
//// Copyright (C) 2011 Authors and OPENCORES.ORG                 ////
//// Copyright (C) 2011 Authors and OPENCORES.ORG                 ////
////                                                              ////
////                                                              ////
//// This source file may be used and distributed without         ////
//// This source file may be used and distributed without         ////
//// restriction provided that this copyright statement is not    ////
//// restriction provided that this copyright statement is not    ////
//// removed from the file and that any derivative work contains  ////
//// removed from the file and that any derivative work contains  ////
//// the original copyright notice and the associated disclaimer. ////
//// the original copyright notice and the associated disclaimer. ////
////                                                              ////
////                                                              ////
//// This source file is free software; you can redistribute it   ////
//// This source file is free software; you can redistribute it   ////
//// and/or modify it under the terms of the GNU Lesser General   ////
//// and/or modify it under the terms of the GNU Lesser General   ////
//// Public License as published by the Free Software Foundation; ////
//// Public License as published by the Free Software Foundation; ////
//// either version 2.1 of the License, or (at your option) any   ////
//// either version 2.1 of the License, or (at your option) any   ////
//// later version.                                               ////
//// later version.                                               ////
////                                                              ////
////                                                              ////
//// This source is distributed in the hope that it will be       ////
//// This source is distributed in the hope that it will be       ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
//// PURPOSE.  See the GNU Lesser General Public License for more ////
//// PURPOSE.  See the GNU Lesser General Public License for more ////
//// details.                                                     ////
//// details.                                                     ////
////                                                              ////
////                                                              ////
//// You should have received a copy of the GNU Lesser General    ////
//// You should have received a copy of the GNU Lesser General    ////
//// Public License along with this source; if not, download it   ////
//// Public License along with this source; if not, download it   ////
//// from http://www.opencores.org/lgpl.shtml                     ////
//// from http://www.opencores.org/lgpl.shtml                     ////
////                                                              ////
////                                                              ////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
#include "spr-defs.h"
#include "spr-defs.h"
/* =================================================== [ exceptions ] === */
/* =================================================== [ exceptions ] === */
        .section .vectors, "ax"
        .section .vectors, "ax"
/* ---[ 0x100: RESET exception ]----------------------------------------- */
/* ---[ 0x100: RESET exception ]----------------------------------------- */
        .org 0x100
        .org 0x100
        l.movhi r0, 0
        l.movhi r0, 0
        /* Clear status register */
        /* Clear status register */
        l.ori r1, r0, SPR_SR_SM
        l.ori r1, r0, SPR_SR_SM
        l.mtspr r0, r1, SPR_SR
        l.mtspr r0, r1, SPR_SR
        /* Clear timer  */
        /* Clear timer  */
        l.mtspr r0, r0, SPR_TTMR
        l.mtspr r0, r0, SPR_TTMR
        /* Jump to program initialisation code */
        /* Jump to program initialisation code */
        .global _start
        .global _start
        l.movhi r4, hi(_start)
        l.movhi r4, hi(_start)
        l.ori r4, r4, lo(_start)
        l.ori r4, r4, lo(_start)
        l.jr    r4
        l.jr    r4
        l.nop
        l.nop
/* =================================================== [ text ] === */
/* =================================================== [ text ] === */
        .section .text
        .section .text
/* =================================================== [ start ] === */
/* =================================================== [ start ] === */
#define SHOULD_BE_SET   l.bnf   _fail ; \
#define SHOULD_BE_SET   l.bnf   _fail ; \
        l.nop 0
        l.nop 0
#define SHOULDNT_BE_SET l.bf    _fail ; \
#define SHOULDNT_BE_SET l.bf    _fail ; \
        l.nop 0
        l.nop 0
#define MOVE_TO_R4R5_AND_REPORT(a,b)    \
#define MOVE_TO_R4R5_AND_REPORT(a,b)    \
        l.movhi r3,hi(a)        ;       \
        l.movhi r3,hi(a)        ;       \
        l.ori   r3,r3,lo(a)     ;       \
        l.ori   r3,r3,lo(a)     ;       \
        l.nop   0x2             ;       \
        l.nop   0x2             ;       \
        l.or    r4,r3,r3        ;       \
        l.or    r4,r3,r3        ;       \
        l.movhi r3,hi(b)        ;       \
        l.movhi r3,hi(b)        ;       \
        l.ori   r3,r3,lo(b)     ;       \
        l.ori   r3,r3,lo(b)     ;       \
        l.nop   0x2             ;       \
        l.nop   0x2             ;       \
        l.or    r5,r3,r3
        l.or    r5,r3,r3
// Tests to check these values should be less than
// Tests to check these values should be less than
#define SHOULD_BE_LESS_THAN_SIGNED(a,b) \
#define SHOULD_BE_LESS_THAN_SIGNED(a,b) \
        MOVE_TO_R4R5_AND_REPORT(a,b) ;  \
        MOVE_TO_R4R5_AND_REPORT(a,b) ;  \
        l.sfeq  r4,r5           ;       \
        l.sfeq  r4,r5           ;       \
        SHOULDNT_BE_SET         ;       \
        SHOULDNT_BE_SET         ;       \
        l.sfne  r4,r5           ;       \
        l.sfne  r4,r5           ;       \
        SHOULD_BE_SET           ;       \
        SHOULD_BE_SET           ;       \
        l.sfgts r4,r5           ;       \
        l.sfgts r4,r5           ;       \
        SHOULDNT_BE_SET         ;       \
        SHOULDNT_BE_SET         ;       \
        l.sfges r4,r5           ;       \
        l.sfges r4,r5           ;       \
        SHOULDNT_BE_SET         ;       \
        SHOULDNT_BE_SET         ;       \
        l.sfles r4,r5           ;       \
        l.sfles r4,r5           ;       \
        SHOULD_BE_SET           ;       \
        SHOULD_BE_SET           ;       \
        l.sflts r4,r5           ;       \
        l.sflts r4,r5           ;       \
        SHOULD_BE_SET
        SHOULD_BE_SET
#define SHOULD_BE_GREATER_THAN_SIGNED(a,b)      \
#define SHOULD_BE_GREATER_THAN_SIGNED(a,b)      \
        MOVE_TO_R4R5_AND_REPORT(a,b) ;  \
        MOVE_TO_R4R5_AND_REPORT(a,b) ;  \
        l.sfeq  r4,r5           ;       \
        l.sfeq  r4,r5           ;       \
        SHOULDNT_BE_SET         ;       \
        SHOULDNT_BE_SET         ;       \
        l.sfne  r4,r5           ;       \
        l.sfne  r4,r5           ;       \
        SHOULD_BE_SET           ;       \
        SHOULD_BE_SET           ;       \
        l.sfgts r4,r5           ;       \
        l.sfgts r4,r5           ;       \
        SHOULD_BE_SET           ;       \
        SHOULD_BE_SET           ;       \
        l.sfges r4,r5           ;       \
        l.sfges r4,r5           ;       \
        SHOULD_BE_SET           ;       \
        SHOULD_BE_SET           ;       \
        l.sfles r4,r5           ;       \
        l.sfles r4,r5           ;       \
        SHOULDNT_BE_SET         ;       \
        SHOULDNT_BE_SET         ;       \
        l.sflts r4,r5           ;       \
        l.sflts r4,r5           ;       \
        SHOULDNT_BE_SET
        SHOULDNT_BE_SET
#define SHOULD_BE_LESS_THAN_UNSIGNED(a,b)       \
#define SHOULD_BE_LESS_THAN_UNSIGNED(a,b)       \
        MOVE_TO_R4R5_AND_REPORT(a,b) ;  \
        MOVE_TO_R4R5_AND_REPORT(a,b) ;  \
        l.sfeq  r4,r5           ;       \
        l.sfeq  r4,r5           ;       \
        SHOULDNT_BE_SET         ;       \
        SHOULDNT_BE_SET         ;       \
        l.sfne  r4,r5           ;       \
        l.sfne  r4,r5           ;       \
        SHOULD_BE_SET           ;       \
        SHOULD_BE_SET           ;       \
        l.sfgtu r4,r5           ;       \
        l.sfgtu r4,r5           ;       \
        SHOULDNT_BE_SET         ;       \
        SHOULDNT_BE_SET         ;       \
        l.sfgeu r4,r5           ;       \
        l.sfgeu r4,r5           ;       \
        SHOULDNT_BE_SET         ;       \
        SHOULDNT_BE_SET         ;       \
        l.sfleu r4,r5           ;       \
        l.sfleu r4,r5           ;       \
        SHOULD_BE_SET           ;       \
        SHOULD_BE_SET           ;       \
        l.sfltu r4,r5           ;       \
        l.sfltu r4,r5           ;       \
        SHOULD_BE_SET
        SHOULD_BE_SET
#define SHOULD_BE_GREATER_THAN_UNSIGNED(a,b)    \
#define SHOULD_BE_GREATER_THAN_UNSIGNED(a,b)    \
        MOVE_TO_R4R5_AND_REPORT(a,b) ;  \
        MOVE_TO_R4R5_AND_REPORT(a,b) ;  \
        l.sfeq  r4,r5           ;       \
        l.sfeq  r4,r5           ;       \
        SHOULDNT_BE_SET         ;       \
        SHOULDNT_BE_SET         ;       \
        l.sfne  r4,r5           ;       \
        l.sfne  r4,r5           ;       \
        SHOULD_BE_SET           ;       \
        SHOULD_BE_SET           ;       \
        l.sfgtu r4,r5           ;       \
        l.sfgtu r4,r5           ;       \
        SHOULD_BE_SET           ;       \
        SHOULD_BE_SET           ;       \
        l.sfgeu r4,r5           ;       \
        l.sfgeu r4,r5           ;       \
        SHOULD_BE_SET           ;       \
        SHOULD_BE_SET           ;       \
        l.sfleu r4,r5           ;       \
        l.sfleu r4,r5           ;       \
        SHOULDNT_BE_SET         ;       \
        SHOULDNT_BE_SET         ;       \
        l.sfltu r4,r5           ;       \
        l.sfltu r4,r5           ;       \
        SHOULDNT_BE_SET
        SHOULDNT_BE_SET
#define INT_MAX         2147483647      /*0x7fffffff*/
#define INT_MAX         2147483647      /*0x7fffffff*/
#define INT_MAX_MIN1    2147483646      /*0x7ffffffe*/
#define INT_MAX_MIN1    2147483646      /*0x7ffffffe*/
#define NEG_INT_MAX     -2147483648     /*0x80000000*/
#define NEG_INT_MAX     -2147483648     /*0x80000000*/
#define NEG_INT_MAX_PL1 -2147483647     /*0x80000001*/
#define NEG_INT_MAX_PL1 -2147483647     /*0x80000001*/
#define MIN1            -1              /*0xffffffff*/
#define MIN1            -1              /*0xffffffff*/
#define UINT_MAX        4294967295      /*0xffffffff*/
#define UINT_MAX        4294967295      /*0xffffffff*/
#define UINT_MAX_MIN1   4294967294      /*0xfffffffe*/
#define UINT_MAX_MIN1   4294967294      /*0xfffffffe*/
        .global _start
        .global _start
_start:
_start:
        /* Signed tests */
        /* Signed tests */
        SHOULD_BE_LESS_THAN_SIGNED(0,1)
        SHOULD_BE_LESS_THAN_SIGNED(0,1)
        SHOULD_BE_LESS_THAN_SIGNED(MIN1,0)
        SHOULD_BE_LESS_THAN_SIGNED(MIN1,0)
        SHOULD_BE_LESS_THAN_SIGNED(INT_MAX_MIN1,INT_MAX)
        SHOULD_BE_LESS_THAN_SIGNED(INT_MAX_MIN1,INT_MAX)
        SHOULD_BE_LESS_THAN_SIGNED(NEG_INT_MAX,INT_MAX)
        SHOULD_BE_LESS_THAN_SIGNED(NEG_INT_MAX,INT_MAX)
        SHOULD_BE_LESS_THAN_SIGNED(NEG_INT_MAX,INT_MAX_MIN1)
        SHOULD_BE_LESS_THAN_SIGNED(NEG_INT_MAX,INT_MAX_MIN1)
        SHOULD_BE_LESS_THAN_SIGNED(NEG_INT_MAX_PL1,INT_MAX)
        SHOULD_BE_LESS_THAN_SIGNED(NEG_INT_MAX_PL1,INT_MAX)
        SHOULD_BE_LESS_THAN_SIGNED(NEG_INT_MAX_PL1,INT_MAX_MIN1)
        SHOULD_BE_LESS_THAN_SIGNED(NEG_INT_MAX_PL1,INT_MAX_MIN1)
        SHOULD_BE_LESS_THAN_SIGNED(-7,-6)
        SHOULD_BE_LESS_THAN_SIGNED(-7,-6)
        SHOULD_BE_LESS_THAN_SIGNED(NEG_INT_MAX,NEG_INT_MAX_PL1)
        SHOULD_BE_LESS_THAN_SIGNED(NEG_INT_MAX,NEG_INT_MAX_PL1)
        SHOULD_BE_LESS_THAN_SIGNED(NEG_INT_MAX,MIN1)
        SHOULD_BE_LESS_THAN_SIGNED(NEG_INT_MAX,MIN1)
        SHOULD_BE_LESS_THAN_SIGNED(NEG_INT_MAX,0)
        SHOULD_BE_LESS_THAN_SIGNED(NEG_INT_MAX,0)
        SHOULD_BE_GREATER_THAN_SIGNED(1,0)
        SHOULD_BE_GREATER_THAN_SIGNED(1,0)
        SHOULD_BE_GREATER_THAN_SIGNED(0,MIN1)
        SHOULD_BE_GREATER_THAN_SIGNED(0,MIN1)
        SHOULD_BE_GREATER_THAN_SIGNED(INT_MAX,INT_MAX_MIN1)
        SHOULD_BE_GREATER_THAN_SIGNED(INT_MAX,INT_MAX_MIN1)
        SHOULD_BE_GREATER_THAN_SIGNED(INT_MAX,NEG_INT_MAX)
        SHOULD_BE_GREATER_THAN_SIGNED(INT_MAX,NEG_INT_MAX)
        SHOULD_BE_GREATER_THAN_SIGNED(INT_MAX_MIN1,NEG_INT_MAX)
        SHOULD_BE_GREATER_THAN_SIGNED(INT_MAX_MIN1,NEG_INT_MAX)
        SHOULD_BE_GREATER_THAN_SIGNED(INT_MAX,NEG_INT_MAX_PL1)
        SHOULD_BE_GREATER_THAN_SIGNED(INT_MAX,NEG_INT_MAX_PL1)
        SHOULD_BE_GREATER_THAN_SIGNED(INT_MAX_MIN1,NEG_INT_MAX_PL1)
        SHOULD_BE_GREATER_THAN_SIGNED(INT_MAX_MIN1,NEG_INT_MAX_PL1)
        SHOULD_BE_GREATER_THAN_SIGNED(-6,-7)
        SHOULD_BE_GREATER_THAN_SIGNED(-6,-7)
        SHOULD_BE_GREATER_THAN_SIGNED(NEG_INT_MAX_PL1,NEG_INT_MAX)
        SHOULD_BE_GREATER_THAN_SIGNED(NEG_INT_MAX_PL1,NEG_INT_MAX)
        SHOULD_BE_GREATER_THAN_SIGNED(MIN1,NEG_INT_MAX)
        SHOULD_BE_GREATER_THAN_SIGNED(MIN1,NEG_INT_MAX)
        SHOULD_BE_GREATER_THAN_SIGNED(0,NEG_INT_MAX)
        SHOULD_BE_GREATER_THAN_SIGNED(0,NEG_INT_MAX)
        /* Unsigned tests */
        /* Unsigned tests */
        SHOULD_BE_LESS_THAN_UNSIGNED(0,1)
        SHOULD_BE_LESS_THAN_UNSIGNED(0,1)
        SHOULD_BE_LESS_THAN_UNSIGNED(UINT_MAX_MIN1,UINT_MAX)
        SHOULD_BE_LESS_THAN_UNSIGNED(UINT_MAX_MIN1,UINT_MAX)
        SHOULD_BE_GREATER_THAN_UNSIGNED(1,0)
        SHOULD_BE_GREATER_THAN_UNSIGNED(1,0)
        SHOULD_BE_GREATER_THAN_UNSIGNED(UINT_MAX,UINT_MAX_MIN1)
        SHOULD_BE_GREATER_THAN_UNSIGNED(UINT_MAX,UINT_MAX_MIN1)
        SHOULD_BE_GREATER_THAN_UNSIGNED(UINT_MAX,0)
        SHOULD_BE_GREATER_THAN_UNSIGNED(UINT_MAX,0)
        SHOULD_BE_GREATER_THAN_UNSIGNED(0x80000001, 0x80000000)
        SHOULD_BE_GREATER_THAN_UNSIGNED(0x80000001, 0x80000000)
        SHOULD_BE_LESS_THAN_UNSIGNED(0x80000000, 0x80000001)
        SHOULD_BE_LESS_THAN_UNSIGNED(0x80000000, 0x80000001)
        SHOULD_BE_GREATER_THAN_UNSIGNED(0x80000000,0x7fffffff)
        SHOULD_BE_GREATER_THAN_UNSIGNED(0x80000000,0x7fffffff)
        SHOULD_BE_LESS_THAN_UNSIGNED(0x7fffffff, 0x80000000)
        SHOULD_BE_LESS_THAN_UNSIGNED(0x7fffffff, 0x80000000)
        SHOULD_BE_GREATER_THAN_UNSIGNED(0x7fffffff, 0x7ffffffe)
        SHOULD_BE_GREATER_THAN_UNSIGNED(0x7fffffff, 0x7ffffffe)
        SHOULD_BE_LESS_THAN_UNSIGNED(0x7ffffffe, 0x7fffffff)
        SHOULD_BE_LESS_THAN_UNSIGNED(0x7ffffffe, 0x7fffffff)
 
 
 
        SHOULD_BE_LESS_THAN_UNSIGNED(0x2024fae0, 0xfef03220)
 
 
_finish:
_finish:
        l.movhi r3, hi(0x8000000d)
        l.movhi r3, hi(0x8000000d)
        l.ori   r3, r3, lo(0x8000000d)
        l.ori   r3, r3, lo(0x8000000d)
        l.nop   0x2
        l.nop   0x2
        l.ori   r3, r0, 0
        l.ori   r3, r0, 0
        l.nop   0x1
        l.nop   0x1
_fail:
_fail:
        l.ori r3, r0, 0x1
        l.ori r3, r0, 0x1
        l.nop 0x1
        l.nop 0x1
 
 
 

powered by: WebSVN 2.1.0

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