; --------------------------------------------------------------------------------
; @Title: Peripheral Simulation Demo for the TRACE32 Simulator
; @Description:
;   This demo shows how to simulate the memory aliasing of a configurable
;   physical memory range. Makefiles for other operating systems are
;   available in the same directory.
;   For more information about the peripheral simulation in the TRACE32
;   simulator please read pdf/simulator_api.pdf and pdf/simulator_api_lib.pdf
; @Keywords: API, Simulator
; @Board: TRACE32 Simulator
; @Author: HDA
; @Copyright: (C) 1989-2014 Lauterbach GmbH, licensed for use with TRACE32(R) only
; --------------------------------------------------------------------------------
; $Id: memaliasing.cmm 10928 2017-06-06 17:43:55Z hdammak $

  LOCAL &memaliasing_lib
  RESet
  SYStem.RESet
  SIM.UNLOAD
  SYStem.CPU CortexA15
  SYStem.UP

  IF OS.NAME()=="Windows"
  (
    IF SOFTWARE.64BIT()
      &memaliasing_lib="~~~~/memaliasing64.dll"
    ELSE
      &memaliasing_lib="~~~~/memaliasing32.dll"
  )
  ELSE
  (
    PRINT "Unsupported OS : Makefiles for other Operating Systems are available in the same directory"
    ENDDO
  )

; Load a DLL for memory aliasing simulation
  ;SIM.LOAD &memaliasing_lib <base_address> <size> <aliasing_address>
  SIM.LOAD &memaliasing_lib 0x800000000 0x7F000000 0x80000000
  Data.Set A:0x8:0x0++0xFF %Long 0xDEADBEAF

  WinCLEAR
  WinPOS 0.0 16.0 120. 10. 16. 1. W001
  Data.dump A:00:0x80000000++0xFF
 
  WinPOS 0.0 32.0 120. 10. 16. 1. W000
  Data.dump A:08:0x00000000++0xFF
 
  WinPOS 0.0 0.0 120. 10. 0. 0. W002
  AREA