URL
https://opencores.org/ocsvn/amber/amber/trunk
Subversion Repositories amber
[/] [amber/] [trunk/] [hw/] [tests/] [ethmac_mem.S] - Rev 66
Go to most recent revision | Compare with Previous | Blame | View Log
/*****************************************************************// //// Amber 2 System Ethernet MAC Test //// //// This file is part of the Amber project //// http://www.opencores.org/project,amber //// //// Description //// Tests wishbone access to the internal memory in the //// Ethernet MAC module. //// //// 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:@ Test reading of ethmac's internal BD memory@ 0x400 to 0x7ffldr r0, AdrEthMacMemBaseldr r1, Data0str r1, [r0], #4ldr r1, Data1str r1, [r0], #4ldr r1, Data2str r1, [r0], #4ldr r1, Data3str r1, [r0], #4@ Read back and check the 4 valuesldr r0, AdrEthMacMemBaseldr r2, [r0], #4ldr r3, Data0cmp r2, r3movne r10, #10bne testfailldr r2, [r0], #4ldr r3, Data1cmp r2, r3movne r10, #20bne testfailldr r2, [r0], #4ldr r3, Data2cmp r2, r3movne r10, #30bne testfailldr r2, [r0], #4ldr r3, Data3cmp r2, r3movne r10, #40bne testfail@ Write all locations from 0x400 to 0x7ff, with Data == Addressldr r0, AdrEthMacMemBaseadd r1, r0, #0x400mov r2, #01: str r2, [r0], #4cmp r0, r1beq checkemadd r2, r2, #4b 1bcheckem:@ Now read back all the locations, checking the valuesldr r0, AdrEthMacMemBasemov r2, #02: ldr r3, [r0], #4cmp r2, r3movne r10, r0subne r10, r10, #4bne testfailadd r2, r2, #4cmp r0, r1beq testpassb 2btestfail: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_STATUSAdrEthMacModer: .word ADR_ETHMAC_MODERAdrEthMacMIIModer: .word ADR_ETHMAC_MIIMODERAdrEthMacMIICommand: .word ADR_ETHMAC_MIICOMMANDAdrEthMacMIIAddress: .word ADR_ETHMAC_MIIADDRESSAdrEthMacMIITxData: .word ADR_ETHMAC_MIITXDATAAdrEthMacMIIRxData: .word ADR_ETHMAC_MIIRXDATAAdrEthMacMIIStatus: .word ADR_ETHMAC_MIISTATUSAdrEthMacMemBase: .word ADR_ETHMAC_BDBASEData0: .word 0xc0c0c0c0Data1: .word 0xff00ff00Data2: .word 0x12345678Data3: .word 0x77777777/* ========================================================================= *//* ========================================================================= */
Go to most recent revision | Compare with Previous | Blame | View Log
