The Channel Mapper
Introduction
ArC TWO does not have any concept of crosspoints, or wordlines and bitlines.
It only exposes 64 channels that can be interconnected arbitrarily. The Channel
Mapper is used to translate between ArC TWO channels and configurable
crosspoints. Since there are many different requirements for channel
configurations the mapping system is fully configurable to provide different
ways to connect channels together. ArC2Control comes with a set of default
mappers for common scenarios, but new mappers can be created. This is typically
in the form of a simple TOML file that describes which channels are associated
to specific bitlines or wordlines. For example this is mapping standard32.toml
that’s included in ArC2Control installation.
[config]
# optional name for this configuration
# if left empty will default to the filename
name = "PLCC 32×32"
# number of total word- and bitlines (required)
words = 32
bits = 32
# optional list of masked crosspoints. If this
# key is set only the specified word/bitlines
# will be available in the crossbar view. This
# example enables every other crosspoint along
# the main diagonal
mask = [
[ 0, 0], [ 2, 2], [ 4, 4], [ 6, 6],
[ 8, 8], [10, 10], [12, 12], [14, 14],
[16, 16], [18, 18], [20, 20], [22, 22],
[24, 24], [26, 26], [28, 28], [30, 30]
]
[mapping]
# corresponding channels for wordlines
# in this case wordline 0 is channel 16, wordline 1 is channel 63
# and so on.
words = [
16, 63, 17, 62, 18, 61, 19, 60,
20, 59, 21, 58, 22, 57, 23, 56,
24, 55, 25, 54, 26, 53, 27, 52,
28, 51, 29, 50, 30, 49, 31, 48
]
# corresponding channels for bitlines
# in this case bitline 0 is channel 15, bitline 1 is channel 32
# and so on.
bits = [
15, 32, 14, 33, 13, 34, 12, 35,
11, 36, 10, 37, 9, 38, 8, 39,
7, 40, 6, 41, 5, 42, 4, 43,
3, 44, 2, 45, 1, 46, 0, 47
]
Using the mapper
Within the context of an ArC2Control session you should not need to instantiate
mappers manually. The currently active mapper will always be available from the
mapper
property of the current module or long-running operation. Changes to
the mapper are automatically propagated to modules. In order to do anything
with ArC TWO you first need to convert the currently active crosspoint
coordinates to the correct channel pair. This is usually done using the
readonly wb2ch
dict property that
does the translation. For instance this is an abridged snippet from the
curvetracer module that ships with ArC TWO.
def do_ramp(self, w, b, *args):
# convert wordline w and bitline b to a corresponding (high/low)
# ArC TWO channel pair
(high, low) = self.mapper.wb2ch[w][b]
# this can then be used to do ArC TWO operations
# reminder: self.arc is always defined within modules
self.arc.generate_ramp(high, low, *args)
Adding more mappings
ArC2Control comes with some standard mappings which are always
available. Further mappings can be added in the local data directory,
typically %APPDATA%\Roaming\arc2control\mappings
in Windows, or
~/.local/share/arc2control/mappings
on Linux. Files must end in
.toml
to be loaded properly during ArC2Control startup.
API Reference
- class arc2control.mapper.ChannelMapper(nwords, nbits, wordarr, bitarr, mask, name)
ChannelMapper deals with conversions between word/bitlines and ArC2 channel numbers. ArC2 channels are arbitrary and can be operated independently. In a typical crossbar scenario some of these channels will be allocated to high potential terminals (wordlines) and others to low potential terminals (bitlines). This class provides convenience functions to switch back and forth.
The most typical way of loading a mapper would be through
from_toml()
to read the values from the configuration file, rather than create the objects manually.- Parameters:
nwords (int) – The number of wordlines
nbits (int) – The number of bitlines
wordarr – List of channels associated with wordlines 0 to
nwords
bitarr – List of channels associated with bitlines 0 to
nbits
name (str) – The name of this channel mapper
- Returns:
A new
ChannelMapper
.
- property b2ch
Get the corresponding channel, if any, for the specified bitline
- property bit_idxs
Indices of the bit-associated channels in the ArC2 raw response. Typically libarc2 reports all channels, 0 to 63, in ascending channel order. This property will return the channels associated with bitlines in the current configuration in ascending bitline number order.
- property ch2b
Get the corresponding bitline, if any, for the specified channel
- property ch2w
Get the corresponding wordline, if any, for the specified channel
- static from_toml(fname)
Create a new ChannelMapper from a toml configuration file. The mapper file MUST be UTF-8 encoded.
- Parameters:
fname (str) – The filename of the mapper to load
- Returns:
A new
ChannelMapper
.
- property is_masked
Check if mapper has a crosspoint mask applied
- property mask
Crossbar mask (available word-/bitlines)
- property name
Returns the current configuration name
- property nbits
Number of configured bitlines
- property nwords
Number of configured wordlines
- property total_devices
Total number of configured crosspoints.
- property w2ch
Get the corresponding channel, if any, for the specified wordline
- property wb2ch
Convert a (wordline, bitline) combination to a channel pair
>>> (high, low) = mapper.wb2ch[wordline][bitline]
- property word_idxs
Indices of the word-associated channels in the ArC2 raw response. Typically libarc2 reports all channels, 0 to 63, in ascending channel order. This property will return the channels associated with wordlines in the current configuration in ascending wordline number order.