|Home > Getting started > Connecting to and running a model|
This example shows how to connect to a model, load an application onto it, and run the model.
An existing model can be connected to by creating a new
NetworkModel, passing the IP address or hostname and port number.
The model is comprised of multiple targets which represent the components in the system. A
Target object can be obtained by calling
Model.get_target( on an instantiated model, passing it the name of the target. A convenience method
Model.get_cpus() is also provided, which returns a list of
Target objects for all targets for which
componentType == 'Core', or that have the
executesSoftware flag set.
This example assumes that the model has started an Iris server locally, listening to port 7100:
import iris.debug model = iris.debug.NetworkModel("localhost",7100) cpu = model.get_cpus() cpu.load_application("/path/to/application.axf") model.run()
The code creates two variables:
Modelobject which represents the entire simulated system. It is composed of various targets including cores and memories. The model object can be used to access these targets and to start, stop, and step the model.
Targetobject, in this case the first CPU in the model. It can be used to read and write the memory and registers of the core and to set and clear breakpoints.