OVP BHM and PPM API Function Reference

Imperas Software Limited
Imperas Buildings, North Weston, Thame, Oxfordshire, OX9 2HA, UK docs@imperas.com

Author: Version: Filename: Project: Last Saved: Keywords:

Imperas Software Limited 1.0.6 OVP_BHM_PPM_Function_Reference.doc OVP BHM and PPM API Functions Reference Thursday, 26 August 2010

© 2010 Imperas Software Limited www.OVPworld.org

Page 1 of 52

OVP BHM and PPM API Functions Reference

Copyright Notice
Copyright © 2010 Imperas Software Limited All rights reserved. This software and documentation contain information that is the property of Imperas Software Limited. The software and documentation are furnished under a license agreement and may be used or copied only in accordance with the terms of the license agreement. No part of the software and documentation may be reproduced, transmitted, or translated, in any form or by any means, electronic, mechanical, manual, optical, or otherwise, without prior written permission of Imperas Software Limited, or as expressly provided by the license agreement.

Right to Copy Documentation
The license agreement with Imperas permits licensee to make copies of the documentation for its internal use only. Each copy shall include all copyrights, trademarks, service marks, and proprietary rights notices, if any.

Destination Control Statement
All technical data contained in this publication is subject to the export control laws of the United States of America. Disclosure to nationals of other countries contrary to United States law is prohibited. It is the reader’s responsibility to determine the applicable regulations and to comply with them.

Disclaimer
IMPERAS SOFTWARE LIMITED, AND ITS LICENSORS MAKE NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

© 2010 Imperas Software Limited www.OVPworld.org

Page 2 of 52

OVP BHM and PPM API Functions Reference Table of Contents
1 2 Introduction......................................................................................................................................... 5 Behavioral Modeling (BHM).............................................................................................................. 5 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 3
BHMCREATETHREAD ................................................................................................................... 6 BHMDELETETHREAD .................................................................................................................... 8 BHMCREATEEVENT ...................................................................................................................... 9 BHMCREATENAMEDEVENT........................................................................................................ 10 BHMDELETEEVENT .................................................................................................................... 11 BHMWAITEVENT........................................................................................................................ 12 BHMTRIGGERAFTER ................................................................................................................... 13 BHMCANCELTRIGGER ................................................................................................................ 14 BHMGETSYSTEMEVENT ............................................................................................................. 15 BHMWAITDELAY ....................................................................................................................... 16 BHMGETCURRENTTIME()........................................................................................................... 17 BHMMESSAGE ............................................................................................................................ 17 BHMGETDIAGNOSTICLEVEL ...................................................................................................... 19 BHMSETDIAGNOSTICCB ............................................................................................................ 19 BHMPRINTF ................................................................................................................................ 20 BHMFINISH ................................................................................................................................. 20 BHMSTRINGATTRIBUTE ............................................................................................................. 21 BHMINTEGERATTRIBUTE ........................................................................................................... 21 BHMUNS64ATTRIBUTE .............................................................................................................. 22

Record and Replay............................................................................................................................ 22 3.1 3.2 3.3 3.4 3.5 3.6
BHMRECORDSTART .................................................................................................................... BHMRECORDEVENT ................................................................................................................... BHMRECORDFINISH ................................................................................................................... BHMREPLAYSTART .................................................................................................................... BHMREPLAYEVENT .................................................................................................................... CONTROLLING RECORD AND REPLAY .........................................................................................

23 23 24 24 25 26

4

Platform interaction (PPM) ............................................................................................................. 27 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 4.11 4.12 4.13 4.14 4.15 4.16 4.17 4.18 4.19 4.20
PPMOPENMASTERBUSPORT ....................................................................................................... PPMCHANGEREMOTELOWADDRESS .......................................................................................... PPMOPENADDRESSSPACE .......................................................................................................... PPMREADADDRESSSPACE .......................................................................................................... PPMWRITEADDRESSSPACE ........................................................................................................ PPMCLOSEADDRESSSPACE ........................................................................................................ PPMOPENSLAVEBUSPORT .......................................................................................................... PPMCREATESLAVEBUSPORT...................................................................................................... PPMMOVELOCALLOADDRESS.................................................................................................... PPMDELETELOCALBUSHANDLE ................................................................................................ PPMINSTALLREADCALLBACK .................................................................................................... PPMINSTALLWRITECALLBACK .................................................................................................. PPMOPENNETPORT .................................................................................................................... PPMWRITENET ........................................................................................................................... PPMREADNET ............................................................................................................................ PPMINSTALLNETCALLBACK....................................................................................................... PPMCREATEDYNAMICBRIDGE ................................................................................................... PPMDELETEDYNAMICBRIDGE .................................................................................................... PPMCREATEDYNAMICSLAVEPORT............................................................................................. PPMDELETEDYNAMICSLAVEPORT .............................................................................................

27 29 30 31 32 33 34 35 35 37 38 39 41 42 43 44 45 46 47 48

© 2010 Imperas Software Limited www.OVPworld.org

Page 3 of 52

OVP BHM and PPM API Functions Reference
5 Memory mapped registers................................................................................................................ 48 5.1 5.2 6
PPMCREATEREGISTER ................................................................................................................ PPMCREATEINTERNALREGISTER ................................................................................................

48 50

Direct Bus Access............................................................................................................................... 51 6.1 6.2
PPMACCESSEXTERNALBUS ........................................................................................................ PPMEXPOSELOCALBUS ..............................................................................................................

51 52

© 2010 Imperas Software Limited www.OVPworld.org

Page 4 of 52

OVP BHM and PPM API Functions Reference

1 Introduction
This is reference documentation for version 1.0.5 of the BHM and PPM run time function interface, defined in
ImpPublic/include/target/peripheral/ppm.h

and
ImpPublic/include/target/peripheral/bhm.h

The functions in this interface are used within code written and compiled for the Peripheral Simulation Environment (PSE).

2 Behavioral Modeling (BHM)
This section describes functions which affect the execution of peripheral model code, and its interaction with the simulator.

© 2010 Imperas Software Limited www.OVPworld.org

Page 5 of 52

