working on deduce_resets
This commit is contained in:
parent
fa50930ff8
commit
3e3da53bd2
|
@ -20,7 +20,7 @@ use crate::{
|
|||
},
|
||||
prelude::*,
|
||||
};
|
||||
use std::{convert::Infallible, fmt};
|
||||
use std::{convert::Infallible, fmt, mem};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum DeduceResetsError {
|
||||
|
@ -415,17 +415,62 @@ impl RunProcessStep<AddEdgesToGraphStep> for ConnectAndLhsInstantiatedModule {
|
|||
source_location,
|
||||
} = self;
|
||||
match Expr::ty(lhs) {
|
||||
CanonicalType::UInt(ty) => todo!(),
|
||||
CanonicalType::SInt(ty) => todo!(),
|
||||
CanonicalType::Bool(ty) => todo!(),
|
||||
CanonicalType::UInt(_) => {}
|
||||
CanonicalType::SInt(_) => {}
|
||||
CanonicalType::Bool(_) => {}
|
||||
CanonicalType::AsyncReset(ty) => todo!(),
|
||||
CanonicalType::SyncReset(ty) => todo!(),
|
||||
CanonicalType::Reset(ty) => todo!(),
|
||||
CanonicalType::Clock(ty) => todo!(),
|
||||
CanonicalType::Clock(_) => {}
|
||||
CanonicalType::Array(ty) => todo!(),
|
||||
CanonicalType::Enum(ty) => todo!(),
|
||||
CanonicalType::Bundle(ty) => todo!(),
|
||||
CanonicalType::Enum(ty) => {
|
||||
for (variant_index, EnumVariant { ty, .. }) in ty.variants().into_iter().enumerate()
|
||||
{
|
||||
if ty.is_none() {
|
||||
continue;
|
||||
}
|
||||
let lhs =
|
||||
ops::VariantAccess::new_by_index(Expr::from_canonical(lhs), variant_index)
|
||||
.to_expr();
|
||||
let rhs =
|
||||
ops::VariantAccess::new_by_index(Expr::from_canonical(rhs), variant_index)
|
||||
.to_expr();
|
||||
ConnectAndLhsInstantiatedModule {
|
||||
lhs_instantiated_module,
|
||||
lhs,
|
||||
rhs,
|
||||
source_location,
|
||||
}
|
||||
.run_process_step(rhs_instantiated_module, state, step)?;
|
||||
}
|
||||
}
|
||||
CanonicalType::Bundle(ty) => {
|
||||
for (field_index, BundleField { flipped, .. }) in
|
||||
ty.fields().into_iter().enumerate()
|
||||
{
|
||||
let mut lhs =
|
||||
ops::FieldAccess::new_by_index(Expr::from_canonical(lhs), field_index)
|
||||
.to_expr();
|
||||
let mut rhs =
|
||||
ops::FieldAccess::new_by_index(Expr::from_canonical(rhs), field_index)
|
||||
.to_expr();
|
||||
let mut lhs_instantiated_module = lhs_instantiated_module;
|
||||
let mut rhs_instantiated_module = rhs_instantiated_module;
|
||||
if flipped {
|
||||
mem::swap(&mut lhs, &mut rhs);
|
||||
mem::swap(&mut lhs_instantiated_module, &mut rhs_instantiated_module);
|
||||
}
|
||||
ConnectAndLhsInstantiatedModule {
|
||||
lhs_instantiated_module,
|
||||
lhs,
|
||||
rhs,
|
||||
source_location,
|
||||
}
|
||||
.run_process_step(rhs_instantiated_module, state, step)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(Processed(()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue