2 releases
new 0.1.1 | Jan 27, 2025 |
---|---|
0.1.0 | Jan 27, 2025 |
#959 in Development tools
164 downloads per month
80KB
2K
SLoC
netlist-db
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/example.zip, then
cd example
./parser_x86_64-unknown-linux-musl 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 =======================
TODO
- Fully expression system
- Support more commands
Dependencies
~7–14MB
~166K SLoC