5 releases
0.0.5 | Jun 5, 2024 |
---|---|
0.0.4 | Jun 4, 2024 |
0.0.3 | Dec 10, 2021 |
0.0.2 | Nov 1, 2021 |
0.0.1 | Feb 22, 2021 |
#778 in Parser implementations
185KB
3.5K
SLoC
OASIS Stream Reader / Writer
libreda-oasis
is a layout input/output module for LibrEDA
OASIS is a binary file format for chip layouts and a good successor of GDSII. This library provides code for writing and reading libreda-db layouts to and from OASIS files.
Documentation
This crate is documented with docstrings in the code.
To view the documentation clone this repository and run: cargo doc --open
Acknowledgements
lib.rs
:
Library for reading and writing OASIS files.
OASIS is a binary format for storing two-dimensional geometrical data as it is commonly used for silicon chip layouts. Its purpose is very similar to the older GDS2 format.
Examples
Read a layout from OASIS
use std::fs::File;
use libreda_oasis::OASISStreamReader;
// Import the `LayoutStreamReader` trait.
use libreda_db::prelude::*;
let filename = "./tests/data/INVX1_no_compression.oas";
// Open the OASIS file for reading.
let mut f = File::open(filename).unwrap();
// Create an empty layout that will be populated by the OASIS reader.
let mut layout = Chip::new();
// Create a default OASIS reader and parse the data from the file.
let result = OASISStreamReader::default()
.read_layout(&mut f, &mut layout);
// Assert that there was no error.
assert!(result.is_ok());
Write a layout to OASIS
use std::fs::File;
use libreda_oasis::OASISStreamWriter;
// Import the `LayoutStreamReader` trait.
use libreda_db::prelude::*;
// Create an empty layout.
let layout = Chip::new();
let mut f = File::create("./tests/data/empty_layout_out.oas").unwrap();
let writer = OASISStreamWriter::default();
// Write the (empty) layout to the file.
let write_result = writer.write_layout(&mut f, &layout);
// Assert that there was no error.
assert!(write_result.is_ok());
References
Dependencies
~5MB
~100K SLoC