Getting Started With the C0-microSD
Run the open-source Signaloid-Compute-Module-Demo-Calculator demo and plot the output distribution on your host.
The Signaloid-Compute-Module-Demo-Calculator demo uses UxHw® to add, subtract, multiply, or divide two uniform distributions on the module, and returns the resulting distribution to the host in a single execution, with no Monte Carlo loops.
The workflow is to build the device application on the Signaloid Cloud Compute Engine, flash it to the module, and run the host application.
Prerequisites
- A C0-microSD and a host computer with a microSD slot or reader. Linux and macOS are documented below. For Windows status, see Host OS Support.
- Python 3.10 or later for the host application and the flashing toolkit. See Python Environment.
- A Signaloid account on the Signaloid Cloud Developer Platform and an API key.
- The Signaloid CLI, installed and authenticated as shown in its installation and authentication documentation.
- A GitHub account connected to your Signaloid account, as shown in GitHub Login.
- The
jqcommand-line JSON processor, which the demoMakefileuses to parse Signaloid CLI responses. - Root privileges (
sudo), because raw block-device access requires them.
1. Identify the device
Insert the C0-microSD into your computer. On macOS and Linux it is detected automatically as a 20.2 MB (19.3 MiB) unformatted block-storage device. If your operating system prompts you to format it, do not format the device, dismiss the prompt.
Find the device path.
- macOS, run
diskutil listand look for the unformatted 20.2 MB disk, for example/dev/disk4. - Linux, run
lsblkand look for the unformatted disk that reports19.3M, for example/dev/sdb. - Windows, run
diskpart, thenlist disk, and look for the disk that reports around 19 MB. Access it as\\.\PhysicalDriveN, whereNis the disk number.
For more detail, see Identify Your Module.
2. Build the device application
Clone the demo repository recursively, so that you also get the Signaloid-Compute-Module-Utilities submodule with the flashing toolkit.
git clone --recursive https://github.com/signaloid/Signaloid-Compute-Module-Demo-Calculator.git
cd Signaloid-Compute-Module-Demo-Calculator
Configure two variables at the top of the Makefile.
- Set
DEVICEto the device path you found in step 1, for example/dev/disk4. - Set
DEVICE_TYPEtoSIGNALOID_C0_MICROSD.
The Makefile then selects the default C0-microSD core for the build. To change the
distributional representation precision or enable correlation tracking, set CORE_ID to one
of the other C0-microSD core IDs listed in the Makefile. See the
execution cores guide for how cores differ.
Then start the build.
make
The Makefile uses the Signaloid CLI to connect the
repository on the Signaloid Cloud Compute Engine, start a build on the selected
core, wait for it to finish, and download the resulting binary as
signaloid-soc-application/<build-id>.main.bin.
The Signaloid Cloud Compute Engine builds the repository as it exists on GitHub. To build your own modifications later, fork the demo repository, push your changes to your fork, and clone and build from your fork. See Developing UxHw Applications.
3. Flash the application binary
Flash the downloaded binary into the SPI flash user data region of the module.
make flash
Flashing happens in Bootloader mode, and the toolkit handles the mode switching for you. If the module is in Signaloid SoC mode, the toolkit first switches the boot mode and asks you to power cycle the device (eject and re-insert it). After writing and verifying the binary, the toolkit switches the module back to Signaloid SoC mode and asks for one more power cycle. The module has finished flashing when the green LED lights solid.
For the full flashing reference, see Flash the C0-microSD.
4. Run the host application
The Python host application sends the operands, triggers the computation, and reads back
the Ux distributional result. Create its virtual environment with the make venv
target, then run it.
make venv
sudo .venv/bin/python3 python-host-application/host_application.py --device-path /dev/disk4 --variant C0-microSD add "1.0(5)" "1.0(5)"
Replace /dev/disk4 with your device path. Each operand uses the concise distribution
notation X.Y(Z), so "1.0(5)" is a uniform distribution centered on 1.0 with a ±0.5
tolerance. The host application prints the particle value of the result and plots the
output distribution. Invoke the virtual environment interpreter directly, because a
plain sudo python3 runs the system Python without the packages installed in the
virtual environment.
The demo also supports sub, mul, and div for the other operations, and sample
for drawing samples from a built-in example distribution. The make run-all target runs
every operation once with example operands.
What just happened
makecompiled the device application on the Signaloid Cloud Compute Engine and downloaded the resulting binary, andmake flashwrote it into the SPI flash user data region of the module over the SD interface.- The host application parsed each operand into a lower and an upper bound, wrote the
four floats into the module's
MOSIbuffer, and wrote an opcode into thecommandregister. - The Signaloid SoC initialised two variables as uniform distributions and computed the operation directly on them. UxHw propagated the distributions through the arithmetic in hardware, in one pass.
- The host polled the
statusregister, read the resultingUxdistribution from theMISObuffer, printed its particle value, and plotted it.
The mechanics are the shared MMIO Interfacing Model, and the concepts behind the representation are in UxHw in Silicon.
Next steps
- Developing UxHw Applications, build your own application from the template, with UxHw distribution arithmetic on the module.
- Analyze
Uxoutput data on the host with signaloid-python and the Ux Data Tools. - Browse the Cookbook for recipes that move other kinds of data between the host and the module.
- Browse more Examples and Demos.
- Stuck? See Troubleshooting.