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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [sw/] [tests/] [or1200/] [sim/] [or1200-ext.S] - Diff between revs 499 and 801

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

Rev 499 Rev 801
/*
/*
        OR1200 zero and sign extension instruction tests
        OR1200 zero and sign extension instruction tests
        Very basic, testing
        Very basic, testing
        Julius Baxter, ORSoC AB, julius.baxter@orsoc.se
        Julius Baxter, ORSoC AB, julius.baxter@orsoc.se
*/
*/
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
////                                                              ////
////                                                              ////
//// Copyright (C) 2010 Authors and OPENCORES.ORG                 ////
//// Copyright (C) 2010 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"
#include "board.h"
#include "board.h"
#include "or1200-defines.h"
#include "or1200-defines.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
        .org 0x600
        .org 0x600
        l.nop 0x1
        l.nop 0x1
/* ---[ 0x700: Illegal instruction exception ]-------------------------- */
/* ---[ 0x700: Illegal instruction exception ]-------------------------- */
        .org 0x700
        .org 0x700
#ifndef OR1200_IMPL_ALU_EXT
#ifndef OR1200_IMPL_ALU_EXT
        // No problem - instruction not supported
        // No problem - instruction not supported
        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
#else
#else
        l.ori   r3, r0, 1
        l.ori   r3, r0, 1
#endif
#endif
        l.nop   0x1
        l.nop   0x1
/* =================================================== [ text ] === */
/* =================================================== [ text ] === */
        .section .text
        .section .text
/* =================================================== [ start ] === */
/* =================================================== [ start ] === */
        .global _start
        .global _start
_start:
_start:
        // Kick off test
        // Kick off test
        l.jal   _main
        l.jal   _main
        l.nop
        l.nop
/* =================================================== [ main ] === */
/* =================================================== [ main ] === */
        .global _main
        .global _main
_main:
_main:
        // l.exth tests first
        // l.exth tests first
        l.ori   r4,r0,0xffff
        l.ori   r4,r0,0xffff
        l.ori   r5,r0,0x7fff
        l.ori   r5,r0,0x7fff
        l.exths r3,r4
        l.exths r3,r4
        l.movhi r8,0xffff
        l.movhi r8,0xffff
        l.ori   r8,r8,0xffff
        l.ori   r8,r8,0xffff
        l.nop   0x2
        l.nop   0x2
        l.sfne  r8,r3
        l.sfne  r8,r3
        l.bf    fail
        l.bf    fail
        l.nop
        l.nop
        l.ori   r8,r0,0xffff
        l.ori   r8,r0,0xffff
        l.exthz r3,r4
        l.exthz r3,r4
        l.nop   0x2
        l.nop   0x2
        l.sfne  r8,r3
        l.sfne  r8,r3
        l.bf    fail
        l.bf    fail
        l.nop
        l.nop
        l.exths r3,r5
        l.exths r3,r5
        l.nop   0x2
        l.nop   0x2
        l.sfne  r3,r5
        l.sfne  r3,r5
        l.bf    fail
        l.bf    fail
        l.nop
        l.nop
        l.exthz r3,r5
        l.exthz r3,r5
        l.nop   0x2
        l.nop   0x2
        l.sfne  r3,r5
        l.sfne  r3,r5
        l.bf    fail
        l.bf    fail
        l.nop
        l.nop
        // l.extb tests
        // l.extb tests
        l.ori   r4,r0,0x00ff
        l.ori   r4,r0,0x00ff
        l.ori   r5,r0,0x007f
        l.ori   r5,r0,0x007f
        l.extbs r3,r4
        l.extbs r3,r4
        l.nop   0x2
        l.nop   0x2
        l.movhi r8,0xffff
        l.movhi r8,0xffff
        l.ori   r8,r8,0xffff
        l.ori   r8,r8,0xffff
        l.sfne  r8,r3
        l.sfne  r8,r3
        l.bf    fail
        l.bf    fail
        l.nop
        l.nop
        l.ori   r8,r0,0x00ff
        l.ori   r8,r0,0x00ff
        l.extbz r3,r4
        l.extbz r3,r4
        l.nop   0x2
        l.nop   0x2
        l.sfne  r8,r3
        l.sfne  r8,r3
        l.bf    fail
        l.bf    fail
        l.nop
        l.nop
        l.extbs r3,r5
        l.extbs r3,r5
        l.nop   0x2
        l.nop   0x2
        l.sfne  r3,r5
        l.sfne  r3,r5
        l.bf    fail
        l.bf    fail
        l.nop
        l.nop
        l.extbz r3,r5
        l.extbz r3,r5
        l.nop   0x2
        l.nop   0x2
        l.sfne  r3,r5
        l.sfne  r3,r5
        l.bf    fail
        l.bf    fail
        l.nop
        l.nop
        // l.extw tests - shouldn't change anything
        // l.extw tests - shouldn't change anything
        l.movhi r4,0xffff
        l.movhi r4,0xffff
        l.ori   r4,r4,0xffff
        l.ori   r4,r4,0xffff
        l.extws r3,r4
        l.extws r3,r4
        l.nop   0x2
        l.nop   0x2
        l.sfne  r3,r4
        l.sfne  r3,r4
        l.bf    fail
        l.bf    fail
        l.nop
        l.nop
        l.extwz r3,r4
        l.extwz r3,r4
        l.nop   0x2
        l.nop   0x2
        l.sfne  r3,r4
        l.sfne  r3,r4
        l.bf    fail
        l.bf    fail
        l.nop
        l.nop
 
 
 
        l.movhi r4,0x7fff
 
        l.ori   r4,r4,0xffff
 
 
 
        l.extws r3,r4
 
 
 
        l.nop   0x2
 
 
 
        l.sfne  r3,r4
 
        l.bf    fail
 
        l.nop
 
 
 
        l.extwz r3,r4
 
 
 
        l.nop   0x2
 
 
 
        l.sfne  r3,r4
 
        l.bf    fail
 
        l.nop
 
 
 
 
        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, 1
        l.ori   r3, r0, 1
        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.