Skip to main content

GdsLibrary

Struct GdsLibrary 

Source
pub struct GdsLibrary {
    pub version: i16,
    pub create_date: GdsDateTime,
    pub modify_date: GdsDateTime,
    pub name: String,
    pub usrunits_per_dbunit: f64,
    pub meters_per_dbunit: f64,
    pub reflibs: Option<[String; 2]>,
    pub fonts: Option<[String; 4]>,
    pub attrtable: Option<String>,
    pub generations: Option<i16>,
    pub format: Option<GdsFormat>,
    pub structures: HashMap<String, Arc<RwLock<GdsStructure>>>,
}

Fields§

§version: i16§create_date: GdsDateTime§modify_date: GdsDateTime§name: String§usrunits_per_dbunit: f64

The size of a database unit in user units. 1 database unit = xx user unit default = 0.001

§meters_per_dbunit: f64

The size of a database unit in meters. 1 database unit = xx meter default = 1e-9

§reflibs: Option<[String; 2]>§fonts: Option<[String; 4]>§attrtable: Option<String>§generations: Option<i16>§format: Option<GdsFormat>§structures: HashMap<String, Arc<RwLock<GdsStructure>>>

Implementations§

Source§

impl GdsLibrary

Source

pub fn new(name: impl Into<String>) -> Self

Source

pub fn with_version(&mut self, version: i16)

Source

pub fn usrunits_per_dbunit(&mut self, value: f64)

Source

pub fn meters_per_dbunit(&mut self, value: f64)

Source

pub fn new_structure( &mut self, name: impl Into<String>, ) -> Arc<RwLock<GdsStructure>> ⓘ

Source

pub fn add_structure(&mut self, structure: Arc<RwLock<GdsStructure>>)

Source

pub fn dbuint_to_micro(&self, uint: i32) -> f64

Source

pub fn micro_to_dbunit(&self, micro: f64) -> i32

Source

pub fn structure_size(&self) -> usize

Source§

impl GdsLibrary

Source

pub fn load_file<P: AsRef<Path>>(path: P) -> GdsReadResult<Self>

Examples found in repository?
examples/err.rs (line 4)
3fn main_result() -> Result<(), Box<dyn std::error::Error>> {
4    let lib = GdsLibrary::load_file("./data/cell_err.gds")?;
5    eprintln!("{}", lib.name);
6    Ok(())
7}
More examples
Hide additional examples
examples/sram.rs (line 4)
3fn main_result() -> Result<(), Box<dyn std::error::Error>> {
4    let lib = GdsLibrary::load_file("./data/sram/sram_1rw0r0w_8_256_freepdk45.gds")?;
5    eprintln!("{}", lib.name);
6    eprintln!("{}", lib.create_date);
7    Ok(())
8}
examples/text.rs (line 4)
3fn main_result() -> Result<(), Box<dyn std::error::Error>> {
4    let lib = GdsLibrary::load_file("./data/cells/dff.gds")?;
5    lib.save_text_file("./temp/dff.txt")?;
6
7    let lib = GdsLibrary::load_file("./data/sram/sram_1rw0r0w_8_256_freepdk45.gds")?;
8    lib.save_text_file("./temp/sram.txt")?;
9    Ok(())
10}
examples/cell.rs (line 4)
3fn main_result() -> Result<(), Box<dyn std::error::Error>> {
4    let lib = GdsLibrary::load_file("./data/cells/dff.gds")?;
5    eprintln!("{}", lib.name);
6
7    let cell_1rw = GdsLibrary::load_file("./data/cells/cell_1rw.gds")?;
8    eprintln!("{}", cell_1rw.create_date);
9
10    lib.save_gds_file("./temp/dff.gds")?;
11
12    Ok(())
13}
examples/read_write.rs (line 4)
3fn main_result() -> Result<(), Box<dyn std::error::Error>> {
4    let lib1 = GdsLibrary::load_file("./data/cells/dff.gds")?;
5    // lib1.save_gds_file("./data/cells/dff_copy.gds")?;
6    let lib2 = GdsLibrary::load_file("./data/cells/dff_copy.gds")?;
7
8    println!("{}", lib1.meters_per_dbunit);
9    println!("{}", lib2.meters_per_dbunit);
10    Ok(())
11}
examples/leafcell.rs (line 5)
4fn main_result() -> Result<(), Box<dyn std::error::Error>> {
5    let precharge = GdsLibrary::load_file("./data/leafcell/precharge.gds")?;
6    let sense_amp = GdsLibrary::load_file("./data/leafcell/sense_amp.gds")?;
7    let column_tri_gate = GdsLibrary::load_file("./data/leafcell/column_tri_gate.gds")?;
8    let write_driver = GdsLibrary::load_file("./data/leafcell/write_driver.gds")?;
9
10    Ok(())
11}
Source