typically used if several copies of the same thread are launched with different contexts.org Page 6 of 52 . // only required if you wish to delete the thread © 2010 Imperas Software Limited www. while(1) { bhmWaitDelay(1000*1000). Threads can be created or destroyed at any time. Therefore a thread’s main loop must include at least one wait. bhmThreadHandle bhmCreateThread( bhmCBThreadFunc cb. Note that the address of the TOP of the stack is passed to bhmCreateThread(). a thread will run to the exclusion of all other simulator activity until a wait of some kind is executed. Once started. thB. The return value is a handle to thread which may be used to delete it. // void *sp // ). Example #include “bhm.1 bhmCreateThread Prototype typedef void (*bhmCBThreadFunc)(void *user). char stackB[size]. } } void userInit(void) { struct myThreadContext contextA. // void *user.OVP BHM and PPM API Functions Reference 2. #define size (64*1024) char stackA[size]. A thread is given a name and can receive a user-defined value. string). bhmPrintf(“%s\n”. bhmWaitDelay().h” bhmThreadHandle thA. function which implements the thread user data passed to the thread thread name (used for debugging) address of the TOP of the stack Description This function creates a new thread. A thread requires a stack which must be allocated by the user. Calls which wait are: • • bhmWaitEvent(). // const char *name. void myThread(void *user) { Char *string = user.OVPworld.

”tick”. © 2010 Imperas Software Limited www. &stackA[size]). ”tock”.OVPworld.OVP BHM and PPM API Functions Reference struct myThreadContext contextB.org Page 7 of 52 . “threadB”. thB = bhmCreateThread(myThread. thA = bhmCreateThread(myThread. “threadA”. } Notes and Restrictions The stack should have sufficient space for that thread and any code it uses (libc can use a significant amount of stack). &stackB[size]).

2 bhmDeleteThread Prototype Bool bhmDeleteThread(bhmThreadHandle h). bhmWait(1000*1000*1000). bhmDeleteThread(th). In the latter case the deleted thread must (by definition) have been blocked by a call to bhmWaitEvent() or bhmWaitDelay(). “myThread”. &stack[size]).h” // embedded call made on move to control status register bhmThreadHandle th = bhmCreateThread(myThread.OVPworld. so the affect is as if the blocked call caused the thread to finish. Example #include “bhm.OVP BHM and PPM API Functions Reference 2. Description This function deletes an existing thread. NULL.org Page 8 of 52 . © 2010 Imperas Software Limited www. Notes and Restrictions bhmDeleteThread can be called from within its own thread (which has the same effect as returning from the thread’s user function) or from another thread or callback.

org Page 9 of 52 . Example #include “bhm.OVP BHM and PPM API Functions Reference 2. Notes and Restrictions None. Description This function creates an event object which can then be used by bhmWaitEvent(). bhmTriggerAfter() and bhmCancelTrigger().h” bhmEventHandle go_eh = bhmCreateEvent(). bhmTriggerEvent().3 bhmCreateEvent Prototype bhmEventHandle bhmCreateEvent(void). © 2010 Imperas Software Limited www.OVPworld.

bhmTriggerAfter() and bhmCancelTrigger(). Notes and Restrictions None. A named event is similar to an un-named event. Description This function creates an event object which can then be used by bhmWaitEvent(). © 2010 Imperas Software Limited www. bhmTriggerEvent(). Example #include “bhm. It should be used when the event might be meaningful to the user of the model.h” bhmEventHandle go_eh = bhmCreateEvent("startDMA". which can set trigger points on it. "A DMA transfer has started").OVP BHM and PPM API Functions Reference 2.org Page 10 of 52 .4 bhmCreateNamedEvent Prototype bhmEventHandle bhmCreateNamedEvent( const char *name. but is visible to the debugger.OVPworld. const char *description ).

