SoOSiM-0.1: Abstract full system simulator

Safe HaskellSafe-Infered

SoOSiM

Synopsis

Documentation

data SimM a Source

Instances

class ComponentIface s whereSource

Type class that defines every OS component

Methods

initState :: sSource

The minimal internal state of your component

componentName :: s -> ComponentNameSource

A function returning the unique global name of your component

componentBehaviour :: s -> ComponentInput -> SimM sSource

The function defining the behaviour of your component

data ComponentInput Source

Events send to components by the simulator

Constructors

ComponentMsg ComponentId Dynamic

A message send another component: the field argument is the ComponentId of the sender, the second field the message content

NodeMsg NodeId Dynamic

A message send by a node: the first field is the NodeId of the sending node, the second field the message content

Initialize

Event send when a component is first created

Deinitialize

Event send when a component is about to be removed

Tick

Event send every simulation round

Instances

registerComponent :: ComponentIface s => s -> SimM ()Source

Register a component interface with the simulator

createComponentSource

Arguments

:: Maybe NodeId

Node to create component on, leave to Nothing to create on current node

-> Maybe ComponentId

ComponentId to set as parent, set to Nothing to use own ComponentId

-> String

Name of the registered component

-> SimM ComponentId

ComponentId of the created component

Create a new component

invokeSource

Arguments

:: Maybe ComponentId

Caller, leave Nothing to set to current module

-> ComponentId

Callee

-> Dynamic

Argument

-> SimM Dynamic

Response from recipient

Synchronously invoke another component

invokeNoWaitSource

Arguments

:: Maybe ComponentId

Caller, leave Nothing to set to current module

-> ComponentId

Callee

-> Dynamic

Argument

-> SimM ()

Call returns immediately

Invoke another component, don't wait for a response

yield :: ComponentIface s => s -> SimM sSource

Yield to the simulator scheduler

getComponentId :: SimM ComponentIdSource

Get the component id of your component

getNodeId :: SimM NodeIdSource

Get the node id of of the node your component is currently running on

createNodeSource

Arguments

:: SimM NodeId

NodeId of the created node

Create a new node

writeMemorySource

Arguments

:: Maybe NodeId

Node you want to write on, leave Nothing to set to current node

-> Int

Address to write

-> Dynamic

Value to write

-> SimM () 

Write memory of local node

readMemorySource

Arguments

:: Maybe NodeId

Node you want to look on, leave Nothing to set to current node

-> Int

Address to read

-> SimM Dynamic 

Read memory of local node

componentCreator :: SimM ComponentIdSource

Return the ComponentId of the component that created the current component

componentLookupSource

Arguments

:: Maybe NodeId

Node you want to look on, leave Nothing to set to current node

-> ComponentName

Name of the component you are looking for

-> SimM (Maybe ComponentId)

Just ComponentID if the component is found, Nothing otherwise

Get the unique ComponentId of a certain component

runIO :: IO a -> SimM aSource

module Unique