add a simulator #3

Merged
programmerjake merged 58 commits from adding-simulator into master 2024-12-16 04:06:48 +00:00
Showing only changes of commit 89d84551f8 - Show all commits

View file

@ -2044,6 +2044,7 @@ pub(crate) mod known_items {
impl_known_item!(::fayalite::int::Size); impl_known_item!(::fayalite::int::Size);
impl_known_item!(::fayalite::int::UInt); impl_known_item!(::fayalite::int::UInt);
impl_known_item!(::fayalite::int::UIntType); impl_known_item!(::fayalite::int::UIntType);
impl_known_item!(::fayalite::reset::ResetType);
impl_known_item!(::fayalite::ty::CanonicalType); impl_known_item!(::fayalite::ty::CanonicalType);
impl_known_item!(::fayalite::ty::StaticType); impl_known_item!(::fayalite::ty::StaticType);
impl_known_item!(::fayalite::ty::Type); impl_known_item!(::fayalite::ty::Type);
@ -2239,6 +2240,7 @@ impl_bounds! {
EnumType, EnumType,
IntType, IntType,
KnownSize, KnownSize,
ResetType,
Size, Size,
StaticType, StaticType,
Type, Type,
@ -2252,6 +2254,7 @@ impl_bounds! {
BundleType, BundleType,
EnumType, EnumType,
IntType, IntType,
ResetType,
StaticType, StaticType,
Type, Type,
} }
@ -2264,6 +2267,7 @@ impl From<ParsedTypeBound> for ParsedBound {
ParsedTypeBound::BundleType(v) => ParsedBound::BundleType(v), ParsedTypeBound::BundleType(v) => ParsedBound::BundleType(v),
ParsedTypeBound::EnumType(v) => ParsedBound::EnumType(v), ParsedTypeBound::EnumType(v) => ParsedBound::EnumType(v),
ParsedTypeBound::IntType(v) => ParsedBound::IntType(v), ParsedTypeBound::IntType(v) => ParsedBound::IntType(v),
ParsedTypeBound::ResetType(v) => ParsedBound::ResetType(v),
ParsedTypeBound::StaticType(v) => ParsedBound::StaticType(v), ParsedTypeBound::StaticType(v) => ParsedBound::StaticType(v),
ParsedTypeBound::Type(v) => ParsedBound::Type(v), ParsedTypeBound::Type(v) => ParsedBound::Type(v),
} }
@ -2277,6 +2281,7 @@ impl From<ParsedTypeBounds> for ParsedBounds {
BundleType, BundleType,
EnumType, EnumType,
IntType, IntType,
ResetType,
StaticType, StaticType,
Type, Type,
} = value; } = value;
@ -2286,6 +2291,7 @@ impl From<ParsedTypeBounds> for ParsedBounds {
EnumType, EnumType,
IntType, IntType,
KnownSize: None, KnownSize: None,
ResetType,
Size: None, Size: None,
StaticType, StaticType,
Type, Type,
@ -2314,6 +2320,11 @@ impl ParsedTypeBound {
ParsedTypeBound::BoolOrIntType(known_items::BoolOrIntType(span)), ParsedTypeBound::BoolOrIntType(known_items::BoolOrIntType(span)),
ParsedTypeBound::Type(known_items::Type(span)), ParsedTypeBound::Type(known_items::Type(span)),
]), ]),
Self::ResetType(v) => ParsedTypeBounds::from_iter([
ParsedTypeBound::from(v),
ParsedTypeBound::StaticType(known_items::StaticType(span)),
ParsedTypeBound::Type(known_items::Type(span)),
]),
Self::StaticType(v) => ParsedTypeBounds::from_iter([ Self::StaticType(v) => ParsedTypeBounds::from_iter([
ParsedTypeBound::from(v), ParsedTypeBound::from(v),
ParsedTypeBound::Type(known_items::Type(span)), ParsedTypeBound::Type(known_items::Type(span)),
@ -2349,6 +2360,7 @@ impl From<ParsedSizeTypeBounds> for ParsedBounds {
EnumType: None, EnumType: None,
IntType: None, IntType: None,
KnownSize, KnownSize,
ResetType: None,
Size, Size,
StaticType: None, StaticType: None,
Type: None, Type: None,
@ -2425,6 +2437,7 @@ impl ParsedBound {
Self::EnumType(v) => ParsedBoundCategory::Type(ParsedTypeBound::EnumType(v)), Self::EnumType(v) => ParsedBoundCategory::Type(ParsedTypeBound::EnumType(v)),
Self::IntType(v) => ParsedBoundCategory::Type(ParsedTypeBound::IntType(v)), Self::IntType(v) => ParsedBoundCategory::Type(ParsedTypeBound::IntType(v)),
Self::KnownSize(v) => ParsedBoundCategory::SizeType(ParsedSizeTypeBound::KnownSize(v)), Self::KnownSize(v) => ParsedBoundCategory::SizeType(ParsedSizeTypeBound::KnownSize(v)),
Self::ResetType(v) => ParsedBoundCategory::Type(ParsedTypeBound::ResetType(v)),
Self::Size(v) => ParsedBoundCategory::SizeType(ParsedSizeTypeBound::Size(v)), Self::Size(v) => ParsedBoundCategory::SizeType(ParsedSizeTypeBound::Size(v)),
Self::StaticType(v) => ParsedBoundCategory::Type(ParsedTypeBound::StaticType(v)), Self::StaticType(v) => ParsedBoundCategory::Type(ParsedTypeBound::StaticType(v)),
Self::Type(v) => ParsedBoundCategory::Type(ParsedTypeBound::Type(v)), Self::Type(v) => ParsedBoundCategory::Type(ParsedTypeBound::Type(v)),
@ -3310,7 +3323,8 @@ impl ParsedGenerics {
ParsedTypeBound::BoolOrIntType(_) ParsedTypeBound::BoolOrIntType(_)
| ParsedTypeBound::BundleType(_) | ParsedTypeBound::BundleType(_)
| ParsedTypeBound::EnumType(_) | ParsedTypeBound::EnumType(_)
| ParsedTypeBound::IntType(_) => { | ParsedTypeBound::IntType(_)
| ParsedTypeBound::ResetType(_) => {
errors.error(bound, "bound on mask type not implemented"); errors.error(bound, "bound on mask type not implemented");
} }
ParsedTypeBound::StaticType(bound) => { ParsedTypeBound::StaticType(bound) => {