URL
https://opencores.org/ocsvn/amber/amber/trunk
Subversion Repositories amber
[/] [amber/] [trunk/] [hw/] [tests/] [swp.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 swp and swpb //// //// 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:@ ---------------------@ swp r2, r2, [r0]@ ---------------------ldr r0, AdrData1mov r2, #2swp r2, r2, [r0]@ check the value written to memoryldr r3, Data1cmp r3, #2movne r10, #10bne testfail@ check the value read from memoryldr r4, Data4cmp r4, r2movne r10, #20bne testfail@ ---------------------@ swpb r2, r2, [r0]@ ---------------------ldr r0, AdrData2add r0, r0, #1ldr r2, Data3swpb r2, r2, [r0]@ check the value written to memoryldr r3, Data2ldr r4, Data5cmp r3, r4movne r10, #30bne testfail@ check the value read from to memorymov r5, #0xbbcmp r2, r5movne r10, #40bne testfail@ ---------------------@ Test flow control, skip@ ---------------------mov r7, #2mov r8, #3cmp r7, r8swpeq r2, r2, [r0]b check4@ these should never be executedb testfailb testfailcheck4:@ check that r2 did not changecmp r2, r5movne r10, #50bne testfail@ ---------------------@ Test flow control, skip first, execute second@ ---------------------ldr r9, AdrData6mov r7, #2mov r8, #3cmp r7, r8swpeq r2, r2, [r9]swpne r3, r3, [r9]b check5@ these should never be executedb testfailb testfailcheck5:@ check that r2 did not changecmp r2, r5movne r10, #60bne testfail@ check that r3 holds correct valueldr r8, Data7cmp r3, r8movne r10, #70bne testfail@ ------------------------------------------@ ------------------------------------------b testpasstestfail:ldr r11, AdrTestStatusstr r10, [r11]b testfailtestpass:ldr r11, AdrTestStatusmov r10, #17str r10, [r11]b testpass@ put this data section here so its reachable@ by the 8-bit immediate offset in LDRHData1: .word 0x12345678Data2: .word 0xffccbbaaData3: .word 0x01020304Data4: .word 0x12345678Data5: .word 0xffcc04aaData6: .word 0x33445566Data7: .word 0x33445566/* Write 17 to this address to generate a Test Passed message */AdrTestStatus: .word ADR_AMBER_TEST_STATUSAdrData1: .word Data1AdrData2: .word Data2AdrData3: .word Data3AdrData4: .word Data4AdrData5: .word Data5AdrData6: .word Data6/* ========================================================================= *//* ========================================================================= */
Go to most recent revision | Compare with Previous | Blame | View Log
