Compare commits

...

2 commits

Author SHA1 Message Date
Jacob Lifshay 929e9f8b16
ci: run cargo doc too to ensure docs continue to build
All checks were successful
/ test (push) Successful in 9m8s
2024-07-10 23:06:29 -07:00
Jacob Lifshay 28f32d7d1a
work around rustdoc bug https://github.com/rust-lang/rust/issues/127593 2024-07-10 23:00:05 -07:00
8 changed files with 427 additions and 145 deletions

View file

@ -15,3 +15,4 @@ jobs:
with: with:
save-if: ${{ github.ref == 'refs/heads/master' }} save-if: ${{ github.ref == 'refs/heads/master' }}
- run: cargo test - run: cargo test
- run: cargo doc

View file

@ -4,7 +4,7 @@ use crate::{
array::ArrayType, array::ArrayType,
bundle::{BundleType, BundleValue, DynBundle, DynBundleType, FieldType}, bundle::{BundleType, BundleValue, DynBundle, DynBundleType, FieldType},
enum_::{DynEnumType, EnumType, EnumValue}, enum_::{DynEnumType, EnumType, EnumValue},
int::{DynSIntType, DynUIntType, FixedOrDynIntType, IntValue, UInt, UIntType}, int::{DynSIntType, DynUInt, DynUIntType, FixedOrDynIntType, IntValue, UInt, UIntType},
intern::{Intern, Interned, InternedCompare, PtrEqWithTypeId, SupportsPtrEqWithTypeId}, intern::{Intern, Interned, InternedCompare, PtrEqWithTypeId, SupportsPtrEqWithTypeId},
memory::{DynPortType, MemPort, PortType}, memory::{DynPortType, MemPort, PortType},
module::{ module::{
@ -288,7 +288,12 @@ impl<T> Hash for Expr<T> {
impl<T> Expr<IntValue<T>> impl<T> Expr<IntValue<T>>
where where
T: FixedOrDynIntType<1, Signed = ConstBool<false>>, T: FixedOrDynIntType<
1,
Signed = ConstBool<false>,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>,
{ {
pub fn as_bool(self) -> Expr<UInt<1>> { pub fn as_bool(self) -> Expr<UInt<1>> {
assert_eq!(self.canonical_type().width, 1); assert_eq!(self.canonical_type().width, 1);

View file

@ -10,8 +10,8 @@ use crate::{
TargetPathDynArrayElement, TargetPathElement, ToExpr, TargetPathDynArrayElement, TargetPathElement, ToExpr,
}, },
int::{ int::{
DynIntType, DynSInt, DynSIntType, DynUInt, DynUIntType, FixedOrDynIntType, Int, IntCmp, DynInt, DynIntType, DynSInt, DynSIntType, DynUInt, DynUIntType, FixedOrDynIntType, Int,
IntTypeTrait, IntValue, UInt, UIntType, IntCmp, IntTypeTrait, IntValue, UInt, UIntType,
}, },
intern::{Intern, Interned}, intern::{Intern, Interned},
reset::{ reset::{
@ -242,7 +242,7 @@ unary_op! {
#[method = not] #[method = not]
impl<T> Not for _ impl<T> Not for _
where ( where (
T: IntTypeTrait, T: IntTypeTrait<CanonicalType = DynIntType<<T as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<T as IntTypeTrait>::Signed>>,
) )
{ {
fn expr_enum(&self) -> _ { fn expr_enum(&self) -> _ {
@ -262,7 +262,7 @@ unary_op! {
#[method = neg] #[method = neg]
impl<T> Neg for _ impl<T> Neg for _
where ( where (
T: IntTypeTrait<Signed = ConstBool<true>>, T: IntTypeTrait<Signed = ConstBool<true>, CanonicalType = DynSIntType, CanonicalValue = DynSInt>,
) )
{ {
fn expr_enum(&self) -> _ { fn expr_enum(&self) -> _ {
@ -361,48 +361,48 @@ binary_op! {
#[method = bitand, rhs_to_canonical_dyn = to_canonical_dyn, expr_enum_u = BitAndU, expr_enum_s = BitAndS] #[method = bitand, rhs_to_canonical_dyn = to_canonical_dyn, expr_enum_u = BitAndU, expr_enum_s = BitAndS]
impl<L, R> BitAnd for _ impl<L, R> BitAnd for _
where where
L: IntTypeTrait, L: IntTypeTrait<CanonicalType = DynIntType<<L as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<L as IntTypeTrait>::Signed>>,
R: IntTypeTrait<Signed = L::Signed>, R: IntTypeTrait<Signed = L::Signed, CanonicalType = DynIntType<<R as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<R as IntTypeTrait>::Signed>>,
} }
binary_op! { binary_op! {
#[method = bitor, rhs_to_canonical_dyn = to_canonical_dyn, expr_enum_u = BitOrU, expr_enum_s = BitOrS] #[method = bitor, rhs_to_canonical_dyn = to_canonical_dyn, expr_enum_u = BitOrU, expr_enum_s = BitOrS]
impl<L, R> BitOr for _ impl<L, R> BitOr for _
where where
L: IntTypeTrait, L: IntTypeTrait<CanonicalType = DynIntType<<L as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<L as IntTypeTrait>::Signed>>,
R: IntTypeTrait<Signed = L::Signed>, R: IntTypeTrait<Signed = L::Signed, CanonicalType = DynIntType<<R as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<R as IntTypeTrait>::Signed>>,
} }
binary_op! { binary_op! {
#[method = bitxor, rhs_to_canonical_dyn = to_canonical_dyn, expr_enum_u = BitXorU, expr_enum_s = BitXorS] #[method = bitxor, rhs_to_canonical_dyn = to_canonical_dyn, expr_enum_u = BitXorU, expr_enum_s = BitXorS]
impl<L, R> BitXor for _ impl<L, R> BitXor for _
where where
L: IntTypeTrait, L: IntTypeTrait<CanonicalType = DynIntType<<L as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<L as IntTypeTrait>::Signed>>,
R: IntTypeTrait<Signed = L::Signed>, R: IntTypeTrait<Signed = L::Signed, CanonicalType = DynIntType<<R as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<R as IntTypeTrait>::Signed>>,
} }
binary_op! { binary_op! {
#[method = add, rhs_to_canonical_dyn = to_canonical_dyn, expr_enum_u = AddU, expr_enum_s = AddS] #[method = add, rhs_to_canonical_dyn = to_canonical_dyn, expr_enum_u = AddU, expr_enum_s = AddS]
impl<L, R> Add for _ impl<L, R> Add for _
where where
L: IntTypeTrait, L: IntTypeTrait<CanonicalType = DynIntType<<L as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<L as IntTypeTrait>::Signed>>,
R: IntTypeTrait<Signed = L::Signed>, R: IntTypeTrait<Signed = L::Signed, CanonicalType = DynIntType<<R as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<R as IntTypeTrait>::Signed>>,
} }
binary_op! { binary_op! {
#[method = sub, rhs_to_canonical_dyn = to_canonical_dyn, expr_enum_u = SubU, expr_enum_s = SubS] #[method = sub, rhs_to_canonical_dyn = to_canonical_dyn, expr_enum_u = SubU, expr_enum_s = SubS]
impl<L, R> Sub for _ impl<L, R> Sub for _
where where
L: IntTypeTrait, L: IntTypeTrait<CanonicalType = DynIntType<<L as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<L as IntTypeTrait>::Signed>>,
R: IntTypeTrait<Signed = L::Signed>, R: IntTypeTrait<Signed = L::Signed, CanonicalType = DynIntType<<R as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<R as IntTypeTrait>::Signed>>,
} }
binary_op! { binary_op! {
#[method = mul, rhs_to_canonical_dyn = to_canonical_dyn, expr_enum_u = MulU, expr_enum_s = MulS] #[method = mul, rhs_to_canonical_dyn = to_canonical_dyn, expr_enum_u = MulU, expr_enum_s = MulS]
impl<L, R> Mul for _ impl<L, R> Mul for _
where where
L: IntTypeTrait, L: IntTypeTrait<CanonicalType = DynIntType<<L as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<L as IntTypeTrait>::Signed>>,
R: IntTypeTrait<Signed = L::Signed>, R: IntTypeTrait<Signed = L::Signed, CanonicalType = DynIntType<<R as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<R as IntTypeTrait>::Signed>>,
} }
macro_rules! dyn_shift_op { macro_rules! dyn_shift_op {
@ -413,7 +413,7 @@ macro_rules! dyn_shift_op {
fixed_ary_op! { fixed_ary_op! {
pub struct $DynOp<LhsType,> pub struct $DynOp<LhsType,>
where ( where (
LhsType: IntTypeTrait, LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>,
) )
{ {
pub lhs: Expr<LhsType::CanonicalValue>, pub lhs: Expr<LhsType::CanonicalValue>,
@ -458,8 +458,8 @@ macro_rules! dyn_shift_op {
impl<Lhs: Value<Type = LhsType>, LhsType, RhsType, Rhs: Value<Type = RhsType>> ops::$Op<Expr<Rhs>> for Expr<Lhs> impl<Lhs: Value<Type = LhsType>, LhsType, RhsType, Rhs: Value<Type = RhsType>> ops::$Op<Expr<Rhs>> for Expr<Lhs>
where where
LhsType: IntTypeTrait, LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>,
RhsType: IntTypeTrait<Signed = ConstBool<false>>, RhsType: IntTypeTrait<Signed = ConstBool<false>, CanonicalType = DynUIntType, CanonicalValue = DynUInt>,
{ {
type Output = Expr<<<Valueless<LhsType> as ops::$Op<Valueless<RhsType>>>::Output as ValuelessTr>::Value>; type Output = Expr<<<Valueless<LhsType> as ops::$Op<Valueless<RhsType>>>::Output as ValuelessTr>::Value>;
@ -470,8 +470,8 @@ macro_rules! dyn_shift_op {
impl<LhsType, RhsType, Rhs: Value<Type = RhsType>> ops::$Op<Expr<Rhs>> for IntValue<LhsType> impl<LhsType, RhsType, Rhs: Value<Type = RhsType>> ops::$Op<Expr<Rhs>> for IntValue<LhsType>
where where
LhsType: IntTypeTrait, LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>,
RhsType: IntTypeTrait<Signed = ConstBool<false>>, RhsType: IntTypeTrait<Signed = ConstBool<false>, CanonicalType = DynUIntType, CanonicalValue = DynUInt>,
{ {
type Output = Expr<<<Valueless<LhsType> as ops::$Op<Valueless<RhsType>>>::Output as ValuelessTr>::Value>; type Output = Expr<<<Valueless<LhsType> as ops::$Op<Valueless<RhsType>>>::Output as ValuelessTr>::Value>;
@ -490,7 +490,7 @@ macro_rules! fixed_shift_op {
fixed_ary_op! { fixed_ary_op! {
pub struct $FixedOp<LhsType,> pub struct $FixedOp<LhsType,>
where ( where (
LhsType: IntTypeTrait, LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>,
) )
{ {
pub lhs: Expr<LhsType::CanonicalValue>, pub lhs: Expr<LhsType::CanonicalValue>,
@ -532,7 +532,7 @@ macro_rules! fixed_shift_op {
impl<Lhs: Value<Type = LhsType>, LhsType> ops::$Op<usize> for Expr<Lhs> impl<Lhs: Value<Type = LhsType>, LhsType> ops::$Op<usize> for Expr<Lhs>
where where
LhsType: IntTypeTrait, LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>,
{ {
type Output = Expr<<<Valueless<LhsType> as ops::$Op<usize>>::Output as ValuelessTr>::Value>; type Output = Expr<<<Valueless<LhsType> as ops::$Op<usize>>::Output as ValuelessTr>::Value>;
@ -568,9 +568,9 @@ macro_rules! cmp_op {
$(fixed_ary_op! { $(fixed_ary_op! {
pub struct $CmpOp<LhsType, RhsType, Output,> pub struct $CmpOp<LhsType, RhsType, Output,>
where ( where (
LhsType: IntTypeTrait, LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>,
RhsType: IntTypeTrait<Signed = LhsType::Signed>, RhsType: IntTypeTrait<Signed = LhsType::Signed, CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>>,
Output: FixedOrDynIntType<1, Signed = ConstBool<false>>, Output: FixedOrDynIntType<1, Signed = ConstBool<false>, CanonicalType = DynUIntType, CanonicalValue = DynUInt>,
) )
{ {
pub lhs: Expr<LhsType::CanonicalValue>, pub lhs: Expr<LhsType::CanonicalValue>,
@ -612,7 +612,7 @@ macro_rules! cmp_op {
} }
})* })*
impl<LhsType: IntTypeTrait, RhsType: IntTypeTrait<Signed = LhsType::Signed>, Rhs: Value<Type = RhsType>, Lhs: Value<Type = LhsType>> IntCmp<Expr<Rhs>> for Expr<Lhs> { impl<LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>, RhsType: IntTypeTrait<Signed = LhsType::Signed, CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>>, Rhs: Value<Type = RhsType>, Lhs: Value<Type = LhsType>> IntCmp<Expr<Rhs>> for Expr<Lhs> {
type Output = Expr<UInt<1>>; type Output = Expr<UInt<1>>;
$(fn $fn(self, rhs: Expr<Rhs>) -> Self::Output { $(fn $fn(self, rhs: Expr<Rhs>) -> Self::Output {
@ -620,7 +620,7 @@ macro_rules! cmp_op {
})* })*
} }
impl<LhsType: IntTypeTrait, RhsType: IntTypeTrait<Signed = LhsType::Signed>, Rhs: Value<Type = RhsType>, Lhs: Value<Type = LhsType>> IntCmp<Rhs> for Expr<Lhs> { impl<LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>, RhsType: IntTypeTrait<Signed = LhsType::Signed, CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>>, Rhs: Value<Type = RhsType>, Lhs: Value<Type = LhsType>> IntCmp<Rhs> for Expr<Lhs> {
type Output = Expr<UInt<1>>; type Output = Expr<UInt<1>>;
$(fn $fn(self, rhs: Rhs) -> Self::Output { $(fn $fn(self, rhs: Rhs) -> Self::Output {
@ -628,7 +628,7 @@ macro_rules! cmp_op {
})* })*
} }
impl<LhsType: IntTypeTrait, RhsType: IntTypeTrait<Signed = LhsType::Signed>, Rhs: Value<Type = RhsType>> IntCmp<Expr<Rhs>> for IntValue<LhsType> { impl<LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>, RhsType: IntTypeTrait<Signed = LhsType::Signed, CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>>, Rhs: Value<Type = RhsType>> IntCmp<Expr<Rhs>> for IntValue<LhsType> {
type Output = Expr<UInt<1>>; type Output = Expr<UInt<1>>;
$(fn $fn(self, rhs: Expr<Rhs>) -> Self::Output { $(fn $fn(self, rhs: Expr<Rhs>) -> Self::Output {
@ -658,8 +658,8 @@ cmp_op! {
fixed_ary_op! { fixed_ary_op! {
pub struct CastInt<FromType, ToType,> pub struct CastInt<FromType, ToType,>
where ( where (
FromType: IntTypeTrait, FromType: IntTypeTrait<CanonicalType = DynIntType<<FromType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<FromType as IntTypeTrait>::Signed>>,
ToType: IntTypeTrait, ToType: IntTypeTrait<CanonicalType = DynIntType<<ToType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<ToType as IntTypeTrait>::Signed>>,
) )
{ {
pub value: Expr<FromType::CanonicalValue>, pub value: Expr<FromType::CanonicalValue>,
@ -705,9 +705,18 @@ fixed_ary_op! {
} }
} }
impl<FromType: IntTypeTrait> Expr<IntValue<FromType>> { impl<
FromType: IntTypeTrait<
CanonicalType = DynIntType<<FromType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<FromType as IntTypeTrait>::Signed>,
>,
> Expr<IntValue<FromType>>
{
pub fn cast< pub fn cast<
ToType: IntTypeTrait<CanonicalType = DynIntType<<ToType as IntTypeTrait>::Signed>>, ToType: IntTypeTrait<
CanonicalType = DynIntType<<ToType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<ToType as IntTypeTrait>::Signed>,
>,
>( >(
self, self,
ty: ToType, ty: ToType,
@ -731,7 +740,7 @@ impl<FromType: IntTypeTrait> Expr<IntValue<FromType>> {
fixed_ary_op! { fixed_ary_op! {
pub struct Slice<Base,> pub struct Slice<Base,>
where ( where (
Base: IntTypeTrait, Base: IntTypeTrait<CanonicalType = DynIntType<<Base as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<Base as IntTypeTrait>::Signed>>,
) )
{ {
pub base: Expr<Base::CanonicalValue>, pub base: Expr<Base::CanonicalValue>,
@ -765,7 +774,13 @@ fixed_ary_op! {
} }
} }
impl<T: IntTypeTrait> Expr<IntValue<T>> { impl<
T: IntTypeTrait<
CanonicalType = DynIntType<<T as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<T as IntTypeTrait>::Signed>,
>,
> Expr<IntValue<T>>
{
pub fn slice<I: RangeBounds<usize>>(self, index: I) -> Expr<DynUInt> { pub fn slice<I: RangeBounds<usize>>(self, index: I) -> Expr<DynUInt> {
Slice::<T>::new_unchecked( Slice::<T>::new_unchecked(
self.canonical(), self.canonical(),
@ -841,7 +856,14 @@ impl_built_in_range!(<T> std::ops::RangeInclusive<T>);
impl_built_in_range!(<T> std::ops::RangeTo<T>); impl_built_in_range!(<T> std::ops::RangeTo<T>);
impl_built_in_range!(<T> std::ops::RangeToInclusive<T>); impl_built_in_range!(<T> std::ops::RangeToInclusive<T>);
impl<T: IntTypeTrait, I: BuiltInRange<usize>> ExprIndex<I> for IntValue<T> { impl<
T: IntTypeTrait<
CanonicalType = DynIntType<<T as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<T as IntTypeTrait>::Signed>,
>,
I: BuiltInRange<usize>,
> ExprIndex<I> for IntValue<T>
{
type OutputValue = DynUInt; type OutputValue = DynUInt;
fn expr_index(this: Expr<Self>, index: I) -> Expr<Self::OutputValue> { fn expr_index(this: Expr<Self>, index: I) -> Expr<Self::OutputValue> {
@ -849,7 +871,13 @@ impl<T: IntTypeTrait, I: BuiltInRange<usize>> ExprIndex<I> for IntValue<T> {
} }
} }
impl<T: IntTypeTrait> ExprIndex<usize> for IntValue<T> { impl<
T: IntTypeTrait<
CanonicalType = DynIntType<<T as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<T as IntTypeTrait>::Signed>,
>,
> ExprIndex<usize> for IntValue<T>
{
type OutputValue = UInt<1>; type OutputValue = UInt<1>;
fn expr_index(this: Expr<Self>, index: usize) -> Expr<Self::OutputValue> { fn expr_index(this: Expr<Self>, index: usize) -> Expr<Self::OutputValue> {
@ -862,7 +890,7 @@ macro_rules! reduce_bit_op {
fixed_ary_op! { fixed_ary_op! {
pub struct $name<Output,> pub struct $name<Output,>
where ( where (
Output: FixedOrDynIntType<1, Signed = ConstBool<false>>, Output: FixedOrDynIntType<1, Signed = ConstBool<false>, CanonicalType = DynUIntType, CanonicalValue = DynUInt>,
) )
{ {
pub arg: Expr<DynUInt>, pub arg: Expr<DynUInt>,
@ -892,7 +920,14 @@ reduce_bit_op!(ReduceBitAnd; |bits| bits.all());
reduce_bit_op!(ReduceBitOr; |bits| bits.any()); reduce_bit_op!(ReduceBitOr; |bits| bits.any());
reduce_bit_op!(ReduceBitXor; |bits| bits.count_ones() % 2 == 1); reduce_bit_op!(ReduceBitXor; |bits| bits.count_ones() % 2 == 1);
impl<T: IntTypeTrait<Signed = ConstBool<false>>> Expr<IntValue<T>> { impl<
T: IntTypeTrait<
Signed = ConstBool<false>,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>,
> Expr<IntValue<T>>
{
pub fn reduce_bitand(self) -> Expr<UInt<1>> { pub fn reduce_bitand(self) -> Expr<UInt<1>> {
ReduceBitAnd::<UIntType<1>>::new_unchecked(self.canonical()).to_expr() ReduceBitAnd::<UIntType<1>>::new_unchecked(self.canonical()).to_expr()
} }
@ -939,7 +974,9 @@ fixed_ary_op! {
}, },
#[target] #[target]
target: Option<Interned<Target>> = base.target().map(|base| { target: Option<Interned<Target>> = base.target().map(|base| {
Intern::intern_sized(base.join(TargetPathElement::intern_sized(TargetPathBundleField{name:field.name}.into()))) Intern::intern_sized(base.join(
TargetPathElement::intern_sized(TargetPathBundleField{ name: field.name }.into()),
))
}), }),
fn simulate(&self, sim_state: &mut SimState) -> _ { fn simulate(&self, sim_state: &mut SimState) -> _ {
todo!() todo!()
@ -985,9 +1022,9 @@ fixed_ary_op! {
#[cache] #[cache]
base_ty: DynEnumType = base.canonical_type(), base_ty: DynEnumType = base.canonical_type(),
#[type] #[type]
ty: VariantTy = VariantTy::from_dyn_canonical_type(base_ty.variants()[variant_index].ty.unwrap_or_else( ty: VariantTy = VariantTy::from_dyn_canonical_type(
|| ().canonical_dyn(), base_ty.variants()[variant_index].ty.unwrap_or_else(|| ().canonical_dyn()),
)), ),
#[cache] #[cache]
literal_bits: Result<Interned<BitSlice>, ()> = { literal_bits: Result<Interned<BitSlice>, ()> = {
base.to_literal_bits().map(|base| { base.to_literal_bits().map(|base| {
@ -1086,7 +1123,9 @@ fixed_ary_op! {
} }
fn expr_enum(&self) -> _ { fn expr_enum(&self) -> _ {
ExprEnum::CastBitsTo(CastBitsTo::new_unchecked(self.value, self.ty.canonical_dyn()).intern_sized()) ExprEnum::CastBitsTo(
CastBitsTo::new_unchecked(self.value, self.ty.canonical_dyn()).intern_sized(),
)
} }
fn to_literal_bits(&self) -> Result<Interned<BitSlice>, ()> { fn to_literal_bits(&self) -> Result<Interned<BitSlice>, ()> {
@ -1105,7 +1144,14 @@ where
} }
} }
impl<T: IntTypeTrait<Signed = ConstBool<false>>> Expr<IntValue<T>> { impl<
T: IntTypeTrait<
Signed = ConstBool<false>,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>,
> Expr<IntValue<T>>
{
pub fn cast_bits_to<U: Value>(self, ty: U::Type) -> Expr<U> pub fn cast_bits_to<U: Value>(self, ty: U::Type) -> Expr<U>
where where
U::Type: Type<Value = U>, U::Type: Type<Value = U>,
@ -1115,11 +1161,11 @@ impl<T: IntTypeTrait<Signed = ConstBool<false>>> Expr<IntValue<T>> {
} }
macro_rules! cast_bit_to_typed_bit { macro_rules! cast_bit_to_typed_bit {
(pub struct $Op:ident$(<$T:ident: $Bound:ident<$BoundArg:tt>>)?; $FromType:ty => $ToType:ty) => { (pub struct $Op:ident$(<$T:ident: $Bound:path>)?; $FromType:ty => $ToType:ty) => {
fixed_ary_op! { fixed_ary_op! {
pub struct $Op<$($T,)?> pub struct $Op<$($T,)?>
where ( where (
$($T: $Bound<$BoundArg>,)? $($T: $Bound,)?
) )
{ {
pub value: Expr<<$FromType as Type>::Value>, pub value: Expr<<$FromType as Type>::Value>,
@ -1244,7 +1290,7 @@ where
} }
} }
cast_bit_to_typed_bit!(pub struct CastClockToBit<ToType: FixedOrDynIntType<1>>; ClockType => ToType); cast_bit_to_typed_bit!(pub struct CastClockToBit<ToType: FixedOrDynIntType<1, CanonicalType = DynIntType<<ToType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<ToType as IntTypeTrait>::Signed>>>; ClockType => ToType);
impl ToBit for Clock { impl ToBit for Clock {
fn to_bit(v: Expr<Self>) -> Expr<UInt<1>> { fn to_bit(v: Expr<Self>) -> Expr<UInt<1>> {
@ -1252,7 +1298,7 @@ impl ToBit for Clock {
} }
} }
cast_bit_to_typed_bit!(pub struct CastSyncResetToBit<ToType: FixedOrDynIntType<1>>; SyncResetType => ToType); cast_bit_to_typed_bit!(pub struct CastSyncResetToBit<ToType: FixedOrDynIntType<1, CanonicalType = DynIntType<<ToType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<ToType as IntTypeTrait>::Signed>>>; SyncResetType => ToType);
impl ToBit for SyncReset { impl ToBit for SyncReset {
fn to_bit(v: Expr<Self>) -> Expr<UInt<1>> { fn to_bit(v: Expr<Self>) -> Expr<UInt<1>> {
@ -1260,7 +1306,7 @@ impl ToBit for SyncReset {
} }
} }
cast_bit_to_typed_bit!(pub struct CastAsyncResetToBit<ToType: FixedOrDynIntType<1>>; AsyncResetType => ToType); cast_bit_to_typed_bit!(pub struct CastAsyncResetToBit<ToType: FixedOrDynIntType<1, CanonicalType = DynIntType<<ToType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<ToType as IntTypeTrait>::Signed>>>; AsyncResetType => ToType);
impl ToBit for AsyncReset { impl ToBit for AsyncReset {
fn to_bit(v: Expr<Self>) -> Expr<UInt<1>> { fn to_bit(v: Expr<Self>) -> Expr<UInt<1>> {
@ -1268,7 +1314,7 @@ impl ToBit for AsyncReset {
} }
} }
cast_bit_to_typed_bit!(pub struct CastResetToBit<ToType: FixedOrDynIntType<1>>; ResetType => ToType); cast_bit_to_typed_bit!(pub struct CastResetToBit<ToType: FixedOrDynIntType<1, CanonicalType = DynIntType<<ToType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<ToType as IntTypeTrait>::Signed>>>; ResetType => ToType);
impl ToBit for Reset { impl ToBit for Reset {
fn to_bit(v: Expr<Self>) -> Expr<UInt<1>> { fn to_bit(v: Expr<Self>) -> Expr<UInt<1>> {
@ -1355,7 +1401,9 @@ fixed_ary_op! {
}, },
#[target] #[target]
target: Option<Interned<Target>> = base.target().map(|base| { target: Option<Interned<Target>> = base.target().map(|base| {
Intern::intern_sized(base.join(TargetPathElement::ArrayElement(TargetPathArrayElement { index }).intern())) Intern::intern_sized(base.join(
TargetPathElement::ArrayElement(TargetPathArrayElement { index }).intern(),
))
}), }),
fn simulate(&self, sim_state: &mut SimState) -> _ { fn simulate(&self, sim_state: &mut SimState) -> _ {
todo!() todo!()
@ -1398,21 +1446,28 @@ fixed_ary_op! {
let base_ty = base.ty(); let base_ty = base.ty();
let element_bit_width = base_ty.element().bit_width(); let element_bit_width = base_ty.element().bit_width();
base.to_literal_bits().ok().zip(index.to_literal_bits().ok()).and_then(|(base, index)| { base.to_literal_bits().ok().zip(index.to_literal_bits().ok()).and_then(|(base, index)| {
let start = DynUInt::from_bit_slice(&index).uint_value().to_usize()?.checked_mul(element_bit_width)?; let start = DynUInt::from_bit_slice(&index)
.uint_value()
.to_usize()?
.checked_mul(element_bit_width)?;
let end = start.checked_add(element_bit_width)?; let end = start.checked_add(element_bit_width)?;
Some(base.get(start..end)?.intern()) Some(base.get(start..end)?.intern())
}).ok_or(()) }).ok_or(())
}, },
#[target] #[target]
target: Option<Interned<Target>> = base.target().map(|base| { target: Option<Interned<Target>> = base.target().map(|base| {
Intern::intern_sized(base.join(TargetPathElement::DynArrayElement(TargetPathDynArrayElement {}).intern())) Intern::intern_sized(base.join(
TargetPathElement::DynArrayElement(TargetPathDynArrayElement {}).intern(),
))
}), }),
fn simulate(&self, sim_state: &mut SimState) -> _ { fn simulate(&self, sim_state: &mut SimState) -> _ {
todo!() todo!()
} }
fn expr_enum(&self) -> _ { fn expr_enum(&self) -> _ {
ExprEnum::DynArrayIndex(DynArrayIndex::new_unchecked(self.base, self.index).intern_sized()) ExprEnum::DynArrayIndex(
DynArrayIndex::new_unchecked(self.base, self.index).intern_sized(),
)
} }
fn to_literal_bits(&self) -> Result<Interned<BitSlice>, ()> { fn to_literal_bits(&self) -> Result<Interned<BitSlice>, ()> {
@ -1432,7 +1487,11 @@ impl<ElementType: Type> DynArrayIndex<ElementType> {
impl< impl<
VA: ?Sized + ValueArrayOrSlice, VA: ?Sized + ValueArrayOrSlice,
Idx: IntTypeTrait<Signed = ConstBool<false>, CanonicalType = DynUIntType>, Idx: IntTypeTrait<
Signed = ConstBool<false>,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>,
> ExprIndex<IntValue<Idx>> for Array<VA> > ExprIndex<IntValue<Idx>> for Array<VA>
{ {
type OutputValue = VA::Element; type OutputValue = VA::Element;
@ -1445,7 +1504,11 @@ impl<
impl< impl<
VA: ?Sized + ValueArrayOrSlice, VA: ?Sized + ValueArrayOrSlice,
Idx: IntTypeTrait<Signed = ConstBool<false>, CanonicalType = DynUIntType>, Idx: IntTypeTrait<
Signed = ConstBool<false>,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>,
> ExprIndex<Expr<IntValue<Idx>>> for Array<VA> > ExprIndex<Expr<IntValue<Idx>>> for Array<VA>
{ {
type OutputValue = VA::Element; type OutputValue = VA::Element;
@ -1555,7 +1618,8 @@ fixed_ary_op! {
ty ty
}, },
#[cache] #[cache]
literal_bits: Result<Interned<BitSlice>, ()> = ty.variant_to_bits(variant_index, variant_value.as_ref()), literal_bits: Result<Interned<BitSlice>, ()> =
ty.variant_to_bits(variant_index, variant_value.as_ref()),
fn simulate(&self, sim_state: &mut SimState) -> _ { fn simulate(&self, sim_state: &mut SimState) -> _ {
todo!() todo!()
} }

View file

@ -35,7 +35,13 @@ pub type Int<Signed, const WIDTH: usize> = IntValue<IntType<Signed, WIDTH>>;
pub type UInt<const WIDTH: usize> = Int<ConstBool<false>, WIDTH>; pub type UInt<const WIDTH: usize> = Int<ConstBool<false>, WIDTH>;
pub type SInt<const WIDTH: usize> = Int<ConstBool<true>, WIDTH>; pub type SInt<const WIDTH: usize> = Int<ConstBool<true>, WIDTH>;
impl<T: IntTypeTrait> ToExpr for IntValue<T> { impl<
T: IntTypeTrait<
CanonicalType = DynIntType<<T as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<T as IntTypeTrait>::Signed>,
>,
> ToExpr for IntValue<T>
{
type Type = T; type Type = T;
fn ty(&self) -> Self::Type { fn ty(&self) -> Self::Type {
@ -47,13 +53,25 @@ impl<T: IntTypeTrait> ToExpr for IntValue<T> {
} }
} }
impl<T: IntTypeTrait> fmt::Display for IntValue<T> { impl<
T: IntTypeTrait<
CanonicalType = DynIntType<<T as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<T as IntTypeTrait>::Signed>,
>,
> fmt::Display for IntValue<T>
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.to_canonical(), f) fmt::Debug::fmt(&self.to_canonical(), f)
} }
} }
impl<T: IntTypeTrait> fmt::Debug for IntValue<T> { impl<
T: IntTypeTrait<
CanonicalType = DynIntType<<T as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<T as IntTypeTrait>::Signed>,
>,
> fmt::Debug for IntValue<T>
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let neg; let neg;
let (sign, magnitude) = if self.is_negative() { let (sign, magnitude) = if self.is_negative() {
@ -93,7 +111,13 @@ impl<Signed: GenericConstBool> DynInt<Signed> {
} }
} }
impl<T: IntTypeTrait> IntValue<T> { impl<
T: IntTypeTrait<
CanonicalType = DynIntType<<T as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<T as IntTypeTrait>::Signed>,
>,
> IntValue<T>
{
pub fn with_type<I: Into<BigInt>>(ty: T, value: I) -> Self { pub fn with_type<I: Into<BigInt>>(ty: T, value: I) -> Self {
let int_type = ty.canonical(); let int_type = ty.canonical();
let mut value: BigInt = value.into(); let mut value: BigInt = value.into();
@ -172,14 +196,30 @@ impl<T: IntTypeTrait> IntValue<T> {
let width = self.ty.width(); let width = self.ty.width();
T::Signed::VALUE && width > 0 && self.uint_value.bit((width - 1).try_into().unwrap()) T::Signed::VALUE && width > 0 && self.uint_value.bit((width - 1).try_into().unwrap())
} }
pub fn into_cast<NewType: IntTypeTrait>(self, new_type: NewType) -> IntValue<NewType> { pub fn into_cast<
NewType: IntTypeTrait<
CanonicalType = DynIntType<<NewType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<NewType as IntTypeTrait>::Signed>,
>,
>(
self,
new_type: NewType,
) -> IntValue<NewType> {
if new_type.width() > self.ty.width() && self.is_negative() { if new_type.width() > self.ty.width() && self.is_negative() {
IntValue::with_type(new_type, self.into_value()) IntValue::with_type(new_type, self.into_value())
} else { } else {
IntValue::with_type(new_type, self.into_uint_value()) IntValue::with_type(new_type, self.into_uint_value())
} }
} }
pub fn cast<NewType: IntTypeTrait>(&self, new_type: NewType) -> IntValue<NewType> { pub fn cast<
NewType: IntTypeTrait<
CanonicalType = DynIntType<<NewType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<NewType as IntTypeTrait>::Signed>,
>,
>(
&self,
new_type: NewType,
) -> IntValue<NewType> {
if new_type.width() > self.ty.width() && self.is_negative() { if new_type.width() > self.ty.width() && self.is_negative() {
IntValue::with_type(new_type, self.value()) IntValue::with_type(new_type, self.value())
} else { } else {
@ -221,7 +261,14 @@ impl<T: IntTypeTrait> IntValue<T> {
assert!(index < self.ty.width(), "bit index out of range"); assert!(index < self.ty.width(), "bit index out of range");
self.uint_value.set_bit(index.try_into().unwrap(), value) self.uint_value.set_bit(index.try_into().unwrap(), value)
} }
pub fn set_slice<I: RangeBounds<usize>, RhsType: IntTypeTrait<Signed = ConstBool<false>>>( pub fn set_slice<
I: RangeBounds<usize>,
RhsType: IntTypeTrait<
Signed = ConstBool<false>,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>,
>(
&mut self, &mut self,
index: I, index: I,
value: impl Into<IntValue<RhsType>>, value: impl Into<IntValue<RhsType>>,
@ -240,7 +287,11 @@ impl<T: IntTypeTrait> IntValue<T> {
} }
pub fn with_replaced_slice< pub fn with_replaced_slice<
I: RangeBounds<usize>, I: RangeBounds<usize>,
RhsType: IntTypeTrait<Signed = ConstBool<false>>, RhsType: IntTypeTrait<
Signed = ConstBool<false>,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>,
>( >(
mut self, mut self,
index: I, index: I,
@ -249,7 +300,12 @@ impl<T: IntTypeTrait> IntValue<T> {
self.set_slice(index, value); self.set_slice(index, value);
self self
} }
pub fn concat<HighType: IntTypeTrait>( pub fn concat<
HighType: IntTypeTrait<
CanonicalType = DynIntType<<HighType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<HighType as IntTypeTrait>::Signed>,
>,
>(
&self, &self,
high_part: IntValue<HighType>, high_part: IntValue<HighType>,
) -> IntValue<DynIntType<HighType::Signed>> { ) -> IntValue<DynIntType<HighType::Signed>> {
@ -279,7 +335,13 @@ impl<T: IntTypeTrait> IntValue<T> {
} }
} }
impl<Ty: IntTypeTrait> Value for IntValue<Ty> { impl<
Ty: IntTypeTrait<
CanonicalType = DynIntType<<Ty as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<Ty as IntTypeTrait>::Signed>,
>,
> Value for IntValue<Ty>
{
fn to_canonical(&self) -> <Self::Type as Type>::CanonicalValue { fn to_canonical(&self) -> <Self::Type as Type>::CanonicalValue {
IntValue { IntValue {
ty: self.ty.canonical(), ty: self.ty.canonical(),
@ -295,7 +357,13 @@ impl<Ty: IntTypeTrait> Value for IntValue<Ty> {
} }
} }
impl<T> Copy for ToBitsMemoize<T> {} impl<T> Copy for ToBitsMemoize<T> {}
impl<Ty: IntTypeTrait> Memoize for ToBitsMemoize<IntValue<Ty>> { impl<
Ty: IntTypeTrait<
CanonicalType = DynIntType<<Ty as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<Ty as IntTypeTrait>::Signed>,
>,
> Memoize for ToBitsMemoize<IntValue<Ty>>
{
type Input = IntValue<Ty>; type Input = IntValue<Ty>;
type InputOwned = IntValue<Ty>; type InputOwned = IntValue<Ty>;
type Output = Interned<BitSlice>; type Output = Interned<BitSlice>;
@ -321,8 +389,15 @@ macro_rules! impl_add_sub {
($Op:ident::$op:ident) => { ($Op:ident::$op:ident) => {
impl<LhsType, RhsType> $Op<IntValue<RhsType>> for IntValue<LhsType> impl<LhsType, RhsType> $Op<IntValue<RhsType>> for IntValue<LhsType>
where where
LhsType: IntTypeTrait, LhsType: IntTypeTrait<
RhsType: IntTypeTrait<Signed = <LhsType as IntTypeTrait>::Signed>, CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>,
>,
RhsType: IntTypeTrait<
Signed = <LhsType as IntTypeTrait>::Signed,
CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>,
>,
{ {
type Output = IntValue<DynIntType<LhsType::Signed>>; type Output = IntValue<DynIntType<LhsType::Signed>>;
@ -334,8 +409,15 @@ macro_rules! impl_add_sub {
impl<LhsType, RhsType> $Op<Valueless<RhsType>> for Valueless<LhsType> impl<LhsType, RhsType> $Op<Valueless<RhsType>> for Valueless<LhsType>
where where
LhsType: IntTypeTrait, LhsType: IntTypeTrait<
RhsType: IntTypeTrait<Signed = <LhsType as IntTypeTrait>::Signed>, CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>,
>,
RhsType: IntTypeTrait<
Signed = <LhsType as IntTypeTrait>::Signed,
CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>,
>,
{ {
type Output = Valueless<DynIntType<LhsType::Signed>>; type Output = Valueless<DynIntType<LhsType::Signed>>;
@ -357,8 +439,16 @@ macro_rules! impl_bitwise {
($Op:ident::$op:ident) => { ($Op:ident::$op:ident) => {
impl< impl<
Signed: GenericConstBool, Signed: GenericConstBool,
LhsType: IntTypeTrait<Signed = Signed>, LhsType: IntTypeTrait<
RhsType: IntTypeTrait<Signed = Signed>, Signed = Signed,
CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>,
>,
RhsType: IntTypeTrait<
Signed = Signed,
CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>,
>,
> $Op<IntValue<RhsType>> for IntValue<LhsType> > $Op<IntValue<RhsType>> for IntValue<LhsType>
{ {
type Output = IntValue<DynIntType<Signed>>; type Output = IntValue<DynIntType<Signed>>;
@ -371,8 +461,16 @@ macro_rules! impl_bitwise {
impl< impl<
Signed: GenericConstBool, Signed: GenericConstBool,
LhsType: IntTypeTrait<Signed = Signed>, LhsType: IntTypeTrait<
RhsType: IntTypeTrait<Signed = Signed>, Signed = Signed,
CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>,
>,
RhsType: IntTypeTrait<
Signed = Signed,
CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>,
>,
> $Op<Valueless<RhsType>> for Valueless<LhsType> > $Op<Valueless<RhsType>> for Valueless<LhsType>
{ {
type Output = Valueless<DynIntType<Signed>>; type Output = Valueless<DynIntType<Signed>>;
@ -390,8 +488,16 @@ impl_add_sub!(Sub::sub);
impl< impl<
Signed: GenericConstBool, Signed: GenericConstBool,
LhsType: IntTypeTrait<Signed = Signed>, LhsType: IntTypeTrait<
RhsType: IntTypeTrait<Signed = Signed>, Signed = Signed,
CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>,
>,
RhsType: IntTypeTrait<
Signed = Signed,
CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>,
>,
> Mul<IntValue<RhsType>> for IntValue<LhsType> > Mul<IntValue<RhsType>> for IntValue<LhsType>
{ {
type Output = IntValue<DynIntType<Signed>>; type Output = IntValue<DynIntType<Signed>>;
@ -403,8 +509,16 @@ impl<
impl< impl<
Signed: GenericConstBool, Signed: GenericConstBool,
LhsType: IntTypeTrait<Signed = Signed>, LhsType: IntTypeTrait<
RhsType: IntTypeTrait<Signed = Signed>, Signed = Signed,
CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>,
>,
RhsType: IntTypeTrait<
Signed = Signed,
CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>,
>,
> Mul<Valueless<RhsType>> for Valueless<LhsType> > Mul<Valueless<RhsType>> for Valueless<LhsType>
{ {
type Output = Valueless<DynIntType<Signed>>; type Output = Valueless<DynIntType<Signed>>;
@ -425,8 +539,16 @@ impl_bitwise!(BitXor::bitxor);
impl< impl<
Signed: GenericConstBool, Signed: GenericConstBool,
LhsType: IntTypeTrait<Signed = Signed>, LhsType: IntTypeTrait<
RhsType: IntTypeTrait<Signed = ConstBool<false>>, Signed = Signed,
CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>,
>,
RhsType: IntTypeTrait<
Signed = ConstBool<false>,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>,
> Shl<IntValue<RhsType>> for IntValue<LhsType> > Shl<IntValue<RhsType>> for IntValue<LhsType>
{ {
type Output = IntValue<DynIntType<Signed>>; type Output = IntValue<DynIntType<Signed>>;
@ -447,8 +569,16 @@ impl<
impl< impl<
Signed: GenericConstBool, Signed: GenericConstBool,
LhsType: IntTypeTrait<Signed = Signed>, LhsType: IntTypeTrait<
RhsType: IntTypeTrait<Signed = ConstBool<false>>, Signed = Signed,
CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>,
>,
RhsType: IntTypeTrait<
Signed = ConstBool<false>,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>,
> Shl<Valueless<RhsType>> for Valueless<LhsType> > Shl<Valueless<RhsType>> for Valueless<LhsType>
{ {
type Output = Valueless<DynIntType<Signed>>; type Output = Valueless<DynIntType<Signed>>;
@ -469,8 +599,16 @@ impl<
impl< impl<
Signed: GenericConstBool, Signed: GenericConstBool,
LhsType: IntTypeTrait<Signed = Signed>, LhsType: IntTypeTrait<
RhsType: IntTypeTrait<Signed = ConstBool<false>>, Signed = Signed,
CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>,
>,
RhsType: IntTypeTrait<
Signed = ConstBool<false>,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>,
> Shr<IntValue<RhsType>> for IntValue<LhsType> > Shr<IntValue<RhsType>> for IntValue<LhsType>
{ {
type Output = IntValue<DynIntType<Signed>>; type Output = IntValue<DynIntType<Signed>>;
@ -488,8 +626,12 @@ impl<
impl< impl<
Signed: GenericConstBool, Signed: GenericConstBool,
LhsType: IntTypeTrait<Signed = Signed>, LhsType: IntTypeTrait<Signed = Signed, CanonicalType = DynIntType<Signed>>,
RhsType: IntTypeTrait<Signed = ConstBool<false>>, RhsType: IntTypeTrait<
Signed = ConstBool<false>,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>,
> Shr<Valueless<RhsType>> for Valueless<LhsType> > Shr<Valueless<RhsType>> for Valueless<LhsType>
{ {
type Output = Valueless<DynIntType<Signed>>; type Output = Valueless<DynIntType<Signed>>;
@ -501,8 +643,14 @@ impl<
} }
} }
impl<Signed: GenericConstBool, LhsType: IntTypeTrait<Signed = Signed>> Shl<usize> impl<
for IntValue<LhsType> Signed: GenericConstBool,
LhsType: IntTypeTrait<
Signed = Signed,
CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>,
>,
> Shl<usize> for IntValue<LhsType>
{ {
type Output = IntValue<DynIntType<Signed>>; type Output = IntValue<DynIntType<Signed>>;
@ -512,8 +660,14 @@ impl<Signed: GenericConstBool, LhsType: IntTypeTrait<Signed = Signed>> Shl<usize
} }
} }
impl<Signed: GenericConstBool, LhsType: IntTypeTrait<Signed = Signed>> Shl<usize> impl<
for Valueless<LhsType> Signed: GenericConstBool,
LhsType: IntTypeTrait<
Signed = Signed,
CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>,
>,
> Shl<usize> for Valueless<LhsType>
{ {
type Output = Valueless<DynIntType<Signed>>; type Output = Valueless<DynIntType<Signed>>;
@ -528,8 +682,14 @@ impl<Signed: GenericConstBool, LhsType: IntTypeTrait<Signed = Signed>> Shl<usize
} }
} }
impl<Signed: GenericConstBool, LhsType: IntTypeTrait<Signed = Signed>> Shr<usize> impl<
for IntValue<LhsType> Signed: GenericConstBool,
LhsType: IntTypeTrait<
Signed = Signed,
CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>,
>,
> Shr<usize> for IntValue<LhsType>
{ {
type Output = IntValue<DynIntType<Signed>>; type Output = IntValue<DynIntType<Signed>>;
@ -541,8 +701,14 @@ impl<Signed: GenericConstBool, LhsType: IntTypeTrait<Signed = Signed>> Shr<usize
} }
} }
impl<Signed: GenericConstBool, LhsType: IntTypeTrait<Signed = Signed>> Shr<usize> impl<
for Valueless<LhsType> Signed: GenericConstBool,
LhsType: IntTypeTrait<
Signed = Signed,
CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>,
>,
> Shr<usize> for Valueless<LhsType>
{ {
type Output = Valueless<DynIntType<Signed>>; type Output = Valueless<DynIntType<Signed>>;
@ -552,7 +718,14 @@ impl<Signed: GenericConstBool, LhsType: IntTypeTrait<Signed = Signed>> Shr<usize
} }
} }
impl<T: IntTypeTrait<Signed = ConstBool<true>>> Neg for IntValue<T> { impl<
T: IntTypeTrait<
Signed = ConstBool<true>,
CanonicalType = DynSIntType,
CanonicalValue = DynSInt,
>,
> Neg for IntValue<T>
{
type Output = IntValue<DynSIntType>; type Output = IntValue<DynSIntType>;
fn neg(self) -> Self::Output { fn neg(self) -> Self::Output {
let ty = self.valueless().neg().ty; let ty = self.valueless().neg().ty;
@ -560,7 +733,14 @@ impl<T: IntTypeTrait<Signed = ConstBool<true>>> Neg for IntValue<T> {
} }
} }
impl<T: IntTypeTrait<Signed = ConstBool<true>>> Neg for Valueless<T> { impl<
T: IntTypeTrait<
Signed = ConstBool<true>,
CanonicalType = DynSIntType,
CanonicalValue = DynSInt,
>,
> Neg for Valueless<T>
{
type Output = Valueless<DynSIntType>; type Output = Valueless<DynSIntType>;
fn neg(self) -> Self::Output { fn neg(self) -> Self::Output {
let ty = DynIntType::new( let ty = DynIntType::new(
@ -573,14 +753,26 @@ impl<T: IntTypeTrait<Signed = ConstBool<true>>> Neg for Valueless<T> {
} }
} }
impl<T: IntTypeTrait> Not for IntValue<T> { impl<
T: IntTypeTrait<
CanonicalType = DynIntType<<T as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<T as IntTypeTrait>::Signed>,
>,
> Not for IntValue<T>
{
type Output = IntValue<T>; type Output = IntValue<T>;
fn not(self) -> Self::Output { fn not(self) -> Self::Output {
IntValue::with_type(self.valueless().not().ty, Not::not(self.into_value())) IntValue::with_type(self.valueless().not().ty, Not::not(self.into_value()))
} }
} }
impl<T: IntTypeTrait> Not for Valueless<T> { impl<
T: IntTypeTrait<
CanonicalType = DynIntType<<T as IntTypeTrait>::Signed>,
CanonicalValue = DynInt<<T as IntTypeTrait>::Signed>,
>,
> Not for Valueless<T>
{
type Output = Valueless<T>; type Output = Valueless<T>;
fn not(self) -> Self::Output { fn not(self) -> Self::Output {
self self
@ -626,7 +818,15 @@ impl_int!(i32, true);
impl_int!(i64, true); impl_int!(i64, true);
impl_int!(i128, true); impl_int!(i128, true);
impl<T: FixedOrDynIntType<1, Signed = ConstBool<false>>> From<bool> for IntValue<T> { impl<
T: FixedOrDynIntType<
1,
Signed = ConstBool<false>,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>,
> From<bool> for IntValue<T>
{
fn from(v: bool) -> Self { fn from(v: bool) -> Self {
IntValue::with_type(T::new(), v) IntValue::with_type(T::new(), v)
} }
@ -665,11 +865,7 @@ pub trait IntTypeTrait:
+ Eq + Eq
+ Hash + Hash
+ fmt::Debug + fmt::Debug
+ Type< + Type<Value = IntValue<Self>>
Value = IntValue<Self>,
CanonicalType = DynIntType<<Self as IntTypeTrait>::Signed>,
CanonicalValue = IntValue<DynIntType<<Self as IntTypeTrait>::Signed>>,
>
+ Connect<Self> + Connect<Self>
+ Connect<DynIntType<<Self as IntTypeTrait>::Signed>> + Connect<DynIntType<<Self as IntTypeTrait>::Signed>>
{ {
@ -678,11 +874,15 @@ pub trait IntTypeTrait:
Signed = ConstBool<false>, Signed = ConstBool<false>,
SameWidthUInt = Self::SameWidthUInt, SameWidthUInt = Self::SameWidthUInt,
SameWidthSInt = Self::SameWidthSInt, SameWidthSInt = Self::SameWidthSInt,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>; >;
type SameWidthSInt: IntTypeTrait< type SameWidthSInt: IntTypeTrait<
Signed = ConstBool<true>, Signed = ConstBool<true>,
SameWidthUInt = Self::SameWidthUInt, SameWidthUInt = Self::SameWidthUInt,
SameWidthSInt = Self::SameWidthSInt, SameWidthSInt = Self::SameWidthSInt,
CanonicalType = DynSIntType,
CanonicalValue = DynSInt,
>; >;
fn from_width_unchecked(width: usize) -> Self; fn from_width_unchecked(width: usize) -> Self;
fn width(self) -> usize; fn width(self) -> usize;
@ -735,12 +935,12 @@ pub trait IntTypeTrait:
start..end start..end
} }
fn slice_and_shift<I: RangeBounds<usize>>(self, index: I) -> (DynUIntType, usize) { fn slice_and_shift<I: RangeBounds<usize>>(self, index: I) -> (DynUIntType, usize) {
let range = self.canonical().slice_index_to_range(index); let range = self.slice_index_to_range(index);
let width = range.end - range.start; let width = range.end - range.start;
(DynUIntType::new(width), range.start) (DynUIntType::new(width), range.start)
} }
fn slice<I: RangeBounds<usize>>(self, index: I) -> DynUIntType { fn slice<I: RangeBounds<usize>>(self, index: I) -> DynUIntType {
self.canonical().slice_and_shift(index).0 self.slice_and_shift(index).0
} }
} }

View file

@ -11,7 +11,7 @@ use crate::{
ops::VariantAccess, Expr, Flow, Target, TargetBase, TargetPathArrayElement, ops::VariantAccess, Expr, Flow, Target, TargetBase, TargetPathArrayElement,
TargetPathBundleField, TargetPathElement, ToExpr, TargetPathBundleField, TargetPathElement, ToExpr,
}, },
int::{FixedOrDynIntType, UInt}, int::{DynUInt, DynUIntType, FixedOrDynIntType, UInt},
intern::{Intern, Interned}, intern::{Intern, Interned},
memory::{Mem, MemBuilder, MemBuilderTarget, PortName}, memory::{Mem, MemBuilder, MemBuilderTarget, PortName},
reg::Reg, reg::Reg,
@ -2254,7 +2254,12 @@ where
#[track_caller] #[track_caller]
pub fn if_<Ty>(&mut self, cond: impl ToExpr<Type = Ty>) -> IfScope pub fn if_<Ty>(&mut self, cond: impl ToExpr<Type = Ty>) -> IfScope
where where
Ty: FixedOrDynIntType<1, Signed = ConstBool<false>>, Ty: FixedOrDynIntType<
1,
Signed = ConstBool<false>,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>,
{ {
self.if_with_loc(cond, SourceLocation::caller()) self.if_with_loc(cond, SourceLocation::caller())
} }
@ -2264,7 +2269,12 @@ where
source_location: SourceLocation, source_location: SourceLocation,
) -> IfScope ) -> IfScope
where where
Ty: FixedOrDynIntType<1, Signed = ConstBool<false>>, Ty: FixedOrDynIntType<
1,
Signed = ConstBool<false>,
CanonicalType = DynUIntType,
CanonicalValue = DynUInt,
>,
{ {
let cond = cond.to_expr().as_bool(); let cond = cond.to_expr().as_bool();
let outer_block = self.block_stack.top(); let outer_block = self.block_stack.top();

View file

@ -11,7 +11,10 @@ use crate::{
ops, Expr, ExprEnum, Literal, Target, TargetBase, TargetChild, TargetPathArrayElement, ops, Expr, ExprEnum, Literal, Target, TargetBase, TargetChild, TargetPathArrayElement,
TargetPathBundleField, TargetPathDynArrayElement, TargetPathElement, ToExpr, TargetPathBundleField, TargetPathDynArrayElement, TargetPathElement, ToExpr,
}, },
int::{DynInt, DynIntType, FixedOrDynIntType, IntType, IntTypeTrait}, int::{
DynInt, DynIntType, DynSInt, DynSIntType, DynUInt, DynUIntType, FixedOrDynIntType, IntType,
IntTypeTrait,
},
intern::{Intern, Interned}, intern::{Intern, Interned},
memory::{Mem, MemPort, PortKind, PortName, PortType, ReadUnderWrite}, memory::{Mem, MemPort, PortKind, PortName, PortType, ReadUnderWrite},
module::{ module::{

View file

@ -68,10 +68,9 @@ impl<T: IntTypeTrait> Valueless<T> {
&self, &self,
high_part: Valueless<HighType>, high_part: Valueless<HighType>,
) -> Valueless<DynIntType<HighType::Signed>> { ) -> Valueless<DynIntType<HighType::Signed>> {
let self_type = self.ty.canonical();
let ty = DynIntType::new( let ty = DynIntType::new(
self_type self.ty
.width .width()
.checked_add(high_part.ty.width()) .checked_add(high_part.ty.width())
.expect("result has too many bits"), .expect("result has too many bits"),
); );

View file

@ -376,7 +376,7 @@
"$constructor": "ops::Not::new_unchecked", "$constructor": "ops::Not::new_unchecked",
"arg": "Visible" "arg": "Visible"
}, },
"generics": "<T: IntTypeTrait>" "generics": "<T: IntTypeTrait<CanonicalType = DynIntType<<T as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<T as IntTypeTrait>::Signed>>>"
}, },
"ops::Neg": { "ops::Neg": {
"data": { "data": {
@ -384,7 +384,7 @@
"$constructor": "ops::Neg::new_unchecked", "$constructor": "ops::Neg::new_unchecked",
"arg": "Visible" "arg": "Visible"
}, },
"generics": "<T: IntTypeTrait<Signed = ConstBool<true>>>" "generics": "<T: IntTypeTrait<Signed = ConstBool<true>, CanonicalType = DynSIntType, CanonicalValue = DynSInt>>"
}, },
"ops::BitAnd": { "ops::BitAnd": {
"data": { "data": {
@ -395,7 +395,7 @@
}, },
"generics": { "generics": {
"generics": "<L, R>", "generics": "<L, R>",
"where": "L: IntTypeTrait, R: IntTypeTrait<Signed = L::Signed>" "where": "L: IntTypeTrait<CanonicalType = DynIntType<<L as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<L as IntTypeTrait>::Signed>>, R: IntTypeTrait<Signed = L::Signed, CanonicalType = DynIntType<<R as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<R as IntTypeTrait>::Signed>>"
} }
}, },
"ops::BitOr": { "ops::BitOr": {
@ -407,7 +407,7 @@
}, },
"generics": { "generics": {
"generics": "<L, R>", "generics": "<L, R>",
"where": "L: IntTypeTrait, R: IntTypeTrait<Signed = L::Signed>" "where": "L: IntTypeTrait<CanonicalType = DynIntType<<L as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<L as IntTypeTrait>::Signed>>, R: IntTypeTrait<Signed = L::Signed, CanonicalType = DynIntType<<R as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<R as IntTypeTrait>::Signed>>"
} }
}, },
"ops::BitXor": { "ops::BitXor": {
@ -419,7 +419,7 @@
}, },
"generics": { "generics": {
"generics": "<L, R>", "generics": "<L, R>",
"where": "L: IntTypeTrait, R: IntTypeTrait<Signed = L::Signed>" "where": "L: IntTypeTrait<CanonicalType = DynIntType<<L as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<L as IntTypeTrait>::Signed>>, R: IntTypeTrait<Signed = L::Signed, CanonicalType = DynIntType<<R as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<R as IntTypeTrait>::Signed>>"
} }
}, },
"ops::Add": { "ops::Add": {
@ -431,7 +431,7 @@
}, },
"generics": { "generics": {
"generics": "<L, R>", "generics": "<L, R>",
"where": "L: IntTypeTrait, R: IntTypeTrait<Signed = L::Signed>" "where": "L: IntTypeTrait<CanonicalType = DynIntType<<L as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<L as IntTypeTrait>::Signed>>, R: IntTypeTrait<Signed = L::Signed, CanonicalType = DynIntType<<R as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<R as IntTypeTrait>::Signed>>"
} }
}, },
"ops::Sub": { "ops::Sub": {
@ -443,7 +443,7 @@
}, },
"generics": { "generics": {
"generics": "<L, R>", "generics": "<L, R>",
"where": "L: IntTypeTrait, R: IntTypeTrait<Signed = L::Signed>" "where": "L: IntTypeTrait<CanonicalType = DynIntType<<L as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<L as IntTypeTrait>::Signed>>, R: IntTypeTrait<Signed = L::Signed, CanonicalType = DynIntType<<R as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<R as IntTypeTrait>::Signed>>"
} }
}, },
"ops::Mul": { "ops::Mul": {
@ -455,7 +455,7 @@
}, },
"generics": { "generics": {
"generics": "<L, R>", "generics": "<L, R>",
"where": "L: IntTypeTrait, R: IntTypeTrait<Signed = L::Signed>" "where": "L: IntTypeTrait<CanonicalType = DynIntType<<L as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<L as IntTypeTrait>::Signed>>, R: IntTypeTrait<Signed = L::Signed, CanonicalType = DynIntType<<R as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<R as IntTypeTrait>::Signed>>"
} }
}, },
"ops::DynShl": { "ops::DynShl": {
@ -465,7 +465,7 @@
"lhs": "Visible", "lhs": "Visible",
"rhs": "Visible" "rhs": "Visible"
}, },
"generics": "<LhsType: IntTypeTrait>" "generics": "<LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>>"
}, },
"ops::DynShr": { "ops::DynShr": {
"data": { "data": {
@ -474,7 +474,7 @@
"lhs": "Visible", "lhs": "Visible",
"rhs": "Visible" "rhs": "Visible"
}, },
"generics": "<LhsType: IntTypeTrait>" "generics": "<LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>>"
}, },
"ops::FixedShl": { "ops::FixedShl": {
"data": { "data": {
@ -483,7 +483,7 @@
"lhs": "Visible", "lhs": "Visible",
"rhs": "Visible" "rhs": "Visible"
}, },
"generics": "<LhsType: IntTypeTrait>" "generics": "<LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>>"
}, },
"ops::FixedShr": { "ops::FixedShr": {
"data": { "data": {
@ -492,7 +492,7 @@
"lhs": "Visible", "lhs": "Visible",
"rhs": "Visible" "rhs": "Visible"
}, },
"generics": "<LhsType: IntTypeTrait>" "generics": "<LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>>"
}, },
"ops::CmpLt": { "ops::CmpLt": {
"data": { "data": {
@ -501,7 +501,7 @@
"lhs": "Visible", "lhs": "Visible",
"rhs": "Visible" "rhs": "Visible"
}, },
"generics": "<LhsType: IntTypeTrait, RhsType: IntTypeTrait<Signed = LhsType::Signed>, Output: FixedOrDynIntType<1, Signed = ConstBool<false>>>" "generics": "<LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>, RhsType: IntTypeTrait<Signed = LhsType::Signed, CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>>, Output: FixedOrDynIntType<1, Signed = ConstBool<false>, CanonicalType = DynUIntType, CanonicalValue = DynUInt>>"
}, },
"ops::CmpLe": { "ops::CmpLe": {
"data": { "data": {
@ -510,7 +510,7 @@
"lhs": "Visible", "lhs": "Visible",
"rhs": "Visible" "rhs": "Visible"
}, },
"generics": "<LhsType: IntTypeTrait, RhsType: IntTypeTrait<Signed = LhsType::Signed>, Output: FixedOrDynIntType<1, Signed = ConstBool<false>>>" "generics": "<LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>, RhsType: IntTypeTrait<Signed = LhsType::Signed, CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>>, Output: FixedOrDynIntType<1, Signed = ConstBool<false>, CanonicalType = DynUIntType, CanonicalValue = DynUInt>>"
}, },
"ops::CmpGt": { "ops::CmpGt": {
"data": { "data": {
@ -519,7 +519,7 @@
"lhs": "Visible", "lhs": "Visible",
"rhs": "Visible" "rhs": "Visible"
}, },
"generics": "<LhsType: IntTypeTrait, RhsType: IntTypeTrait<Signed = LhsType::Signed>, Output: FixedOrDynIntType<1, Signed = ConstBool<false>>>" "generics": "<LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>, RhsType: IntTypeTrait<Signed = LhsType::Signed, CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>>, Output: FixedOrDynIntType<1, Signed = ConstBool<false>, CanonicalType = DynUIntType, CanonicalValue = DynUInt>>"
}, },
"ops::CmpGe": { "ops::CmpGe": {
"data": { "data": {
@ -528,7 +528,7 @@
"lhs": "Visible", "lhs": "Visible",
"rhs": "Visible" "rhs": "Visible"
}, },
"generics": "<LhsType: IntTypeTrait, RhsType: IntTypeTrait<Signed = LhsType::Signed>, Output: FixedOrDynIntType<1, Signed = ConstBool<false>>>" "generics": "<LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>, RhsType: IntTypeTrait<Signed = LhsType::Signed, CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>>, Output: FixedOrDynIntType<1, Signed = ConstBool<false>, CanonicalType = DynUIntType, CanonicalValue = DynUInt>>"
}, },
"ops::CmpEq": { "ops::CmpEq": {
"data": { "data": {
@ -537,7 +537,7 @@
"lhs": "Visible", "lhs": "Visible",
"rhs": "Visible" "rhs": "Visible"
}, },
"generics": "<LhsType: IntTypeTrait, RhsType: IntTypeTrait<Signed = LhsType::Signed>, Output: FixedOrDynIntType<1, Signed = ConstBool<false>>>" "generics": "<LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>, RhsType: IntTypeTrait<Signed = LhsType::Signed, CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>>, Output: FixedOrDynIntType<1, Signed = ConstBool<false>, CanonicalType = DynUIntType, CanonicalValue = DynUInt>>"
}, },
"ops::CmpNe": { "ops::CmpNe": {
"data": { "data": {
@ -546,7 +546,7 @@
"lhs": "Visible", "lhs": "Visible",
"rhs": "Visible" "rhs": "Visible"
}, },
"generics": "<LhsType: IntTypeTrait, RhsType: IntTypeTrait<Signed = LhsType::Signed>, Output: FixedOrDynIntType<1, Signed = ConstBool<false>>>" "generics": "<LhsType: IntTypeTrait<CanonicalType = DynIntType<<LhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<LhsType as IntTypeTrait>::Signed>>, RhsType: IntTypeTrait<Signed = LhsType::Signed, CanonicalType = DynIntType<<RhsType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<RhsType as IntTypeTrait>::Signed>>, Output: FixedOrDynIntType<1, Signed = ConstBool<false>, CanonicalType = DynUIntType, CanonicalValue = DynUInt>>"
}, },
"ops::CastInt": { "ops::CastInt": {
"data": { "data": {
@ -555,7 +555,7 @@
"value": "Visible", "value": "Visible",
"ty()": "Visible" "ty()": "Visible"
}, },
"generics": "<FromType: IntTypeTrait, ToType: IntTypeTrait>", "generics": "<FromType: IntTypeTrait<CanonicalType = DynIntType<<FromType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<FromType as IntTypeTrait>::Signed>>, ToType: IntTypeTrait<CanonicalType = DynIntType<<ToType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<ToType as IntTypeTrait>::Signed>>>",
"fold_where": "ToType: Fold<State>", "fold_where": "ToType: Fold<State>",
"visit_where": "ToType: Visit<State>" "visit_where": "ToType: Visit<State>"
}, },
@ -566,7 +566,7 @@
"base": "Visible", "base": "Visible",
"range": "Opaque" "range": "Opaque"
}, },
"generics": "<Base: IntTypeTrait>" "generics": "<Base: IntTypeTrait<CanonicalType = DynIntType<<Base as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<Base as IntTypeTrait>::Signed>>>"
}, },
"ops::ReduceBitAnd": { "ops::ReduceBitAnd": {
"data": { "data": {
@ -574,7 +574,7 @@
"$constructor": "ops::ReduceBitAnd::new_unchecked", "$constructor": "ops::ReduceBitAnd::new_unchecked",
"arg": "Visible" "arg": "Visible"
}, },
"generics": "<Output: FixedOrDynIntType<1, Signed = ConstBool<false>>>" "generics": "<Output: FixedOrDynIntType<1, Signed = ConstBool<false>, CanonicalType = DynUIntType, CanonicalValue = DynUInt>>"
}, },
"ops::ReduceBitOr": { "ops::ReduceBitOr": {
"data": { "data": {
@ -582,7 +582,7 @@
"$constructor": "ops::ReduceBitOr::new_unchecked", "$constructor": "ops::ReduceBitOr::new_unchecked",
"arg": "Visible" "arg": "Visible"
}, },
"generics": "<Output: FixedOrDynIntType<1, Signed = ConstBool<false>>>" "generics": "<Output: FixedOrDynIntType<1, Signed = ConstBool<false>, CanonicalType = DynUIntType, CanonicalValue = DynUInt>>"
}, },
"ops::ReduceBitXor": { "ops::ReduceBitXor": {
"data": { "data": {
@ -590,7 +590,7 @@
"$constructor": "ops::ReduceBitXor::new_unchecked", "$constructor": "ops::ReduceBitXor::new_unchecked",
"arg": "Visible" "arg": "Visible"
}, },
"generics": "<Output: FixedOrDynIntType<1, Signed = ConstBool<false>>>" "generics": "<Output: FixedOrDynIntType<1, Signed = ConstBool<false>, CanonicalType = DynUIntType, CanonicalValue = DynUInt>>"
}, },
"ops::FieldAccess": { "ops::FieldAccess": {
"data": { "data": {
@ -696,7 +696,7 @@
"$constructor": "ops::CastClockToBit::new_unchecked", "$constructor": "ops::CastClockToBit::new_unchecked",
"value": "Visible" "value": "Visible"
}, },
"generics": "<ToType: FixedOrDynIntType<1>>" "generics": "<ToType: FixedOrDynIntType<1, CanonicalType = DynIntType<<ToType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<ToType as IntTypeTrait>::Signed>>>"
}, },
"ops::CastSyncResetToBit": { "ops::CastSyncResetToBit": {
"data": { "data": {
@ -704,7 +704,7 @@
"$constructor": "ops::CastSyncResetToBit::new_unchecked", "$constructor": "ops::CastSyncResetToBit::new_unchecked",
"value": "Visible" "value": "Visible"
}, },
"generics": "<ToType: FixedOrDynIntType<1>>" "generics": "<ToType: FixedOrDynIntType<1, CanonicalType = DynIntType<<ToType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<ToType as IntTypeTrait>::Signed>>>"
}, },
"ops::CastAsyncResetToBit": { "ops::CastAsyncResetToBit": {
"data": { "data": {
@ -712,7 +712,7 @@
"$constructor": "ops::CastAsyncResetToBit::new_unchecked", "$constructor": "ops::CastAsyncResetToBit::new_unchecked",
"value": "Visible" "value": "Visible"
}, },
"generics": "<ToType: FixedOrDynIntType<1>>" "generics": "<ToType: FixedOrDynIntType<1, CanonicalType = DynIntType<<ToType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<ToType as IntTypeTrait>::Signed>>>"
}, },
"ops::CastResetToBit": { "ops::CastResetToBit": {
"data": { "data": {
@ -720,7 +720,7 @@
"$constructor": "ops::CastResetToBit::new_unchecked", "$constructor": "ops::CastResetToBit::new_unchecked",
"value": "Visible" "value": "Visible"
}, },
"generics": "<ToType: FixedOrDynIntType<1>>" "generics": "<ToType: FixedOrDynIntType<1, CanonicalType = DynIntType<<ToType as IntTypeTrait>::Signed>, CanonicalValue = DynInt<<ToType as IntTypeTrait>::Signed>>>"
}, },
"BlockId": { "BlockId": {
"data": { "data": {