URL
https://opencores.org/ocsvn/amber/amber/trunk
Subversion Repositories amber
[/] [amber/] [trunk/] [hw/] [tests/] [flow3.S] - Rev 63
Go to most recent revision | Compare with Previous | Blame | View Log
/*****************************************************************// //// Amber 2 Core Instruction Test //// //// This file is part of the Amber project //// http://www.opencores.org/project,amber //// //// Description //// Tests ldm where the pc is loaded which causes a jump. //// At the same time the mode is changed, This is repeated //// with the cache enabled. //// //// Author(s): //// - Conor Santifort, csantifort.amber@gmail.com //// ////////////////////////////////////////////////////////////////////// //// Copyright (C) 2010 Authors and OPENCORES.ORG //// //// 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, download it //// from http://www.opencores.org/lgpl.shtml //// //*****************************************************************/#include "amber_registers.h".section .text.globl mainmain:@ Run through the test 4 times@ 1 - cache off@ 2 - cache on but empty@ 3 - cache on and loaded@ 4 - same as 3mov r7, #401: mov r0, #0x1000ldr r6, =JumpHerebic r6, r6, #0x3orr r6, r6, #0x1 @ set the mode to jump tomov r2, #17mov r3, #46mov r4, #99mov r5, #123stm r0, {r2-r6}ldm r0, {r11-pc}^b testfailb testfailb testfailb testfailb testfailb testfailb testfailb testfailb testfailb testfailJumpHere:b 2fb testfailb testfailb testfail2:@ Check the mode is 0x1mov r0, pcand r0, r0, #0x3cmp r0, #0x1movne r10, #10bne testfail@ Switch back to supervisor modeteqp pc, #0x3@ Test that the instructions immediately@ following a non-executed ldr pc are executedmov r10, #20mov r0, #5cmp r0, #6ldreq pc, =testfail @ not executedteq r0, #5bne testfailb 3fb testfailb testfailb testfail3:@ Test that the instruction after two ldrs, where the second ldr depends on the first,@ is executed.mov r0, #5cmp r0, #6ldmeqia sp!, {r4,pc}ldr r2, Data1ldr r2, [r2]mov r0, #7cmp r0, #7movne r10, #30bne testfailcmp r2, #0xffmovne r10, #40bne testfail@ ---------------------@ Enable the cache@ ---------------------mvn r0, #0mcr 15, 0, r0, cr3, cr0, 0 @ cacheable areamov r0, #1mcr 15, 0, r0, cr2, cr0, 0 @ cache enablesubs r7, r7, #10bne 1bb testpassb testfailb testfailtestfail:ldr r11, AdrTestStatusstr r10, [r11]b testfailtestpass:ldr r11, AdrTestStatusmov r10, #17str r10, [r11]b testpass/* Write 17 to this address to generate a Test Passed message */AdrTestStatus: .word ADR_AMBER_TEST_STATUSData1: .word Data2Data2: .word 0xff/* ========================================================================= *//* ========================================================================= */
Go to most recent revision | Compare with Previous | Blame | View Log
