Registry / data / mantle

mantle

JSON →
library2.0.21pypypiunverified

The standard library for the Magma hardware DSL, providing core primitives (gates, muxes, registers, memories) for building digital circuits in Python. Current version: 2.0.21, release cadence: irregular.

pip install mantle
INSTALL
IMPORT
SIG · MANTLE
M
mantle
datapythonv2.0.21
Install
34.2s avg
Import
4260ms
Disk
563MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.21 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 34.2s · import 1.704s · 405MB
563MB installed
● package 563MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mantle
import mantle
Standard import; used to access mantle primitives like mantle.Register, mantle.DefineCounter, etc.
Register
from mantle import Register
from mantle.coreir import Register
In earlier versions (pre-2.0), mantle was structured differently; direct import from mantle is the current pattern.
DefineCounter
from mantle import DefineCounter
Commonly used for counter circuits.

Basic circuit using mantle primitives.

import magma import mantle # Define a simple circuit: incrementer using a register and adder class Incrementer(magma.Circuit): name = "Incrementer" io = magma.IO(I=magma.In(magma.Bits[4]), O=magma.Out(magma.Bits[4])) reg = mantle.Register(4, init=0) adder = mantle.DefineAdd(4) # Connect: reg_out -> adder b, I -> adder a, adder out -> reg in magma.wire(reg.O, adder.b) magma.wire(io.I, adder.a) magma.wire(adder.out, reg.I) magma.wire(reg.O, io.O) # Compile and simulate (requires fault or other backend) # magma.compile("build/Incrementer", Incrementer) print("Circuit defined successfully.")
Debug
Known issues
breakingMantle 1.x APIs changed significantly in 2.0. Many modules (e.g., mantle.coreir, mantle.backend) moved or removed. Always use 'from mantle import ...'.
fix
Update imports to match version 2.x patterns: use 'from mantle import Register' instead of 'from mantle.coreir import Register'.
affects: <2.0
deprecatedMantle 2.0.21 notes that some functions (e.g., DefineAdd, DefineCounter) are considered legacy; consider using magma.ir directly for new designs.
fix
Check if mantle provides a direct replacement or use Magma's built-in IR primitives.
affects: 2.0.x
gotchaMantle registers require explicit width parameter (e.g., Register(4)). Forgetting the width will cause errors.
fix
Always pass width as first argument: Register(width) or Register(width, init=0).
affects: all
Upgrade
Version history
2.0.21latest on PyPI · released Dec 20, 2022
Audit
Dependencies
magmarequiredMantle is the standard library for Magma; requires magma >= 2.0
faultoptionalUsed for testing / simulation in some patterns
Agent activity
2 hits · last 30 days
node
2
Resources
mantle — pip install mantle · libregistry