the thread will restart. The return code from bhmWaitEvent will be BHM_RR_DELEVENT. Example #include “bhm.5 bhmDeleteEvent Prototype Bool bhmDeleteEvent(bhmEventHandle handle). Notes and Restrictions If an event is deleted when a thread is waiting for it. bhmDeleteEvent(evt). Description This function deletes an event.org Page 11 of 52 .OVP BHM and PPM API Functions Reference 2. © 2010 Imperas Software Limited www.h” bhmEventHandle evt = bhmCreateEvent().OVPworld.

} } Notes and Restrictions 1. This function should not be called from a net or bus callback (see PPM functions). Description The running thread stops until the event is triggered. void thread1(void *user) { while(1) { bhmWaitDelay(120 /*uS*/). Example bhmEventHandle ev1. © 2010 Imperas Software Limited www.OVP BHM and PPM API Functions Reference 2. bhmTriggerEvent(ev1). the event is deleted or the event handle is invalid (this return is immediate).6 bhmWaitEvent Prototype bhmRestartReason bhmWaitEvent(bhmEventHandle handle). } } void thread2(void *user) { while(1) { bhmWaitEvent(ev1).org Page 12 of 52 .OVPworld.

© 2010 Imperas Software Limited www. double delay). bhmTriggerAfter(ev1. 320uS etc.7 bhmTriggerAfter Prototype Bool bhmTriggerAfter(bhmEventHandle event.OVP BHM and PPM API Functions Reference 2. it will be replaced with the new one. If there is already a queued trigger. 220uS. Description bhmTriggerAfter returns immediately but ‘queues’ a future trigger on the stated event. Returns false if the handle was not valid. void thread1(void *user) { while(1) { bhmWaitDelay(100 /*uS*/). // will run at times 120uS.OVPworld. Example bhmEventHandle ev1. 20). This queued trigger may be cancelled before the delay expires. } } void thread2(void *user) { while(1) { bhmWaitEvent(ev1).org Page 13 of 52 . } } Notes and Restrictions None.

Returns false if the handle was invalid. if(somethingBadHappened()) { bhmCancelTrigger(ev1). 100). bhmWaitDelay(50).h” bhmEventHandle ev1. Description Cancels any waiting event. // might never run } } Notes and Restrictions None © 2010 Imperas Software Limited www.8 bhmCancelTrigger Prototype Bool bhmCancelTrigger(bhmEventHandle event).OVP BHM and PPM API Functions Reference 2. } } } void thread2(void *user) { while(1) { bhmWaitEvent(ev1).OVPworld.org Page 14 of 52 . Example #include “bhm. void thread1(void *user) { while(1) { bhmTriggerAfter(ev1.

bhmMessage(“I”. © 2010 Imperas Software Limited www. Description Returns a handle to a system event. i. System event types include BHM_SE_START_OF_SIMULATION BHM_SE_END_OF_SIMULATION Start of simulation occurs when all peripherals have executed their initialization code. bhmWaitEvent(end). Example #include “bhm.OVP BHM and PPM API Functions Reference 2. there has not been a fatal error. } Notes and Restrictions BHM_SE_START_OF_SIMULATION need be used only when it is required that all other peripherals have started first.h” int operationCount = 0.e. “Finished after %d operations”. Two peripherals waking on BHM_SE_START_OF_SIMULATION cannot rely on a particular order of execution.9 bhmGetSystemEvent Prototype bhmEventHandle bhmGetSystemEvent(bhmSystemEventType eventType).OVPworld. operationCount).org Page 15 of 52 . but no application processors have executed any instructions. …. main() { bhmEventHAndle end = bhmGetSystemEvent(BHM_SE_END_OF_SIMULATION). “MY_MODEL”. End of simulation occurs when the simulator is performing a normal end of simulation sequence.

Returns false if the request was unsuccessful.h” void thread1(void *user) { while(1) { bhmWaitDelay(50).org Page 16 of 52 . Description Pauses the thread for the given time. Should not be called from within a bus or net callback.10 bhmWaitDelay Prototype Bool bhmWaitDelay(double microseconds). bhmMessage(“I”. } } Notes and Restrictions 1. © 2010 Imperas Software Limited www.OVP BHM and PPM API Functions Reference 2. .OVPworld. . Example #include “bhm. “Starting…”). “MY_MODEL”. .

“F” Fatal: this will cause the simulator to exit after producing the message. Severity levels: “I” Information: nothing is wrong.OVPworld. const char *prefix. It should be a short string (without spaces) making the message easy to distinguish from other output. so is guaranteed to appear verbatim in the output stream.). 2.OVP BHM and PPM API Functions Reference 2. . Simulated time starts at zero each time a simulation begins and bears no relation to wallclock time...11 bhmGetCurrentTime() Prototype double bhmGetCurrentTime(void). Description Returns the current simulated time in microseconds. Prefix: The prefix string has no format characters. Description Interface to the simulator text output and log streams. bhmPrintf("The time is %0. Example #include “bhm..0f\n".12 bhmMessage Prototype void bhmMessage( const char *severity. bhmGetCurrentTime()).. © 2010 Imperas Software Limited www.. “E” Error: the simulation cannot proceed correctly. Format and varargs: conform to gnu libc printf.. “W” Warning: the simulation can continue normally. const char *format. In addition. Notes and Restrictions 1. .org Page 17 of 52 .h” . bhmMessage produces messages with the same format as simulator system messages. the programmer does not need to identify the particular instance. the instance name of the peripheral model is inserted into message so when multiple instances of the model are used.

“Hello world number %d”.OVPworld. To create tables and other formatted output. } Notes and Restrictions bhmMessage will insert a new-line at the end of each message.h” { bhmMessage(“W”. © 2010 Imperas Software Limited www.org Page 18 of 52 . number). “MY_PERIPH”.OVP BHM and PPM API Functions Reference Example #include “bhm. use bhmPrintf().

when registers are read or written. mode changes. diagnostic levels can be changed during a simulation. complete operations. Level 3 Detailed output.OVPworld. } int main() { bhmSetDiagnosticCB(setDiags). static void setDiags(Uns32 v) { diagLevel = v. To ensure interoperability and easy familiarization. Therefore the callback function should set the integer variable which is used to control diagnostic output Example #include “bhm. The simulator can set different levels for each instance of each model.OVP BHM and PPM API Functions Reference 2. Level 2 Comprehensive output. Diagnostic output is intended to help users of the model (model developers can add debug output to their model. Description Notifies the simulator that this function should be used to change the diagnostic level of the peripheral. when input nets change and when events are triggered. new models should conform to the following guidelines: PSE Diagnostics (bits 0-1) Level 0 No diagnostic output. Level 1 Diagnostic output System Diagnostics (bit 4) Level 1 The simulator logs when it interacts with the model.13 bhmGetDiagnosticLevel Superseded by bhmSetDiagnosticCB(). eg. which should be hidden when the model is published). etc. indicating how much diagnostic output the model should produce. Level 1 Brief messages during startup (and possibly shutdown) to indicate the correct installation of the model in the platform. PSE Semihost Diagnostics (bits 2-3) Level 0 No diagnostic output.14 bhmSetDiagnosticCB Prototype void bhmSetDiagnosticCB(bhmSetDiagnosticLevel cb). © 2010 Imperas Software Limited www.h” int diagLevel = 0. To limit the size of log files. 2.org Page 19 of 52 .

J. for(J=0. Description Terminate the simulation immediately.org Page 20 of 52 .h” { bhmMessage(“I”. “Starting up. 2.”). Description Send ‘raw’ characters to the text and log output streams. I < height.. “MY_PERIPHERAL”. “MY_PERIPH”.16 bhmFinish Prototype void bhmFinish(void). Normal shutdown procedures will be executed. This function should only be used in conjunction with bhmMessage when tabular or formatted output is required...h” { if(noMoreData()) { © 2010 Imperas Software Limited www. J++) { bhmPrintf(“ %-4s”. I++) { bhmPrintf(“|”). “Configuration:”). } } Notes and Restrictions None. 2. } } Notes and Restrictions Must be called before any diagnostic output is required. .). Should only be called once.OVP BHM and PPM API Functions Reference if (diagLevel > 0) { bhmMessage(“I”. J < width. config[I][J]). Example #include “bhm.15 bhmPrintf Prototype void bhmPrintf(const char *format.. for(I =0. Uns32 I. Example #include “bhm. Unconstrained use will result in simulation messages whose origin is hard to trace. } bhmPrintf(“|\n”).OVPworld.

. then in the model instance and sequentially up the platform hierarchy for an attribute of the given name. "MY_PERIPHERAL". otherwise the call returns 0. “Finishing. If the attribute is found. bhmWaitDelay(50). Example #include “bhm. Processing. up to a maximum of length characters and the call returns 1.”). } } Notes and Restrictions A call to bhmStringAttribute (or bhmIntegerAttribute) searches first in the model definition. otherwise the call returns 0. 2.OVP BHM and PPM API Functions Reference if (BHM_DIAG_LOW) bhmMessage(“I”. &buff. bhmFinish().org Page 21 of 52 . Uns32 length). If the attribute is found. "Missing vendor string attribute"). Description Read the value of a model integer attribute for this model instance. if (BHM_DIAG_LOW) bhmMessage(“I”. 2. char *string. “MY_MODEL”.h” { char buff[32]. sizeof(buff)) ) { bhmMessage("E". Example © 2010 Imperas Software Limited www. its value is placed in the memory pointed to by string. if ( !bhmStringAttribute("vendor".OVPworld. Uns32 *ptr). Description Read the value of a model string attribute for this model instance.17 bhmStringAttribute Prototype Uns32 bhmStringAttribute(const char *name.18 bhmIntegerAttribute Prototype Uns32 bhmIntegerAttribute(const char *name. } } Notes and Restrictions None.”). “MY_MODEL”. its value is placed in the memory pointed to by ptr and the call returns 1. “Data exhausted.

This makes impossible regression testing or reproduction of particular failures. a simulation might be affected by inputs which cannot be exactly reproduced in subsequent simulation sessions. the bhm API presents a simple interface to a record/replay mechanism. See bhmUns64Attribute for 64-bit numbers. Description Read the value of a model integer attribute for this model instance. if ( !bhmUns64Attribute("longID". "Missing chipID attribute"). its value is placed in the memory pointed to by ptr and the call returns 1.OVP BHM and PPM API Functions Reference #include “bhm. &longId) ) { bhmMessage("E". to start the recording. otherwise the call returns 0. 2. Overview During startup (normally in 'main') the model should call bhmRecordStart() to see if recording is required by the simulator and if so.h” { Uns32 chipId. if ( !bhmIntegerAttribute("chipID". "MY_PERIPHERAL". } } Notes and Restrictions A call to bhmUns64Attribute searches first in the model definition. It is the responsibility of the model writer to use this API if replay is required and to ensure that a model using replay does appear to the rest of the system to behave exactly as in the original simulation.g. "MY_PERIPHERAL". If the attribute is found. e. "Missing longID attribute"). through a real keyboard interface.h” { Uns64 longId. then in the model instance and sequentially up the platform hierarchy for an attribute of the given name. &chipId) ) { bhmMessage("E".org Page 22 of 52 .OVPworld. If recording is required. } } Notes and Restrictions A call to bhmIntegerAttribute (or bhmStringAttribute) searches first in the model definition. then in the model instance and sequentially up the platform hierarchy for an attribute of the given name. To overcome this problem. Example #include “bhm. 3 Record and Replay If a peripheral model communicates with the outside world.19 bhmUns64Attribute Prototype Uns32 bhmUns64Attribute(const char *name. Uns64 *ptr). bhmRecordEvent() should be called whenever the model changes state due to © 2010 Imperas Software Limited www.

3. The model should also call bhmReplayStart() to see if this is a replay session. Description Asks the simulator is recording is required. and if so. if ( reordingOn ) { . If this cannot be supported the model should raise an error if both modes are specified.OVPworld. a model could both replay from a previous log and simultaneously record a new log. Example #include “bhm. then act according to the event. } } Notes and Restrictions Must be called before any recordable events have occurred. Uns32 bytes. Description Records one event to the recording channel for this peripheral instance.2 bhmRecordEvent Prototype void bhmRecordEvent(Uns32 type. Note that an event contains a time-stamp. void *data). . a 'type' field which can be used to distinguish event types. Returns True if recording is required. prepares a recording channel for this model instance.1 bhmRecordStart Prototype Bool bhmRecordStart(void). Example #include “bhm. It is possible that (for testing)... If so.OVP BHM and PPM API Functions Reference external stimulus..h” { Bool recordingOn = bhmRecordStart(). The location of the log data is managed by the simulation environment. the model should use bhmReplayEvent to fetch each event..org Page 23 of 52 .. and a variable length data field (which can be zero)..h” © 2010 Imperas Software Limited www. 3.

3. } } Notes and Restrictions None.OVPworld. } } Notes and Restrictions None. Example #include “bhm. Causes the session to end if there is a problem locating the replay channel..3 bhmRecordFinish Prototype Bool bhmRecordFinish(void). 3. if ( reordingOn ) { bhmRecordEvent(MY_KEY_PRESS.4 bhmReplayStart Prototype Bool bhmReplayStart(void). &keyValue). Description Asks the simulator is replay is required..h” main() { Bool replay = bhmReplayStart(). Returns True if replay is required. Example #include “bhm. if(replay) { © 2010 Imperas Software Limited www. Description Close the recording channel for this peripheral instance.h” { bhmWaitEvent(bhmGetSystemEvent(BHM_SE_END_OF_SIMULATION)). sizeof(keyValue).OVP BHM and PPM API Functions Reference void keyPressed(Uns32 keyValue) { . opens a channel for this model instance. if ( reordingOn ) { bhmRecordFinish()..org Page 24 of 52 . and if so.

OVPworld...h” main() { Bool replay = bhmReplayStart(). } } Notes and Restrictions None... Uns32 event. 3. double now = bhmGetCurrentTime(). data).now. Uns32 *type.. or -1 if there are no more events. Description Fetch the next event from the replay channel for this peripheral instance. © 2010 Imperas Software Limited www.5 bhmReplayEvent Prototype Int32 bhmReplayEvent(double *time.. Example #include “bhm. which might be zero.. if (bytes < 0 { finishThisModel(). double wait = nextTime . } } } else { // normal behaviour . } break... &event.. Return the number of bytes of user data associated with this event. Uns8 data[128]. if (wait > 0) { bhmWaitDelay(wait).OVP BHM and PPM API Functions Reference // main loop which reads the replay channel. Uns32 bytes = bhmReplayEvent(&nextTime. keyWasPressed(keyValue). . } switch(event) { case MY_KEY_PRESS: Uns32 keyValue = (Uns32)data.. } else { // normal behaviour .org Page 25 of 52 . } } Notes and Restrictions It is the user's responsibility to ensure there is sufficient space for the user-data.. void *data). if(replay) { while(1) { double nextTime. .

6 Controlling record and replay If you are using OVPsim. recording is turned on from the command line: cmd> explorer \ .org Page 26 of 52 . See OVPsim and CPUmanager User Guide for the definition of functions in this example: #include "icm/icmCpuManager.. getMyReplayFile()). "replay".OVPworld. atts. psePath. \ © 2010 Imperas Software Limited www.. \ --modelreplaydir <directory> . If you are using Explorer.. } icmPseP myPSE = icmNewPSE("pse1".OVP BHM and PPM API Functions Reference 3.. \ <directory> refers to a directory (folder) which will be created if it does not exist and in which the logged events will be stored.. Explorer tags each file in the directory so it can check that the files are valid and that they match the platform.. a directory (folder) is specified which contains pre-recorded events: cmd> explorer \ . It is usual to set record or replay for all peripherals or no peripherals so that the whole platform behaves consistently.. \ --modelrecorddir <directory> . if(replaymode) { icmAddStringAttr(atts.. 0..h" icmAttrListP atts = icmNewAttrList(). 0).. Replay is similar.. record or replay is turned on by defining the platform attributes "record" or "replay" on each peripheral instance that requires this behaviour..

the name of a master port in the peripheral model.1 ppmOpenMasterBusPort Prototype ppmExternalBusHandle ppmOpenMasterBusPort( char *busPortName. 4. Sizeof(masterRegion). nets and netports. Notes and Restrictions 1. When a bus master port has been opened. sizeof(masterRegion)).h” Uns8 masterRegion[1024]. bus-ports. Description Create a bus bridge from the PSE’s virtual address space to a simulated bus in the platform. reads and writes by the peripheral will be mapped to the simulated bus.OVP BHM and PPM API Functions Reference 4 Platform interaction (PPM) PPM function provide access to the platform hardware. Example #include “ppm. localLoAddress and sizeInBytes specify the connected region in the PSE’s address space. buses. Uns64 sizeInBytes. The local region cannot be mapped more than once.OVPworld. volatile void *localLoAddress. which was connected to a bus during platform construction. 0xFF. remoteLoAddress specifies the address on the simulated bus that will be accessed from the first address in the connected region. // This will fill with FFs the region 0x80000000 to 0x800003FF // on the bus connwected to ‘portA’ memset(masterRegion. Connection is by busPortName . Returns a handle to the mapped region so it may be moved or unmapped later. 0x80000000 ). { ppmExternalBusHandle h = ppmOpenMasterBusPort( “portA”.org Page 27 of 52 . © 2010 Imperas Software Limited www. SimAddr remoteLoAddress ). &masterRegion[0]. } // Local region to be mapped.

© 2010 Imperas Software Limited www. using memset) but cannot be accounted by bus traffic analysis tools or by simulation scheduling algorithms which take account of bus traffic. To simulate discrete peripheral memory cycles.OVP BHM and PPM API Functions Reference 2. use ppmOpenAddressSpace.OVPworld.org Page 28 of 52 . Reads and writes will be efficiently executed (as in the example.

0x80000000 ).h” Uns8 masterRegion[1024]. 0xFF. SimAddr remoteLoAddress ). // This will fill with FFs the region 0x80000000 to 0x800003FF // on the bus connected to ‘portA’ memset(masterRegion.OVPworld. { ppmExternalBusHandle h = ppmOpenMasterBusPort( “portA”.2 ppmChangeRemoteLowAddress Prototype Bool ppmChangeRemoteLoAddress( ppmExternalBusHandle h. } // Local region to be mapped. Notes and Restrictions None. ppmChangeRemoteLoAddress(h. sizeof(masterRegion)). © 2010 Imperas Software Limited www. Sizeof(masterRegion). sizeof(masterRegion)). Description Changes the remote address of an existing window. // This will fill with FFs the region 0x90000000 to 0x900003FF memset(masterRegion. 0xFF. 0x90000000). Returns False if the operation fails. Example #include “ppm.org Page 29 of 52 .OVP BHM and PPM API Functions Reference 4. &masterRegion[0].

© 2010 Imperas Software Limited www. buf). ppmCloseAddressSpace(h).OVPworld. 0x90000000. buf). 0x80000000. Example #include “ppm.OVP BHM and PPM API Functions Reference 4.org Page 30 of 52 . if(!h) { // error handling } Uns8 buf[4]. Returns 0 if the port does not exist. Returns a handle to an address space which may be used to read and write directly to that space.h” { ppmAddressHandle h = ppltOpenAddressSpace(“portA”). sizeof(buf). Description Procedural access to simulated buses. ppmReadAddressSpace(h.3 ppmOpenAddressSpace Prototype ppmAddressSpaceHandle ppmOpenAddressSpace(char *busPortName). } Notes and Restrictions None. ppmWriteAddressSpace(h. sizeof(buf).

4 ppmReadAddressSpace Prototype Bool ppmReadAddressSpace( ppmAddressSpaceHandle Uns64 Uns32 void ).0x90000003 // on bus connected to portA ppmReadAddressSpace(h. Returns False if the operation fails. Example #include “ppm.OVP BHM and PPM API Functions Reference 4.0x80000003 // to 0x90000000 . 0x90000000. address. buf). sizeof(buf). 0x80000000. Uns8 buf[4]. sizeof(buf). handle.OVPworld. *data Description Atomic read of data from an address space into a local buffer. } Notes and Restrictions None. // copy 4 bytes from 0x80000000 .org Page 31 of 52 . bytes. ppmWriteAddressSpace(h. © 2010 Imperas Software Limited www.h” { ppmAddressHandle h = ppltOpenAddressSapce(“portA”). buf). ppmCloseAddressSpace(h).

Example #include “ppm.OVP BHM and PPM API Functions Reference 4. 0x80000000.h” { ppmAddressHandle h = ppltOpenAddressSapce(“portA”). Returns False if the operation fails. handle. 0x90000000.5 ppmWriteAddressSpace Prototype Bool ppmWriteAddressSpace( ppmAddressSpaceHandle Uns64 Uns32 void ).org Page 32 of 52 . sizeof(buf). // copy 4 bytes from 0x80000000 . buf). address.0x80000003 // to 0x90000000 . Uns8 buf[4].OVPworld. buf). sizeof(buf). bytes. © 2010 Imperas Software Limited www. ppmCloseAddressSpace(h).0x90000003 // on bus connected to portA ppmReadAddressSpace(h. ppmWriteAddressSpace(h. *data Description Atomic write of data to an address space from a local buffer. } Notes and Restrictions None.

Description Close an address space.h” { ppmAddressHandle h = ppltOpenAddressSapce(“portA”).org Page 33 of 52 . 0x80000000. Uns8 buf[4]. Returns False if the operation fails. sizeof(buf). buf).OVPworld.6 ppmCloseAddressSpace Prototype Bool ppmCloseAddressSpace(ppmAddressSpaceHandle h). Example #include “ppm. ppmWriteAddressSpace(h. buf). 0x90000000. © 2010 Imperas Software Limited www. sizeof(buf). ppmReadAddressSpace(h. } Notes and Restrictions None. ppmCloseAddressSpace(h).OVP BHM and PPM API Functions Reference 4.

sizeof(rtcRam)).OVP BHM and PPM API Functions Reference 4. void *localAddress. } } } } } Notes and Restrictions The same area of memory can be exposed through more than one port.7 ppmOpenSlaveBusPort Prototype ppmLocalBusHandle ppmOpenSlaveBusPort( const char *portName. Description Expose a region in the PSE’s address space to reads and writes from a simulated bus. if(++rtcRam[SECS] == 60) { rtcRam[SECS] = 0. ppmLocalBusHandle h = ppmOpenSlaveBusPort(“p1”. © 2010 Imperas Software Limited www.h” #include “bhm.org Page 34 of 52 . if(++rtcRam[HRS] == 24) { rtcRam[HRS] = 0. Uns64 sizeInBytes ).h” { Uns8 rtcRam[32]. Returns 0 if the operation fails. creating dual or multiple ported memories. Example #include “ppm.OVPworld.. &rtcRam[0]. The local region effectively becomes RAM in the simulated system at the addresses specified in the construction of the port connection. while(1) { bhmWaitDelay(1000 * 1000). if(++rtcRam[MINS] == 60) { rtcRam[MINS] = 0.

.). Example #include “ppm. See ppmCreateRegister 4. 24). This function generally supersedes ppmOpenSlaveBusPort.h” #include “bhm.. Uns64 sizeInBytes ). removing the need to allocate the window before exposing it....h” { void *regPort = ppmCreateSlaveBusPort("regPort".. Use ppmOpenSlaveBusPort is these facilities are required. } 4... ppmCreateRegister("reg1". Example #include “ppm. 20. 0.. Description Move the exposed region in the PSE’s address space.). regPort.....h” #include “bhm.9 ppmMoveLocalLoAddress Prototype Bool ppmMoveLocalLoAddress( ppmLocalBusHandle h. void *localAddress )... regPort.. .h” { © 2010 Imperas Software Limited www. 4.... Returns False if the operation fails..OVPworld..OVP BHM and PPM API Functions Reference 4.. regPort.. ppmCreateRegister("reg6"...8 ppmCreateSlaveBusPort Prototype void *ppmCreateSlaveBusPort( const char *portName.. 4. . Description Allocate a window of this many bytes and expose it to the bus connected to the named slave port.. ppmCreateRegister("reg2".. It is typically used in conjunction with ppmCreateRegister to create a set of memory-mapped registers which are accessible from a particular platform bus. .org Page 35 of 52 .). "status reg". 4. Notes and Restrictions This variant does not allow the moving (remapping) or deletion of the slave port.. "control reg". "data reg".

&rtcRam[0]. } } Notes and Restrictions None. bhmWaitDelay(1000 * 1000). &backupRam[0]). if(backupMode()) { // now backupRam is exposed instead of rtcRam ppmMoveLocalLoAddress(h. Uns8 backupRam[32].OVPworld. © 2010 Imperas Software Limited www. sizeof(rtcRam)).org Page 36 of 52 . ppmLocalBusHandle h = ppmOpenSlaveBusPort(“p1”.OVP BHM and PPM API Functions Reference Uns8 rtcRam[32].

Description Delete a local mapped region. Example #include “ppm. } Notes and Restrictions None © 2010 Imperas Software Limited www.h” { Uns8 rtcRam[32]. ppmDeleteLocalBusHandle(h).OVP BHM and PPM API Functions Reference 4.org Page 37 of 52 . . Returns False if the operation fails. ppmLocalBusHandle h = ppmOpenSlaveBusPort(“p1”.10 ppmDeleteLocalBusHandle Prototype Bool ppmDeleteLocalBusHandle(ppmLocalBusHandle h). &rtcRam[0]... sizeof(rtcRam)).OVPworld.

case 2: return calcR2(). registers. “Only byte-wide access supported”). Uns32 bytes ). void *user..OVPworld. } } . Installing the value NULL removes the callback. NULL. The callback should not call bhmWaitEvent() or bhmWaitDelay().org Page 38 of 52 . Uns32 bytes. a fatal recursion will occur. Only one read callback should be installed on a region. Uns32 bytes. sizeof(registers)). registers. Notes and Restrictions 1. If the callback reads from it’s own sensitized region. sizeof(registers)). sizeof(registers)). “MY_PERIPH”. © 2010 Imperas Software Limited www. NULL. static Uns32 readReg(void *addr.. void ppmInstallReadCallback( ppmCBReadFunc cb. } the user function user defined data which will be passed to the callback. } Uns32 offset = (Uns8*)addr – registers.11 ppmInstallReadCallback Prototype typedef Uns32(*ppmCBReadFunc)(void *addr. base of the sensitized region size of the sensitized region. void *user) { If(bytes != 1) { bmhMessage(“F”.OVP BHM and PPM API Functions Reference 4. 3. Description Cause a user defined function to be called when a simulated processor or PSE reads from the specified region. registers. 2. void *user). default: return calcR3(). case 1: return calcR1().h” static Uns8 registers[4]. switch(offset){ case 0: return calcR0(). Arguments: cb user lo bytes Example #include “ppm. ppmInstallReadCallback(readReg. ppmInstallWriteCallback(writeReg. void *lo.{ ppmOpenSlaveBusPort(“portA”.

sizeof(registers)). Unss32 data). Uns32 bytes ). registers. Uns32 bytes. updateState(). } } . ppmInstallWriteCallback(writeReg. case 2: R2 = data. switch(offset){ case 0: R0 = data. void ppmInstallWriteCallback( ppmCBWriteFunc cb.h” static Uns8 registers[4]. updateState(). NULL.{ ppmOpenSlaveBusPort(“portA”. Description Cause a user defined function to be called when a simulated processor or PSE writes to the specified region. updateState(). static void writeReg(void *addr. case 1: R1 = data. registers. sizeof(registers)).OVP BHM and PPM API Functions Reference 4.. void *lo. Arguments: cb user lo bytes Example #include “ppm. void *user. } Uns32 offset = (Uns8*)addr – registers. Uns32 bytes. void *user. “MY_PERIPH”. void *user..OVPworld. break. sizeof(registers)). registers.12 ppmInstallWriteCallback Prototype typedef void(*ppmCBWriteFunc)(void *addr. break. NULL. break. break. base of the sensitized region size of the sensitized region. } the user function user defined data which will be passed to the callback. Uns32 data) { If(bytes != 1) { bmhMessage(“F”. updateState(). “Only byte-wide access supported”).org Page 39 of 52 . default: R3 = data. ppmInstallReadCallback(readReg. © 2010 Imperas Software Limited www.

Only one write callback can be installed on a region. a fatal recursion will occur. Subsequent calls will replace the original callback.OVPworld.org Page 40 of 52 . 2. © 2010 Imperas Software Limited www.OVP BHM and PPM API Functions Reference Notes and Restrictions 1. 3. Installing the value NULL removes the last callback. The callback should not call bhmWaitEvent() or bhmWaitDelay(). If the callback writes to it’s own sensitized region.

Returns a handle to the net.OVPworld. Description Makes a connection to the net connected to the given net port. it can mean whatever the user wishes. } void lowerInt(void) { ppmWriteNet(h.org Page 41 of 52 .13 ppmOpenNetPort Prototype ppmNetHandle ppmOpenNetPort(const char *portName). A net value is a 32-bit integer. a net takes the last written value. A net is a means of connecting a function call in one model (the net driver) to a function call-back in one or more other models (the receivers). but typically takes the values zero or non-zero to mean logic 0 or 1. The net does not model contention. 0). Example #include “ppm. 1). } © 2010 Imperas Software Limited www. Writing a net with the same value will cause call-backs to occur. void raiseInt(void) { ppmWriteNet(h.OVP BHM and PPM API Functions Reference 4.h” ppmNetHandle h = ppmOpenNetPort("int2").

org Page 42 of 52 . © 2010 Imperas Software Limited www.14 ppmWriteNet Prototype void ppmWriteNet(ppmNetHandle handle.OVP BHM and PPM API Functions Reference 4. } void lowerInt(void) { ppmWriteNet(h. 1). 0). Example #include “ppm. Any other connected port will cause its net callbacks to occur. } Notes and Restrictions 1. ppmNetValue value). Description Propagate a value to all ports connected to the given net. void raiseInt(void) { ppmWriteNet(h.OVPworld.h” ppmNetHandle h = ppmOpenNetPort("int2"). the net takes the last value written. Care should be taken if ppmWriteNet() is called from a net callback. There is no simulation of net contention. A cyclic net topology in the platform will cause a fatal recursion. 2.

OVPworld.OVP BHM and PPM API Functions Reference 4.h” { ppmNetHandle h = ppmOpenNetPort("int2").15 ppmReadNet Prototype ppmNetValue ppmReadNet(ppmNetHandle handle). "Net 'int2' changed").h” #include “bhm. © 2010 Imperas Software Limited www. } ppmNetValue old = 0. void checkNet(void) { ppmNetValue new = ppmReadNet(h). } } Notes and Restrictions None.org Page 43 of 52 . old = new. "NY_PERIPHERAL". Description Returns the last value written to the net. if (new != olf) { bhmMessage("I". Example #include “ppm.

netChanged. ppmCBNetFunc cb.h” #include “bhm.org Page 44 of 52 . "NY_PERIPHERAL". The function will be called when any device writes a value to the net (even if the new value is same as the current value).{ ppmNetHandle h = ppmOpenNetPort("int2").OVP BHM and PPM API Functions Reference 4. The callback should not call bhmWaitEvent() or bhmWaitDelay(). Description Install a function callback on a net.. ppmInstallNetCallback(h..h” ppmNetValue old = 0.16 ppmInstallNetCallback Prototype typedef void (*ppmCBNetFunc)(ppmNetValue value. Example #include “ppm. } Notes and Restrictions 1. © 2010 Imperas Software Limited www. void ppmInstallNetCallback( ppmNetHandle handle.OVPworld. void *userData) { if (new != olf) { bhmMessage("I". } } . void netChanged(ppmNetValue new. old = new. "Net 'int2' changed"). void *userData). void *userData ). 0).

{ ppmCreateDynamicBridge( "sp1".17 ppmCreateDynamicBridge Prototype Bool ppmCreateDynamicBridge( const char *slavePort. © 2010 Imperas Software Limited www. Example #include "ppm. 2.h" .. 0x100). starting at address masterPortLoAddress. resulting in shared or 'dual ported' regions. } Notes and Restrictions 1.OVP BHM and PPM API Functions Reference 4. 0x1000.org Page 45 of 52 .OVPworld. The region formed by windowSizeInBytes starting at masterPortLoAddress can overlap other master regions. "mp1". The region formed by windowSizeInBytes starting at slavePortLoAddress must not overlap any other static or dynamic decoded region on the connected bus. Uns64 windowSizeInBytes. SimAddr masterPortLoAddress ). Description Create a region of windowSizeInBytes starting at slavePortLoAddress on the bus connected to slavePort. const char *masterPort.. 0x40000000. Reads or writes by bus masters on this bus to this region will be mapped to the bus connected to masterPort. SimAddr slavePortLoAddress.

} . 0x100). 3. Do not attempt to un-map a region created by other means.OVPworld.{ ppmCreateDynamicBridge( "sp1". 0x1000. "mp1".. Reads or writes by bus masters on this bus to this region will be no longer mapped to another bus. Only use this to remove a complete region created by ppmCreateDynamicBridge. 0x40000000.OVP BHM and PPM API Functions Reference 4.. Do not attempt to split a region by un-mapping part of an existing region. 0x1000).org Page 46 of 52 . Example #include "ppm. } Notes and Restrictions 1. Uns64 windowSizeInBytes ).{ ppmDeleteDynamicBridge( "sp1". 2. Description Delete a previously constructed Dynamic Bridge of windowSizeInBytes starting at slavePortLoAddress on the bus connected to slavePort.18 ppmDeleteDynamicBridge Prototype void ppmDeleteDynamicBridge( const char *slavePort.h" . 0x40000000. © 2010 Imperas Software Limited www.. SimAddr slavePortLoAddress..

// area to be read/written const char *portName = "dp1". loAddr. remappedRegion. to give dual port behaviour or to model folding caused by (for example) incomplete address decoding. More than one mapping can be made onto the local region.OVPworld. // remember port addr ppmCreateDynamicSlaveBusPort( portName.19 ppmCreateDynamicSlavePort Prototype void ppmCreateDynamicSlavePort( const char *slavePort. // set the initial port address Notes and Restrictions 1. Uns64 sizeInBytes. static SimAddr loAddr = initialAddress(). Reads or writes by bus masters on the remote bus will be mapped to the local region. Description Expose the local region localLowAddress of size sizeInBytes starting at slavePortLoAddress to the remote bus connected to slavePort.OVP BHM and PPM API Functions Reference 4. void *localLowAddress ). sizeInBytes ).h" unsigned char remappedRegion[sizeInBytes]. © 2010 Imperas Software Limited www. Example #include "ppm.org Page 47 of 52 . SimAddr slavePortLoAddress. Do not overlap the remote region with any other static or dynamically mapped devices. 2.

loAddr. writes of the same value will be optimised away Description © 2010 Imperas Software Limited www.h" unsigned char remappedRegion[sizeInBytes]. viewCB. ppmDeleteDynamicSlavePort( portName. const char *description. writeCB. void *base. loAddr.OVP BHM and PPM API Functions Reference 4. static SimAddr loAddr = initialAddress(). remappedRegion. // remember port addr ppmCreateDynamicSlaveBusPort( portName. Uns64 sizeInBytes ). sizeInBytes ).20 ppmDeleteDynamicSlavePort Prototype void ppmCreateDynamicSlavePort( const char *slavePort. bytes. Uns32 Uns64 ppmCBReadFunc ppmCBWriteFunc ppmCBviewFunc void Bool ). // set the initial port address // remove the old mapping Notes and Restrictions 1.org Page 48 of 52 .OVPworld. // area to be read/written const char *portName = "dp1". sizeInBytes ). SimAddr slavePortLoAddress. 5 Memory mapped registers 5. Do not use this function to remove any other kind of mapped region. Description Remove a mapping that was created using ppmCreateDynamicSlavePort. offset. if false. *userData isVolatile // // // // // // // // // // // // // name of register to appear in the debugger base of local window (returned by ppmCreateSlaveBusPort) from base of window size of this register called by a bus read called by a bus write called by debugger to non-destructively fetch the current value will be passed to the 3 callbacks. Example #include "ppm. readCB.1 ppmCreateRegister Prototype void *ppmCreateRegister( const char *name.

} static PPM_WRITE_CB(writeCB) { reg1 |= data. eg. The debugger can view the register without changing its value (which might occur if the register is read by a regular bus access. 4. It is accessed by a bus access of the correct size. ppmCreateRegister( "reg1". The register has debugger trigger-events associated with bus reads and writes.OVP BHM and PPM API Functions Reference Similar to ppmInstallReadCallback and ppmInstallWriteCallback. 4. readCB. writeCB. 24).h” static PPM_READ_CB(readCB) { readDone(). viewCB. viewCB. The register-object has a name and description. Reads and writes to the register will trigger debugger event-points and ( if the model's diagnostic level is set to enable system diagnostics) cause a message to be sent to the simulator log. "control register". 4. ppmCreateRegister( "reg2". 0. writeCB.OVPworld. "control register". // return the true value without side effects } void installRegs (){ void *regPort = ppmCreateSlaveBusPort("regPort". regPort. Example #include “ppm.org Page 49 of 52 .h” #include “bhm. at the debug prompt: print /x *myRegisterPointer) using the viewCB function. } // // // // // // // // // name description base of window offset from window base size in bytes bus read function bus write function debugger view function volatle register // // // // // // // // // name description base of window offset from window base size in bytes bus read function bus write function debugger view function non-volatle register © 2010 Imperas Software Limited www. True ). // write behavior need not be straight-forward } static PPM_VIEW_CB(viewCB) { *(Uns32*)data = reg1. regPort. // side-effect of the read return reg1. False ). readCB. but additionally creates an object visible to the debugger.

OVP BHM and PPM API Functions Reference In the example.h” #include “bhm. const char *description. Notes and Restrictions Registers should not overlap. 'reg2' occupies the next 4 bytes. The register callback will not occur when the same value is re-written.OVPworld.org Page 50 of 52 . Example #include “ppm. creates a register with no direct bus access. 4. The remaining 16 bytes of the window are implemented by memory which was allocated by the call to ppmCreateSlaveBusPort(). Description Similar to ppmCreateRegister.2 ppmCreateInternalRegister Prototype void *ppmCreateInternalRegister( const char *name.h” static PPM_VIEW_CB(viewCB) { *(Uns32*)data = reg1. The register callback will occur whenever a write occurs to its location. viewCB ). to implement a register which is accessed via an index counter. The debugger can view the register but cannot set a trigger point on its changing (since no read or write occurs). 5. for example. ppmCBviewFunc viewCB. regardless of value. "control register". 'reg1' occupies the first 4 bytes of the 24-byte port. // return the value without side effects } void installRegs (){ ppmCreateInternalRegister( "reg1". *userData // // // // // // name of register to appear in the debugger size of this register called by debugger to non-destructively fetch the current value will be passed to the 3 callbacks. void ). can be used. } // // // // name description size in bytes debugger view function © 2010 Imperas Software Limited www. Uns64 bytes.

Reads and writes by the PSE to the local region will be mapped to the region of the external bus. 0x80000000 ). readWriteRegion. . 0.OVPworld. remoteLoAddress Description Create a bridge from a local (PSE) memory region to the simulated bus with the given name. } name of the simulated bus. *localLoAddress. ppmAccessExternalBus( *remoteBusName. sizeof(readWriteRegion)).OVP BHM and PPM API Functions Reference 6 Direct Bus Access This interface allows direct access to a simulated bus without use of a port. it's use is not recommended for re-usable models. memset(readWriteRegion. © 2010 Imperas Software Limited www. sizeInBytes.h” Uns8 readWriteRegion[1024]. sizeof(readWriteRegion). Notes and Restrictions Regions should not overlap on the local or remote buses. Arguments: remoteBusName localLoAddress sizeInBytes remoteLoAddress Example #include “ppm. 6.{ ppmExternalBusHandle h = ppmAccessExternalBus( "systembus". PSE address of the base of the region of the region base of the region on the simulated bus. Note that ppmChangeRemoteLoAddress can be used to subsequently move the remote region...org Page 51 of 52 . Since the model needs to know the name of the bus to connect to.1 ppmAccessExternalBus Prototype ppmExternalBusHandle char volatile void Uns64 SimAddr ).

org Page 52 of 52 . . Example #include “ppm. Description Create a bridge that exposes a region of the local (PSE) address space to a simulated address space. i. graphicsRam. SimAddr remoteLoAddress. 0x80000000 // graphics ram mapped here ). void *localLoAddress ). sizeof(graphicsRam). } } Notes and Restrictions A single region of PSE memory can be exposed more than once The regions to where it is exposed cannot overlap. there is no port declared in the peripheral.{ ppmExternalBusHandle h = ppmExposeLocalBus( "systembus".OVP BHM and PPM API Functions Reference 6. sizeof(graphicsRam)).h” Uns8 graphicsRam[4094].. while(1) { bhmWaitDelay(frameUpdatePeriod). ## © 2010 Imperas Software Limited www.OVPworld.2 ppmExposeLocalBus Prototype ppmLocalBusHandle ppmExposeLocalBus ( char *remoteName. updateDisplay(graphicsRam.h” #include “bhm. The name of the bus and address region on the bus is specified in this call rather than by a port connection..e. Uns64 sizeInBytes.