Datasheet

Writing ARMulator models
ARM DUI0058D Copyright © 1999-2001 ARM Limited. All rights reserved. 3-5
3.2 Writing a new peripheral model
This section contains the following subsections:
Using a sample model as a template
Return values
Initialization, finalization, and state macros on page 3-6
Registering your model on page 3-6.
3.2.1 Using a sample model as a template
To write a new model, the best procedure is to copy one of the supplied models and then
edit the copy. To do this:
1. Select which model is closest to the model you want to write. This might be, for
example, Timer.
2. Copy the source file, in this case
timer.c
, with a new name such as
mymodel.c
.
3. Copy the make subdirectory, in this case
timer.b
, with a corresponding new name,
in this case
mymodel.b
.
4. Find the
Makefile
for your model (see Location of files on page 3-2).
Load
Makefile
into a text editor and change all instances of
timer
to
mymodel
.
You can now edit
MyModel
.
3.2.2 Return values
A model must return one of the following states for memory accesses:
PERIP_OK
If the model is able to service the request.
PERIP_BUSY
If a memory access requires wait-states. A model must not return
this state to a debugger access.
PERIP_DABORT
If a peripheral asserts the DABORT signal on the bus.
PERIP_NODECODE
If the model has been called with an address which belongs
to it, but which has no meaning to it. The memory model handles
the call as a memory access.