1
2 dmn
3
4
5
6
7
8
9 ( use-modules ( netlist schematic ) )
10 ( use-modules ( netlist schematic toplevel ) )
11 ( use-modules ( netlist package ) )
12
13
14 ( define ( nets_in_pinseq_order refdes pins_nets )
15 ( let
16 (
17 ( len (length pins_nets) )
18 ( pinseq )
19 ( pinnum #f )
20 ( netname #f )
21 ( res '() )
22 )
23
24 ( while ( <= pinseq len )
25
26 ( set! pinnum
27 ( gnetlist:get-attribute-by-pinseq
28 refdes
29 ( number->string pinseq )
30 "pinnumber"
31 )
32 )
33
34 ( set! netname ( package-pin-netname refdes pinnum ) )
35 ( set! res ( append res (list netname) ) )
36
37 ( set! pinseq ( pinseq ) )
38
39 )
40
41
42 res
43
44 )
45 )
46
47
48
49
50
51 ( define ( spice-dmn output-filename )
52 ( let
53 (
54 ( pkgs ( schematic-package-names (toplevel-schematic) ) )
55 ( nets ( schematic-nets (toplevel-schematic) ) )
56 ( pinnum #f )
57 ( netnames #f )
58 ( attr #f )
59 ( pins_nets '() )
60 )
61
62 ( format #t "* spice-dmn lepton-netlist backend:~%" )
63 ( format #t "*~%" )
64
65 ( for-each
66 ( lambda( refdes )
67
68 ( set! pins_nets ( get-pins-nets refdes ) )
69
70 ( if ( > (length pins_nets) )
71 ( begin
72
73 ( set! netnames ( nets_in_pinseq_order refdes pins_nets ) )
74 ( set! attr (gnetlist:get-package-attribute refdes "value") )
75
76 ( format #t "~a~{~,15t~a~}~,15t~a" refdes netnames attr )
77 ( format #t "~%" )
78
79 )
80 )
81
82 )
83 pkgs
84 )
85
86 ( format #t ".end~%" )
87
88 )
89 )
90
91
92
93
94
95
96 ( define ( request-netlist-mode )
97
98 'spice
99 )
100