Commit fa30e3e 1 parent 041a0ec commit fa30e3e Copy full SHA for fa30e3e
File tree 1 file changed +26
-8
lines changed
pdks/sky130_commercial_pdk/src
1 file changed +26
-8
lines changed Original file line number Diff line number Diff line change @@ -34,19 +34,37 @@ impl Sky130CommercialPdk {
34
34
}
35
35
36
36
pub ( crate ) fn mos_schematic ( ctx : & mut SchematicCtx , params : & MosParams ) -> Result < ( ) > {
37
+ use std:: fmt:: Write ;
37
38
let mos_db = ctx. mos_db ( ) ;
38
39
let name = & mos_db. get_spec ( params. id ) ?. name ;
39
40
// TODO correctly handle nf and m.
40
41
// The sky130 pdk uses w and l in microns.
41
42
// So we must divide by 1_000 to convert nanometers to microns.
42
- ctx. set_spice ( format ! (
43
- "M0 d g s b {} w={:.3} l={:.3} nf={} mult={}" ,
44
- name,
45
- params. w as f64 / 1_000.0 ,
46
- params. l as f64 / 1_000.0 ,
47
- params. nf,
48
- params. m,
49
- ) ) ;
43
+ // The max allowed width of a single transistor is 100um, so we fold
44
+ // larger transistors into several 100um segments plus one smaller segment containing
45
+ // the leftover width.
46
+ let mut spice = String :: new ( ) ;
47
+ let n_extra = params. w / 100_000 ;
48
+ let l = params. l as f64 / 1_000.0 ;
49
+ let nf = params. nf ;
50
+ let m = params. m ;
51
+
52
+ for i in 1 ..=n_extra {
53
+ writeln ! (
54
+ & mut spice,
55
+ "M{i} d g s b {name} w=100.0 l={l:.3} nf={nf} mult={m}"
56
+ )
57
+ . expect ( "failed to write to string" ) ;
58
+ }
59
+
60
+ let w = ( params. w % 100_000 ) as f64 / 1_000.0 ;
61
+ writeln ! (
62
+ & mut spice,
63
+ "M0 d g s b {name} w={w:.3} l={l:.3} nf={nf} mult={m}"
64
+ )
65
+ . expect ( "failed to write to string" ) ;
66
+
67
+ ctx. set_spice ( spice) ;
50
68
Ok ( ( ) )
51
69
}
52
70
}
You can’t perform that action at this time.
0 commit comments