# Projects and Libraries Monata organizes reusable circuit designs with a Library/Cell/View hierarchy. This is the main framework boundary: simulator backends and model compilers are attached to this structure, but they do not replace it. ## Library Registry `LibraryRegistry` is the top-level entry point. It keeps track of library directories and gives you dictionary-style access to libraries. ```python from monata import LibraryRegistry reg = LibraryRegistry() lib = reg.create_library( path="work/cmos_cells", name="cmos_cells", tech_model_paths=["models/ptm_45nm_nmos.lib", "models/ptm_45nm_pmos.lib"], ) assert "cmos_cells" in reg lib = reg["cmos_cells"] ``` ## Library Layout A Monata library is a directory with a `lib.toml` file and one directory per cell. ```text cmos_cells/ lib.toml inverter/ cell.toml schematic.py testbench.py symbol.toml netlist.scs ``` `lib.toml` stores library-level metadata and technology settings: ```toml [library] name = "cmos_cells" description = "CMOS standard-cell experiments" [technology] model_paths = ["models/ptm_45nm_nmos.lib", "models/ptm_45nm_pmos.lib"] simulator = "ngspice-subprocess" node_type = "bulk" ``` ## Cells A `Cell` represents one design unit, such as an inverter, buffer, gate, amplifier, or test macro. ```python cell = lib.create_cell("inverter", description="CMOS inverter") assert "inverter" in lib ``` Each cell owns its views. The idiomatic access pattern is: ```python cell = reg["cmos_cells"]["inverter"] schematic = cell["schematic"] ``` ## Views Monata currently recognizes these view types: | View | Purpose | | --- | --- | | `schematic` | Native Python `monata.netlist` source for the circuit topology | | `testbench` | Python function that wraps a circuit in sources, loads, and analyses | | `netlist` | Generated or hand-written SPICE/Spectre-compatible netlist | | `symbol` | Pin interface for hierarchical use | Views are declared in `cell.toml`: ```toml [cell] name = "inverter" description = "CMOS inverter" [views] schematic = { entry = "schematic.py", class = "Inverter" } testbench = { entry = "testbench.py", function = "main" } symbol = { entry = "symbol.toml", generated = true } netlist = { entry = "netlist.scs", generated = true } ``` Generated views are protected. If a generated netlist or symbol was edited by hand, regenerate with `force=True` only when you intend to overwrite it. ```python cell.generate_symbol() cell.generate_netlist() cell.generate_netlist(force=True) ```