pub fn save_gds_file<P: AsRef<Path>>(&self, path: P) -> GdsWriteResult<()>

Examples found in repository?
examples/cell.rs (line 10)
3fn main_result() -> Result<(), Box<dyn std::error::Error>> {
4    let lib = GdsLibrary::load_file("./data/cells/dff.gds")?;
5    eprintln!("{}", lib.name);
6
7    let cell_1rw = GdsLibrary::load_file("./data/cells/cell_1rw.gds")?;
8    eprintln!("{}", cell_1rw.create_date);
9
10    lib.save_gds_file("./temp/dff.gds")?;
11
12    Ok(())
13}
More examples
Hide additional examples
examples/combine_stdcell.rs (line 23)
3fn main_result() -> Result<(), Box<dyn std::error::Error>> {
4    let mut lib = GdsLibrary::load_file("./data/leafcell/bitcell.gds")?;
5    let sense_amp = GdsLibrary::load_file("./data/leafcell/sense_amp.gds")?;
6    let write_driver = GdsLibrary::load_file("./data/leafcell/write_driver.gds")?;
7    let column_tri_gate = GdsLibrary::load_file("./data/leafcell/column_tri_gate.gds")?;
8    let precharge = GdsLibrary::load_file("./data/leafcell/precharge.gds")?;
9
10    println!("{}", lib.meters_per_dbunit);
11    println!("{}", precharge.meters_per_dbunit);
12    println!("{}", sense_amp.meters_per_dbunit);
13    println!("{}", column_tri_gate.meters_per_dbunit);
14    println!("{}", write_driver.meters_per_dbunit);
15
16    lib.structures.insert("precharge".into(), precharge.structures.iter().nth(0).unwrap().1.clone());
17    lib.structures.insert("sense_amp".into(), sense_amp.structures.iter().nth(0).unwrap().1.clone());
18    lib.structures.insert("tri_gate".into(), column_tri_gate.structures.iter().nth(0).unwrap().1.clone());
19    lib.structures.insert("write_driver".into(), write_driver.structures.iter().nth(0).unwrap().1.clone());
20
21    println!("{}", lib.structures.len());
22
23    lib.save_gds_file("./data/leafcell/leafcell.gds")?;
24
25    let lib = GdsLibrary::load_file("./data/leafcell/leafcell.gds")?;
26    println!("{}", lib.structures.len());
27    println!("{}", lib.meters_per_dbunit);
28
29    Ok(())
30}
Source

pub fn save_text_file<P: AsRef<Path>>(&self, path: P) -> GdsWriteResult<()>

Examples found in repository?
examples/text.rs (line 5)
3fn main_result() -> Result<(), Box<dyn std::error::Error>> {
4    let lib = GdsLibrary::load_file("./data/cells/dff.gds")?;
5    lib.save_text_file("./temp/dff.txt")?;
6
7    let lib = GdsLibrary::load_file("./data/sram/sram_1rw0r0w_8_256_freepdk45.gds")?;
8    lib.save_text_file("./temp/sram.txt")?;
9    Ok(())
10}
Source

pub fn read<R: Read + Seek>(reader: R) -> GdsReadResult<Self>

Source

pub fn write_gds<W: Write>(&self, writer: W) -> GdsWriteResult<()>

Source

pub fn write_text<W: Write>(&self, writer: W) -> GdsWriteResult<()>

Trait Implementations§

Source§

impl Clone for GdsLibrary

Source§

fn clone(&self) -> GdsLibrary

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.