netlist-macros

Crates.ionetlist-macros
lib.rsnetlist-macros
version0.4.7
created_at2025-05-22 08:12:37.661984+00
updated_at2025-09-10 01:27:35.495088+00
description`netlist` macros
homepage
repositoryhttps://github.com/zao111222333/netlist-db/
max_upload_size
id1684892
size16,028
Junzhuo ZHOU (zao111222333)

documentation

https://docs.rs/netlist-db

README

netlist-db

build License netlist-db Docs codecov

Concurrent/Parallel SPICE (HSPICE) parser, under building.

Features

  • Concurrent/Parallel parse multi SPICE files (.inc and .lib) command
  • Use span to store string, avoid small allocations
  • Units system
  • Circular definition detection

Example

Download the releases/latest/examples.zip, then

cd examples_x86_64-unknown-linux-musl
./parser tests/top.sp

Or you can compile & run this example by

cargo run --example parser --release -- tests/top.sp
The output should be
cargo run --example parser --release -- tests/top.sp | aha --black > output.html
2025-01-27T01:40:43.135Z DEBUG [netlist_db::file] load File "tests/inc/inc0.sp"
2025-01-27T01:40:43.135Z DEBUG [netlist_db::file] load File "tests/inc/inc1.sp"
2025-01-27T01:40:43.135Z DEBUG [netlist_db::file] load File "tests/lib.sp", section tt
2025-01-27T01:40:43.135Z DEBUG [netlist_db::file] load File "tests/units.sp"
2025-01-27T01:40:43.135Z DEBUG [netlist_db::file] load File "tests/inc/inc2.sp"
2025-01-27T01:40:43.135Z DEBUG [netlist_db::file] load File "tests/inc/../lib.sp", section pre_layout
2025-01-27T01:40:43.136Z DEBUG [netlist_db::file] load File "tests/inc/../cycle_ref0.sp"
2025-01-27T01:40:43.136Z DEBUG [netlist_db::file] load File "tests/inc/../cycle_ref1.sp"
2025-01-27T01:40:43.137Z ERROR [netlist_db::lexer] 
File "tests/top.sp", line 5
.inc 'inc/inc0.sp'
                  <-
Error: No such file or directory (os error 2)

2025-01-27T01:40:43.137Z ERROR [netlist_db::lexer] File "tests/inc/../cycle_ref1.sp", line 2 .inc 'cycle_ref0.sp' <- CircularDefinition: Detect circular definition in File "tests/inc/../cycle_ref0.sp", line 2 File "tests/top.sp", line 6 ↓ File "tests/inc/inc2.sp", line 2 ↓ File "tests/inc/../lib.sp", line 3, section pre_layout ↓ * File "tests/inc/../cycle_ref0.sp", line 2 ↓ File "tests/inc/../cycle_ref1.sp", line 2 ↓ * File "tests/inc/../cycle_ref0.sp", line 2

2025-01-27T01:40:43.137Z ERROR [netlist_db::lexer] File "tests/inc/../lib.sp", line 7 .params flag=1 <- SyntaxError: Unknwon command params

2025-01-27T01:40:43.137Z ERROR [netlist_db::lexer] File "tests/top.sp", line 8 .lib 'lib.sp' tt <- Error: Can NOT find section tt in file "tests/lib.sp"

2025-01-27T01:40:43.137Z ERROR [netlist_db::lexer] File "tests/units.sp", line 7

  • micr?o=1u <- ParserError: TakeWhile1

======= AST ===========

.subckt DEMO A1 A2 var1=1 var2=2.option

  • gmindc=0.00000000000001 scale=0.9 .param
  • prelayout=1 flag_cc=1 X0.CCC net8 net23 VSS VPW NHVT11LL_CKT W=0.000000135 L=0.00000004 .params flag=1 .ends DEMO .subckt UNITS A .ends UNITS X0.BBB net8 net23 VSS VPW NHVT11LL_CKT W=0.000000135 L=0.00000004 X0.AAA net8 net23 VSS VPW NHVT11LL_CKT W=0.000000135 L=0.00000004 ======= ERR =========== true ======= stats ========= parse: 2.200291ms build: 40.833µs print: 11.334µs =======================

Regression

cargo install cargo-regression # install for first time
cargo build --examples --release
cargo regression ./tests/

TODO

  • Fully expression system
  • Support commands
    • tran
    • meas
    • ...
Commit count: 48

cargo fmt