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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [fp/] [fp.S] - Diff between revs 233 and 458

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 233 Rev 458
Line 44... Line 44...
#include "board.h"
#include "board.h"
 
 
/* ----------------------------------------------------------------------------
/* ----------------------------------------------------------------------------
 * Coding conventions
 * Coding conventions
 *
 *
 * A simple rising stack is provided to starting at _stack and pointed to by
v * A simple rising stack is provided to starting at _stack and pointed to by
 * r1. r1 points to the next free word. Only 32-bit registers may be pushed
 * r1. r1 points to the next free word. Only 32-bit registers may be pushed
 * onto the stack.
 * onto the stack.
 *
 *
 * Temporary labels up to 49 are reserved for macros and subroutines. Each is
 * Temporary labels up to 49 are reserved for macros and subroutines. Each is
 * used only once in any macro or subroutine. You can get in a serious mess if
 * used only once in any macro or subroutine. You can get in a serious mess if
Line 65... Line 65...
 * Memory controller constants
 * Memory controller constants
 * ------------------------------------------------------------------------- */
 * ------------------------------------------------------------------------- */
 
 
#define MEM_RAM 0x00000000
#define MEM_RAM 0x00000000
 
 
#define MC_CSR          (0x00)
 
#define MC_POC          (0x04)
 
#define MC_BA_MASK      (0x08)
 
#define MC_CSC(i)       (0x10 + (i) * 8)
 
#define MC_TMS(i)       (0x14 + (i) * 8)
 
 
 
/* ----------------------------------------------------------------------------
/* ----------------------------------------------------------------------------
 * Floating point constants (IEEE 754)
 * Floating point constants (IEEE 754)
 *
 *
 * For the record, the single precision format has 1 sign bit, 8 exponent bits
 * For the record, the single precision format has 1 sign bit, 8 exponent bits
 * and 23 fraction bits.
 * and 23 fraction bits.
Line 354... Line 348...
 
 
/* ----------------------------------------------------------------------------
/* ----------------------------------------------------------------------------
 * reset exception
 * reset exception
 * ------------------------------------------------------------------------- */
 * ------------------------------------------------------------------------- */
        .section .except, "ax"
        .section .except, "ax"
        l.addi    r1,r0,0
 
 
 
        .section .text
 
        .org 0x100
        .org 0x100
_reset:
_reset:
        l.movhi r1,hi(_stack)           /* Set up the stack */
        l.movhi r1,hi(_stack)           /* Set up the stack */
        l.ori   r1,r1,lo(_stack)
        l.ori   r1,r1,lo(_stack)
 
 
        l.movhi r3,hi(_init_mc)         /* Code starts with MC setup */
        l.movhi r3,hi(start)            /* Jump to test start */
        l.ori   r3,r3,lo(_init_mc)
        l.ori   r3,r3,lo(start)
        l.jr    r3
        l.jr    r3
        l.nop
        l.nop
 
 
 
        .org 0x700
 
illegal_insn:
 
        l.nop
 
        .section .rodata                                                ;\
 
1:                                                                      ;\
 
        .string "Illegal instruction. Enable hardware FPU.\n"           ;\
 
                                                                        ;\
 
        .section .except,"ax"                                                   ;\
 
        l.movhi r3,hi(1b)                                               ;\
 
        l.ori   r3,r3,lo(1b)
 
        l.jal   _puts
 
        l.nop
 
 
 
        .section .rodata                                                ;\
 
1:                                                                      ;\
 
        .string "Exiting.\n"                                            ;\
 
                                                                        ;\
 
        .section .except,"ax"                                                   ;\
 
        l.movhi r3,hi(1b)                                               ;\
 
        l.ori   r3,r3,lo(1b)
 
        l.jal   _puts
 
        l.nop
 
 
 
        l.addi  r3,r0,1
 
        l.nop   NOP_EXIT
 
 
 
 
 
        .section .text
/* ----------------------------------------------------------------------------
/* ----------------------------------------------------------------------------
 * Subroutine to print out a string
 * Subroutine to print out a string
 *
 *
 * The string is followed by a newline
 * The string is followed by a newline
 *
 *
Line 490... Line 510...
 
 
        POP (r9)
        POP (r9)
        l.jr    r9
        l.jr    r9
 
 
/* ----------------------------------------------------------------------------
/* ----------------------------------------------------------------------------
 * Memory controller initialization initialization
 * Start of tests
 * ------------------------------------------------------------------------- */
 * ------------------------------------------------------------------------- */
_init_mc:
 
 
 
        l.movhi r3,hi(MC_BASE_ADDR)
 
        l.ori   r3,r3,lo(MC_BASE_ADDR)
 
 
 
        l.addi  r4,r3,MC_CSC(0)
start:
        l.movhi r5,hi(FLASH_BASE_ADDR)
 
        l.srai  r5,r5,6
 
        l.ori   r5,r5,0x0025
 
        l.sw    0(r4),r5
 
 
 
        l.addi  r4,r3,MC_TMS(0)
 
        l.movhi r5,hi(FLASH_TMS_VAL)
 
        l.ori   r5,r5,lo(FLASH_TMS_VAL)
 
        l.sw    0(r4),r5
 
 
 
        l.addi  r4,r3,MC_BA_MASK
 
        l.addi  r5,r0,MC_MASK_VAL
 
        l.sw    0(r4),r5
 
 
 
        l.addi  r4,r3,MC_CSR
 
        l.movhi r5,hi(MC_CSR_VAL)
 
        l.ori   r5,r5,lo(MC_CSR_VAL)
 
        l.sw    0(r4),r5
 
 
 
        l.addi  r4,r3,MC_TMS(1)
 
        l.movhi r5,hi(SDRAM_TMS_VAL)
 
        l.ori   r5,r5,lo(SDRAM_TMS_VAL)
 
        l.sw    0(r4),r5
 
 
 
        l.addi  r4,r3,MC_CSC(1)
 
        l.movhi r5,hi(SDRAM_BASE_ADDR)
 
        l.srai  r5,r5,6
 
        l.ori   r5,r5,0x0411
 
        l.sw    0(r4),r5
 
 
 
/* ----------------------------------------------------------------------------
/* ----------------------------------------------------------------------------
 * Test of single precision add: lf.add.s
 * Test of single precision add: lf.add.s
 * ------------------------------------------------------------------------- */
 * ------------------------------------------------------------------------- */
        .section .text
 
_add_s:
_add_s:
        LOAD_STR (r3, "lf.add.s\n")
        LOAD_STR (r3, "lf.add.s\n")
        l.jal   _puts
        l.jal   _puts
        l.nop
        l.nop
 
 

powered by: WebSVN 2.1.0

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