Skip to main content

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 jq command-line JSON processor, which the demo Makefile uses 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 list and look for the unformatted 20.2 MB disk, for example /dev/disk4.
  • Linux, run lsblk and look for the unformatted disk that reports 19.3M, for example /dev/sdb.
  • Windows, run diskpart, then list disk, and look for the disk that reports around 19 MB. Access it as \\.\PhysicalDriveN, where N is 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.

  1. Set DEVICE to the device path you found in step 1, for example /dev/disk4.
  2. Set DEVICE_TYPE to SIGNALOID_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.

note

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

  1. make compiled the device application on the Signaloid Cloud Compute Engine and downloaded the resulting binary, and make flash wrote it into the SPI flash user data region of the module over the SD interface.
  2. The host application parsed each operand into a lower and an upper bound, wrote the four floats into the module's MOSI buffer, and wrote an opcode into the command register.
  3. 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.
  4. The host polled the status register, read the resulting Ux distribution from the MISO buffer, 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