reda_lib/model/
cell.rs

1use reda_lib_macro::model;
2use crate::model::LibPin;
3
4use super::LibExpr;
5
6#[model]
7#[derive(Debug, Clone, Default)]
8pub struct LibCell {
9    pub name: String,
10    pub pins: Vec<LibPin>,
11}
12
13#[model]
14#[derive(Debug, Clone, Default)]
15pub struct LibPgPin {
16    pub name: String,
17    pub voltage_name: String,
18    pub pg_type: String,  
19}
20
21#[model]
22#[derive(Debug, Clone)]
23pub struct LibLeakagePower {
24    pub when: LibExpr,
25    pub value: f64,
26}
27
28
29impl LibCell {
30    pub fn new<S: Into<String>>(name: S) -> Self {
31        Self { 
32            name: name.into(),
33            ..Default::default()
34        }
35    }
36
37    pub fn pin(&self, name: &str) -> Option<&LibPin> {
38        self.pins.iter().find(|p| p.name == name)
39    }
40}