Metadata-Version: 2.4
Name: mmpviz
Version: 1.2.0
Summary: Memory Map / Address Map SVG Visualizer — turn a JSON description of your memory layout into a publication-quality SVG diagram
Author: Shawn Hu
License: MIT License
        
        Copyright (c) 2026 Shawn Hu
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
        ---
        
        ## Acknowledgements
        
        The initial version of mmpviz was based on
        **linkerscope** (https://github.com/linkerscope/linkerscope)
        by Raúl Gotor, used under the MIT License (reproduced below).
        
        This project has since evolved in its own direction and is expected to
        continue diverging from the original. It should not be assumed to remain
        compatible with or representative of linkerscope in future releases.
        
        ---
        
        linkerscope original license:
        
        MIT License
        
        Copyright (c) 2023 Raúl Gotor
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Repository, https://github.com/f33lgood/mmpviz
Project-URL: Changelog, https://github.com/f33lgood/mmpviz/blob/main/CHANGELOG.md
Keywords: memory-map,address-map,svg,visualization,diagram,hardware,embedded,soc
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Software Development :: Embedded Systems
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# mmpviz — Memory Map / Address Map Visualizer

**Turn a JSON description of your memory layout into a publication-quality SVG diagram.**

No coordinates. No manual box placement. Just describe the address ranges and let mmpviz compute the layout.

![ARM CoreSight Dual View](https://raw.githubusercontent.com/f33lgood/mmpviz/main/examples/chips/arm_coresight_dual_view/golden.svg)

---

## Install

```bash
pip install mmpviz
```

`mmpviz` has no runtime dependencies — stdlib only. Schema and cross-reference validation run automatically on every render.

---

## Quick Start

**1. Create `diagram.json`**

```json
{
  "views": [
    {
      "id": "flash",
      "bits": 32,
      "sections": [
        { "id": "bootloader", "name": "Bootloader", "address": "0x00000000", "size": "0x8000" },
        { "id": "app",        "name": "Application","address": "0x00008000", "size": "0x78000" }
      ]
    }
  ]
}
```

**2. Render**

```bash
mmpviz -d diagram.json -o map.svg
```

**3. Choose a layout algorithm** (optional)

```bash
mmpviz -d diagram.json -o map.svg --layout algo4
```

| Flag | Description |
|------|-------------|
| `--layout algo1` | One column per DAG level |
| `--layout algo2` | Algo-1 + height-rebalancing |
| `--layout algo3` | Algo-2 + routing lanes for non-adjacent links (default) |
| `--layout algo4` | Algo-3 + vertical column alignment to minimise link length |

---

## Themes

Two built-in themes ship with mmpviz:

| Theme | Flag | Appearance |
|-------|------|------------|
| `default` | `-t default` | Neutral gray fills, clean monochrome |
| `plantuml` | `-t plantuml` | Warm yellow fills, PlantUML-style palette |

```bash
mmpviz -d diagram.json -o map.svg -t plantuml
```

**Theme resolution — first match wins:**

| `-t` flag | `theme.json` next to diagram? | Theme used |
|-----------|-------------------------------|------------|
| `-t plantuml` (or any name/path) | yes or no | The `-t` value — sibling is ignored |
| *(omit)* | **yes** | The sibling `theme.json` |
| *(omit)* | no | Built-in `default` |

For a custom theme, place a `theme.json` next to `diagram.json` and extend a built-in:

```json
{ "schema_version": 1, "extends": "plantuml" }
```

---

## Features

- **Zero required dependencies** — pure Python stdlib
- **Auto-layout** — DAG-based column assignment, height rebalancing, routing lanes for crossing-free link bridges
- **Multi-view diagrams** — model interconnected address spaces with typed links (connector, band)
- **Themes** — built-in `default` and `plantuml`; fully customisable `theme.json`
- **Per-section overrides** — granular fill, stroke, height floor/ceiling per section or view
- **Scales from MCUs to SoCs** — tested on OpenTitan Earl Grey (65+ peripherals)

---

## More Examples

Real-world chip diagrams, theme showcases, and layout comparisons are in the
[examples/](https://github.com/f33lgood/mmpviz/tree/main/examples) directory on GitHub.

Full documentation: [github.com/f33lgood/mmpviz](https://github.com/f33lgood/mmpviz)
