Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency #15

Merged
merged 4 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ __test_runtime_assert = []
log = { version = "0.4", features = ["std", "serde"] }
simple_logger = "5.0"
serde = { version = "1.0", features = ["derive"] }
bson = "2.13"
serde_json = "1.0"
thiserror = "2.0"
strum = "0.26"
Expand Down Expand Up @@ -85,6 +84,7 @@ hashmatch = "0.1.1"
pyo3 = "0.23.4"
pyo3-stub-gen = "0.7"
# pyo3-stub-gen = { path = "../pyo3-stub-gen/pyo3-stub-gen" }
bincode = "1.3.3"

[dependencies]
liberty-macros = { path = "macros" }
Expand All @@ -103,14 +103,14 @@ nom.workspace = true
biodivine-lib-bdd.workspace = true
mut_set.workspace = true
duplicate.workspace = true
num-traits.workspace = true
cfg-if.workspace = true
hashmatch.workspace = true
pyo3 = { workspace = true, optional = true }
pyo3-stub-gen = { workspace = true, optional = true }


[dev-dependencies]
dev_utils.workspace = true
simple_logger.workspace = true
criterion.workspace = true
bson.workspace = true
bincode.workspace = true
5 changes: 2 additions & 3 deletions src/ccsn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use crate::{
Ctx,
};
use core::fmt::{self, Write};
use num_traits::Zero as _;

/// Use the `ccsn_first_stage` group to specify CCS noise for the first stage of the channel-
/// connected block (CCB).
Expand Down Expand Up @@ -234,13 +233,13 @@ impl<C: Ctx> GroupFn for CCSNStage<C> {
fn before_build(builder: &mut Self::Builder, _scope: &mut BuilderScope) {
if let Some(miller_cap_fall) = builder.miller_cap_fall.as_mut() {
if miller_cap_fall.is_sign_negative() {
miller_cap_fall.set_zero();
*miller_cap_fall = 0.0;
log::warn!("miller_cap_fall is negative!");
}
}
if let Some(miller_cap_rise) = builder.miller_cap_rise.as_mut() {
if miller_cap_rise.is_sign_negative() {
miller_cap_rise.set_zero();
*miller_cap_rise = 0.0;
log::warn!("miller_cap_rise is negative!");
}
}
Expand Down
96 changes: 45 additions & 51 deletions src/library/test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#![cfg(test)]
use num_traits::One;

use crate::{
ast::{AttriValues, SimpleDefined},
DefaultCtx,
Expand Down Expand Up @@ -177,7 +175,6 @@ library (undefined) {

#[test]
fn entry() {
use num_traits::Zero;
let mut library = Library::default();
library.comments_this_entry().or_insert("comment1".into());
library
Expand Down Expand Up @@ -222,51 +219,48 @@ library (undefined) {
);
}

// #[test]
// fn serde() {
// use num_traits::Zero;
// let mut library = Library::default();
// library.comments_this_entry().or_insert("comment1".into());
// library
// .cell
// .entry("CELL1".into())
// .and_modify(|cell| cell.area = Some(NotNan::one()))
// .or_insert_with(|cell| cell.area = Some(NotNan::zero()));
// library
// .cell
// .entry("CELL2".into())
// .and_modify(|cell| cell.area = Some(NotNan::one()))
// .or_insert_with(|cell| cell.area = Some(NotNan::zero()));
// library
// .cell
// .entry("CELL2".into())
// .and_modify(|cell| cell.area = Some(NotNan::one()))
// .or_insert_with(|cell| cell.area = Some(NotNan::zero()));
// let want = r#"/* comment1 */
// library (undefined) {
// | technology (cmos);
// | delay_model : table_lookup;
// | time_unit : 1ns;
// | voltage_unit : 1V;
// | slew_upper_threshold_pct_rise : 80.0;
// | slew_lower_threshold_pct_rise : 20.0;
// | slew_derate_from_library : 1.0;
// | slew_lower_threshold_pct_fall : 20.0;
// | slew_upper_threshold_pct_fall : 80.0;
// | input_threshold_pct_fall : 50.0;
// | input_threshold_pct_rise : 50.0;
// | output_threshold_pct_rise : 50.0;
// | output_threshold_pct_fall : 50.0;
// | cell (CELL1) {
// | | area : 0.0;
// | }
// | cell (CELL2) {
// | | area : 1.0;
// | }
// }
// "#;
// fmt_cmp(&library, want);
// let serialized = bson::bson!(library).unwrap();
// println!("serialized = {}", serialized);
// fmt_cmp(&bson::from_bson(&serialized).unwrap(), want);
// }
#[test]
fn serde() {
let mut library = Library::default();
library.comments_this_entry().or_insert("comment1".into());
library
.cell
.entry("CELL1".into())
.and_modify(|cell| cell.area = Some(1.0))
.or_insert_with(|cell| cell.area = Some(0.0));
library
.cell
.entry("CELL2".into())
.and_modify(|cell| cell.area = Some(1.0))
.or_insert_with(|cell| cell.area = Some(0.0));
library
.cell
.entry("CELL2".into())
.and_modify(|cell| cell.area = Some(1.0))
.or_insert_with(|cell| cell.area = Some(0.0));
let want = r#"/* comment1 */
library (undefined) {
| delay_model : table_lookup;
| time_unit : 1ns;
| voltage_unit : 1V;
| slew_upper_threshold_pct_rise : 80.0;
| slew_lower_threshold_pct_rise : 20.0;
| slew_derate_from_library : 1.0;
| slew_lower_threshold_pct_fall : 20.0;
| slew_upper_threshold_pct_fall : 80.0;
| input_threshold_pct_fall : 50.0;
| input_threshold_pct_rise : 50.0;
| output_threshold_pct_rise : 50.0;
| output_threshold_pct_fall : 50.0;
| cell (CELL1) {
| | area : 0.0;
| }
| cell (CELL2) {
| | area : 1.0;
| }
}
"#;
fmt_cmp(&library, want);
let serialized = bincode::serialize(&library).unwrap();
fmt_cmp(&bincode::deserialize(&serialized).unwrap(), want);
}