Mapping is done through a Mapper object. This object only has one user method: dsx.Mapper.map. User must call it once for each resource with the relevant parameters.
A mapper object.
- __init__(hard, app)¶
Create a new Mapper object.
Parameters:
- hard (soclib.Architecture) – An hardware platform
- app (dsx.application.Tcg) – An application
Underlying class is dsx.mapper.mapper.Mapper.
Example:
import dsx
import dsx.application
import soclib
# Declare the tasks, the communication and finally the Tcg:
# ...
tcg = dsx.application.Tcg(...)
# Declare the hardware platform
pf = soclib.Architecture(...)
# ...
# Create the mapper
mapper = dsx.Mapper(pf, tcg)
# Map the resources
mapper.map(...)
Depending on the resource type, key/values to pass differ. Here we cover what to pass in order to correctly map the resources.
For an MWMR channel, some arguments are mandatory:
One is optional:
lock:
A Locks dedicated hardware component, like SocLib’s Locks component. Uses one lock. Mandatory if used protocol is not using atomic operations but hardware lock engine. This depends on the mwmr-controller‘s selected protocol.
Example:
mapper.map("fifo",
lock = "locks",
status = "cram2",
buffer = "cram1")
For an Memspace, one argument is mandatory:
Example:
mapper.map("memspace0",
buffer = "cram32")
For a Lock, one argument is mandatory:
Example:
mapper.map("lock0",
segment = "uram3")
For a Barrier, one argument is mandatory:
Example:
mapper.map("barrier0",
segment = "cram8")
On task mapping, depending on the passed arguments, different task implementation may be used. The mapping destination automatically selects the correct implementation.
For a Task implemented as software, 3 arguments are mandatory:
Two other parameters are optional and select the printed messages output:
Example:
mapper.map("producer",
run = "proc0",
stack = "ram1",
desc = "cram2")
mapper.map("consumer",
run = "proc1",
stack = "ram1",
desc = "cram2",
tty = "tty0",
tty_no = 2)
For a Task implemented as an hardware coprocessor, two arguments are mandatory:
Example:
mapper.map("consumer",
coprocessor = "cons0_coproc",
controller = "cons0_ctrl")
Processors have some attached data, like scheduler context and task lists. A processor must be mapped. Mandatory arguments are:
Optional arguments define the printed messages output, exactly like for software Tasks:
Example:
mapper.map("proc1",
private = "cram1",
shared = "uram2")
Finally, the Tcg as a whole must be mapped. It corresponds to the global application objects, like the description of the application and other internal data. Mandatory arguments are:
Optional arguments define the printed messages default output, exactly like for software Tasks:
Example:
mapper.map(tcg,
private = "cram1",
shared = "uram2",
code = "rom0",
tty = "tty0",
tto_no = 0)