View on GitHub

netlistx-rs

πŸ₯… Netlist (Hypergraph) in Rust

πŸ₯… netlistx-rs

Crates.io Docs.rs CI codecov License

netlistx-rs is a Rust library for working with netlists (hypergraphs) in electronic design automation (EDA). It provides efficient data structures and algorithms for representing, analyzing, and partitioning circuit netlists.

πŸ“– What is a Netlist?

A netlist is a representation of an electronic circuit that describes the connections between components. In EDA, netlists are typically modeled as hypergraphs where:

✨ Features

πŸš€ Installation

Cargo

Add netlistx-rs to your Cargo.toml:

[dependencies]
netlistx-rs = "0.1"

For optional features:

[dependencies]
netlistx-rs = { version = "0.1", features = ["serde", "rayon"] }

πŸ’‘ Usage Examples

Basic Netlist Creation

use netlistx_rs::netlist::Netlist;

// Create a new netlist
let mut netlist = Netlist::new();

// Add modules
netlist.add_module("cell_a".to_string());
netlist.add_module("cell_b".to_string());
netlist.add_module("cell_c".to_string());

// Add nets
netlist.add_net("net1".to_string());
netlist.add_net("net2".to_string());

// Connect modules to nets
netlist.add_edge("net1", "cell_a").unwrap();
netlist.add_edge("net1", "cell_b").unwrap();
netlist.add_edge("net2", "cell_b").unwrap();
netlist.add_edge("net2", "cell_c").unwrap();

println!("Modules: {}", netlist.num_modules);
println!("Nets: {}", netlist.num_nets);

Using the Builder Pattern

use netlistx_rs::netlist::NetlistBuilder;

let netlist = NetlistBuilder::new()
    .add_module("cell_a")
    .add_module("cell_b")
    .add_module("cell_c")
    .add_net("net1")
    .add_net("net2")
    .add_edge("net1", "cell_a")
    .add_edge("net1", "cell_b")
    .add_edge("net2", "cell_b")
    .add_edge("net2", "cell_c")
    .build()
    .unwrap();

Netlist Partitioning

use netlistx_rs::partitioning::FiducciaMattheyses;

let partitioner = FiducciaMattheyses::new();
let result = partitioner.partition(&netlist, 0.5); // 50% balance

Statistics and Metrics

use netlistx_rs::statistics::NetlistStats;

let stats = NetlistStats::analyze(&netlist);
println!("Average net degree: {}", stats.avg_net_degree());
println!("Maximum module degree: {}", stats.max_module_degree());

πŸ“š API Documentation

Full API documentation is available at docs.rs/netlistx-rs.

Main Modules

πŸ”§ Optional Features

πŸ—ΊοΈ Roadmap

🀝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details.

πŸ“„ License

Licensed under either of

at your option.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

See CONTRIBUTING.md.