Upgrade to rust 1.89.0 and Edition 2024 #34
43 changed files with 280 additions and 261 deletions
|
@ -4,6 +4,7 @@ on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deps:
|
deps:
|
||||||
|
runs-on: debian-12
|
||||||
uses: ./.forgejo/workflows/deps.yml
|
uses: ./.forgejo/workflows/deps.yml
|
||||||
test:
|
test:
|
||||||
runs-on: debian-12
|
runs-on: debian-12
|
||||||
|
@ -38,7 +39,7 @@ jobs:
|
||||||
z3 \
|
z3 \
|
||||||
zlib1g-dev
|
zlib1g-dev
|
||||||
- run: |
|
- run: |
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.82.0
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.89.0
|
||||||
source "$HOME/.cargo/env"
|
source "$HOME/.cargo/env"
|
||||||
echo "$PATH" >> "$GITHUB_PATH"
|
echo "$PATH" >> "$GITHUB_PATH"
|
||||||
- uses: https://git.libre-chip.org/mirrors/cache/restore@v3
|
- uses: https://git.libre-chip.org/mirrors/cache/restore@v3
|
||||||
|
|
|
@ -7,11 +7,11 @@ members = ["crates/*"]
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
license = "LGPL-3.0-or-later"
|
license = "LGPL-3.0-or-later"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
repository = "https://git.libre-chip.org/libre-chip/fayalite"
|
repository = "https://git.libre-chip.org/libre-chip/fayalite"
|
||||||
keywords = ["hdl", "hardware", "semiconductors", "firrtl", "fpga"]
|
keywords = ["hdl", "hardware", "semiconductors", "firrtl", "fpga"]
|
||||||
categories = ["simulation", "development-tools", "compilers"]
|
categories = ["simulation", "development-tools", "compilers"]
|
||||||
rust-version = "1.82.0"
|
rust-version = "1.89.0"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
fayalite-proc-macros = { version = "=0.3.0", path = "crates/fayalite-proc-macros" }
|
fayalite-proc-macros = { version = "=0.3.0", path = "crates/fayalite-proc-macros" }
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
// See Notices.txt for copyright information
|
// See Notices.txt for copyright information
|
||||||
use crate::{
|
use crate::{
|
||||||
|
Errors, HdlAttr, PairsIterExt,
|
||||||
hdl_type_common::{
|
hdl_type_common::{
|
||||||
common_derives, get_target, ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedField,
|
ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedField, ParsedFieldsNamed, ParsedGenerics,
|
||||||
ParsedFieldsNamed, ParsedGenerics, SplitForImpl, TypesParser, WrappedInConst,
|
SplitForImpl, TypesParser, WrappedInConst, common_derives, get_target,
|
||||||
},
|
},
|
||||||
kw, Errors, HdlAttr, PairsIterExt,
|
kw,
|
||||||
};
|
};
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::{format_ident, quote_spanned, ToTokens};
|
use quote::{ToTokens, format_ident, quote_spanned};
|
||||||
use syn::{
|
use syn::{
|
||||||
parse_quote, parse_quote_spanned,
|
AngleBracketedGenericArguments, Attribute, Field, FieldMutability, Fields, FieldsNamed,
|
||||||
|
GenericParam, Generics, Ident, ItemStruct, Path, Token, Type, Visibility, parse_quote,
|
||||||
|
parse_quote_spanned,
|
||||||
punctuated::{Pair, Punctuated},
|
punctuated::{Pair, Punctuated},
|
||||||
spanned::Spanned,
|
spanned::Spanned,
|
||||||
token::Brace,
|
token::Brace,
|
||||||
AngleBracketedGenericArguments, Attribute, Field, FieldMutability, Fields, FieldsNamed,
|
|
||||||
GenericParam, Generics, Ident, ItemStruct, Path, Token, Type, Visibility,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
// See Notices.txt for copyright information
|
// See Notices.txt for copyright information
|
||||||
use crate::{
|
use crate::{
|
||||||
|
Errors, HdlAttr, PairsIterExt,
|
||||||
hdl_type_common::{
|
hdl_type_common::{
|
||||||
common_derives, get_target, ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedGenerics,
|
ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedGenerics, ParsedType, SplitForImpl,
|
||||||
ParsedType, SplitForImpl, TypesParser, WrappedInConst,
|
TypesParser, WrappedInConst, common_derives, get_target,
|
||||||
},
|
},
|
||||||
kw, Errors, HdlAttr, PairsIterExt,
|
kw,
|
||||||
};
|
};
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::{format_ident, quote_spanned, ToTokens};
|
use quote::{ToTokens, format_ident, quote_spanned};
|
||||||
use syn::{
|
use syn::{
|
||||||
parse_quote_spanned,
|
Attribute, Field, FieldMutability, Fields, FieldsNamed, FieldsUnnamed, Generics, Ident,
|
||||||
|
ItemEnum, ItemStruct, Token, Type, Variant, Visibility, parse_quote_spanned,
|
||||||
punctuated::{Pair, Punctuated},
|
punctuated::{Pair, Punctuated},
|
||||||
token::{Brace, Paren},
|
token::{Brace, Paren},
|
||||||
Attribute, Field, FieldMutability, Fields, FieldsNamed, FieldsUnnamed, Generics, Ident,
|
|
||||||
ItemEnum, ItemStruct, Token, Type, Variant, Visibility,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
crate::options! {
|
crate::options! {
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
// See Notices.txt for copyright information
|
// See Notices.txt for copyright information
|
||||||
use crate::{
|
use crate::{
|
||||||
|
Errors, HdlAttr,
|
||||||
hdl_type_common::{
|
hdl_type_common::{
|
||||||
get_target, ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedGenerics, ParsedType,
|
ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedGenerics, ParsedType, TypesParser,
|
||||||
TypesParser,
|
get_target,
|
||||||
},
|
},
|
||||||
kw, Errors, HdlAttr,
|
kw,
|
||||||
};
|
};
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::ToTokens;
|
use quote::ToTokens;
|
||||||
use syn::{parse_quote_spanned, Attribute, Generics, Ident, ItemType, Token, Type, Visibility};
|
use syn::{Attribute, Generics, Ident, ItemType, Token, Type, Visibility, parse_quote_spanned};
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub(crate) struct ParsedTypeAlias {
|
pub(crate) struct ParsedTypeAlias {
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
// See Notices.txt for copyright information
|
// See Notices.txt for copyright information
|
||||||
use crate::{fold::impl_fold, kw, Errors, HdlAttr, PairsIterExt};
|
use crate::{Errors, HdlAttr, PairsIterExt, fold::impl_fold, kw};
|
||||||
use proc_macro2::{Span, TokenStream};
|
use proc_macro2::{Span, TokenStream};
|
||||||
use quote::{format_ident, quote_spanned, ToTokens};
|
use quote::{ToTokens, format_ident, quote_spanned};
|
||||||
use std::{collections::HashMap, fmt, mem};
|
use std::{collections::HashMap, fmt, mem};
|
||||||
use syn::{
|
use syn::{
|
||||||
parse::{Parse, ParseStream},
|
|
||||||
parse_quote, parse_quote_spanned,
|
|
||||||
punctuated::{Pair, Punctuated},
|
|
||||||
spanned::Spanned,
|
|
||||||
token::{Brace, Bracket, Paren},
|
|
||||||
AngleBracketedGenericArguments, Attribute, Block, ConstParam, Expr, ExprBlock, ExprGroup,
|
AngleBracketedGenericArguments, Attribute, Block, ConstParam, Expr, ExprBlock, ExprGroup,
|
||||||
ExprIndex, ExprParen, ExprPath, ExprTuple, Field, FieldMutability, Fields, FieldsNamed,
|
ExprIndex, ExprParen, ExprPath, ExprTuple, Field, FieldMutability, Fields, FieldsNamed,
|
||||||
FieldsUnnamed, GenericArgument, GenericParam, Generics, Ident, ImplGenerics, Index, ItemStruct,
|
FieldsUnnamed, GenericArgument, GenericParam, Generics, Ident, ImplGenerics, Index, ItemStruct,
|
||||||
Path, PathArguments, PathSegment, PredicateType, QSelf, Stmt, Token, Turbofish, Type,
|
Path, PathArguments, PathSegment, PredicateType, QSelf, Stmt, Token, Turbofish, Type,
|
||||||
TypeGenerics, TypeGroup, TypeParam, TypeParen, TypePath, TypeTuple, Visibility, WhereClause,
|
TypeGenerics, TypeGroup, TypeParam, TypeParen, TypePath, TypeTuple, Visibility, WhereClause,
|
||||||
WherePredicate,
|
WherePredicate,
|
||||||
|
parse::{Parse, ParseStream},
|
||||||
|
parse_quote, parse_quote_spanned,
|
||||||
|
punctuated::{Pair, Punctuated},
|
||||||
|
spanned::Spanned,
|
||||||
|
token::{Brace, Bracket, Paren},
|
||||||
};
|
};
|
||||||
|
|
||||||
crate::options! {
|
crate::options! {
|
||||||
|
@ -299,7 +299,7 @@ impl ParseTypes<Expr> for ParsedExpr {
|
||||||
return Ok(ParsedExpr::Delimited(ParsedExprDelimited {
|
return Ok(ParsedExpr::Delimited(ParsedExprDelimited {
|
||||||
delim: ExprDelimiter::Group(*group_token),
|
delim: ExprDelimiter::Group(*group_token),
|
||||||
expr: parser.parse(expr)?,
|
expr: parser.parse(expr)?,
|
||||||
}))
|
}));
|
||||||
}
|
}
|
||||||
Expr::Paren(ExprParen {
|
Expr::Paren(ExprParen {
|
||||||
attrs,
|
attrs,
|
||||||
|
@ -309,7 +309,7 @@ impl ParseTypes<Expr> for ParsedExpr {
|
||||||
return Ok(ParsedExpr::Delimited(ParsedExprDelimited {
|
return Ok(ParsedExpr::Delimited(ParsedExprDelimited {
|
||||||
delim: ExprDelimiter::Paren(*paren_token),
|
delim: ExprDelimiter::Paren(*paren_token),
|
||||||
expr: parser.parse(expr)?,
|
expr: parser.parse(expr)?,
|
||||||
}))
|
}));
|
||||||
}
|
}
|
||||||
Expr::Path(ExprPath {
|
Expr::Path(ExprPath {
|
||||||
attrs,
|
attrs,
|
||||||
|
@ -1902,8 +1902,8 @@ pub(crate) mod known_items {
|
||||||
use proc_macro2::{Ident, Span, TokenStream};
|
use proc_macro2::{Ident, Span, TokenStream};
|
||||||
use quote::ToTokens;
|
use quote::ToTokens;
|
||||||
use syn::{
|
use syn::{
|
||||||
parse::{Parse, ParseStream},
|
|
||||||
Path, PathArguments, PathSegment, Token,
|
Path, PathArguments, PathSegment, Token,
|
||||||
|
parse::{Parse, ParseStream},
|
||||||
};
|
};
|
||||||
|
|
||||||
macro_rules! impl_known_item_body {
|
macro_rules! impl_known_item_body {
|
||||||
|
@ -3761,7 +3761,10 @@ pub(crate) trait AsTurbofish {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AsTurbofish for TypeGenerics<'_> {
|
impl AsTurbofish for TypeGenerics<'_> {
|
||||||
type Turbofish<'a> = Turbofish<'a> where Self: 'a;
|
type Turbofish<'a>
|
||||||
|
= Turbofish<'a>
|
||||||
|
where
|
||||||
|
Self: 'a;
|
||||||
|
|
||||||
fn as_turbofish(&self) -> Self::Turbofish<'_> {
|
fn as_turbofish(&self) -> Self::Turbofish<'_> {
|
||||||
TypeGenerics::as_turbofish(self)
|
TypeGenerics::as_turbofish(self)
|
||||||
|
@ -3769,7 +3772,8 @@ impl AsTurbofish for TypeGenerics<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AsTurbofish for ParsedGenericsTypeGenerics<'_> {
|
impl AsTurbofish for ParsedGenericsTypeGenerics<'_> {
|
||||||
type Turbofish<'a> = ParsedGenericsTurbofish<'a>
|
type Turbofish<'a>
|
||||||
|
= ParsedGenericsTurbofish<'a>
|
||||||
where
|
where
|
||||||
Self: 'a;
|
Self: 'a;
|
||||||
|
|
||||||
|
@ -3820,15 +3824,18 @@ impl SplitForImpl for Generics {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SplitForImpl for ParsedGenerics {
|
impl SplitForImpl for ParsedGenerics {
|
||||||
type ImplGenerics<'a> = ParsedGenericsImplGenerics<'a>
|
type ImplGenerics<'a>
|
||||||
|
= ParsedGenericsImplGenerics<'a>
|
||||||
where
|
where
|
||||||
Self: 'a;
|
Self: 'a;
|
||||||
|
|
||||||
type TypeGenerics<'a> = ParsedGenericsTypeGenerics<'a>
|
type TypeGenerics<'a>
|
||||||
|
= ParsedGenericsTypeGenerics<'a>
|
||||||
where
|
where
|
||||||
Self: 'a;
|
Self: 'a;
|
||||||
|
|
||||||
type WhereClause<'a> = ParsedGenericsWhereClause<'a>
|
type WhereClause<'a>
|
||||||
|
= ParsedGenericsWhereClause<'a>
|
||||||
where
|
where
|
||||||
Self: 'a;
|
Self: 'a;
|
||||||
|
|
||||||
|
@ -4045,7 +4052,8 @@ impl<P: ToTokens, U: ToTokens> ToTokens for MaybeParsed<P, U> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<P: AsTurbofish, U: AsTurbofish> AsTurbofish for MaybeParsed<P, U> {
|
impl<P: AsTurbofish, U: AsTurbofish> AsTurbofish for MaybeParsed<P, U> {
|
||||||
type Turbofish<'a> = MaybeParsed<P::Turbofish<'a>, U::Turbofish<'a>>
|
type Turbofish<'a>
|
||||||
|
= MaybeParsed<P::Turbofish<'a>, U::Turbofish<'a>>
|
||||||
where
|
where
|
||||||
Self: 'a;
|
Self: 'a;
|
||||||
|
|
||||||
|
@ -4058,13 +4066,16 @@ impl<P: AsTurbofish, U: AsTurbofish> AsTurbofish for MaybeParsed<P, U> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<P: SplitForImpl, U: SplitForImpl> SplitForImpl for MaybeParsed<P, U> {
|
impl<P: SplitForImpl, U: SplitForImpl> SplitForImpl for MaybeParsed<P, U> {
|
||||||
type ImplGenerics<'a> = MaybeParsed<P::ImplGenerics<'a>, U::ImplGenerics<'a>>
|
type ImplGenerics<'a>
|
||||||
|
= MaybeParsed<P::ImplGenerics<'a>, U::ImplGenerics<'a>>
|
||||||
where
|
where
|
||||||
Self: 'a;
|
Self: 'a;
|
||||||
type TypeGenerics<'a> = MaybeParsed<P::TypeGenerics<'a>, U::TypeGenerics<'a>>
|
type TypeGenerics<'a>
|
||||||
|
= MaybeParsed<P::TypeGenerics<'a>, U::TypeGenerics<'a>>
|
||||||
where
|
where
|
||||||
Self: 'a;
|
Self: 'a;
|
||||||
type WhereClause<'a> = MaybeParsed<P::WhereClause<'a>, U::WhereClause<'a>>
|
type WhereClause<'a>
|
||||||
|
= MaybeParsed<P::WhereClause<'a>, U::WhereClause<'a>>
|
||||||
where
|
where
|
||||||
Self: 'a;
|
Self: 'a;
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
// See Notices.txt for copyright information
|
// See Notices.txt for copyright information
|
||||||
#![cfg_attr(test, recursion_limit = "512")]
|
#![cfg_attr(test, recursion_limit = "512")]
|
||||||
use proc_macro2::{Span, TokenStream};
|
use proc_macro2::{Span, TokenStream};
|
||||||
use quote::{quote, ToTokens};
|
use quote::{ToTokens, quote};
|
||||||
use std::{
|
use std::{
|
||||||
collections::{hash_map::Entry, HashMap},
|
collections::{HashMap, hash_map::Entry},
|
||||||
io::{ErrorKind, Write},
|
io::{ErrorKind, Write},
|
||||||
};
|
};
|
||||||
use syn::{
|
use syn::{
|
||||||
bracketed,
|
AttrStyle, Attribute, Error, Ident, Item, ItemFn, LitBool, LitStr, Meta, Token, bracketed,
|
||||||
ext::IdentExt,
|
ext::IdentExt,
|
||||||
parenthesized,
|
parenthesized,
|
||||||
parse::{Parse, ParseStream, Parser},
|
parse::{Parse, ParseStream, Parser},
|
||||||
|
@ -16,7 +16,6 @@ use syn::{
|
||||||
punctuated::{Pair, Punctuated},
|
punctuated::{Pair, Punctuated},
|
||||||
spanned::Spanned,
|
spanned::Spanned,
|
||||||
token::{Bracket, Paren},
|
token::{Bracket, Paren},
|
||||||
AttrStyle, Attribute, Error, Ident, Item, ItemFn, LitBool, LitStr, Meta, Token,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mod fold;
|
mod fold;
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
// See Notices.txt for copyright information
|
// See Notices.txt for copyright information
|
||||||
use crate::{
|
use crate::{
|
||||||
|
Errors, HdlAttr, PairsIterExt,
|
||||||
hdl_type_common::{ParsedGenerics, SplitForImpl},
|
hdl_type_common::{ParsedGenerics, SplitForImpl},
|
||||||
kw,
|
kw,
|
||||||
module::transform_body::{HdlLet, HdlLetKindIO},
|
module::transform_body::{HdlLet, HdlLetKindIO},
|
||||||
options, Errors, HdlAttr, PairsIterExt,
|
options,
|
||||||
};
|
};
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::{format_ident, quote, quote_spanned, ToTokens};
|
use quote::{ToTokens, format_ident, quote, quote_spanned};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use syn::{
|
use syn::{
|
||||||
parse_quote,
|
|
||||||
visit::{visit_pat, Visit},
|
|
||||||
Attribute, Block, ConstParam, Error, FnArg, GenericParam, Generics, Ident, ItemFn, ItemStruct,
|
Attribute, Block, ConstParam, Error, FnArg, GenericParam, Generics, Ident, ItemFn, ItemStruct,
|
||||||
LifetimeParam, ReturnType, Signature, TypeParam, Visibility, WhereClause, WherePredicate,
|
LifetimeParam, ReturnType, Signature, TypeParam, Visibility, WhereClause, WherePredicate,
|
||||||
|
parse_quote,
|
||||||
|
visit::{Visit, visit_pat},
|
||||||
};
|
};
|
||||||
|
|
||||||
mod transform_body;
|
mod transform_body;
|
||||||
|
|
|
@ -1,27 +1,28 @@
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
// See Notices.txt for copyright information
|
// See Notices.txt for copyright information
|
||||||
use crate::{
|
use crate::{
|
||||||
fold::{impl_fold, DoFold},
|
Errors, HdlAttr,
|
||||||
|
fold::{DoFold, impl_fold},
|
||||||
hdl_type_common::{
|
hdl_type_common::{
|
||||||
known_items, ParseFailed, ParseTypes, ParsedGenerics, ParsedType, TypesParser,
|
ParseFailed, ParseTypes, ParsedGenerics, ParsedType, TypesParser, known_items,
|
||||||
},
|
},
|
||||||
is_hdl_attr, kw,
|
is_hdl_attr, kw,
|
||||||
module::{check_name_conflicts_with_module_builder, ModuleIO, ModuleIOKind, ModuleKind},
|
module::{ModuleIO, ModuleIOKind, ModuleKind, check_name_conflicts_with_module_builder},
|
||||||
options, Errors, HdlAttr,
|
options,
|
||||||
};
|
};
|
||||||
use num_bigint::BigInt;
|
use num_bigint::BigInt;
|
||||||
use proc_macro2::{Span, TokenStream};
|
use proc_macro2::{Span, TokenStream};
|
||||||
use quote::{quote, quote_spanned, ToTokens};
|
use quote::{ToTokens, quote, quote_spanned};
|
||||||
use std::{borrow::Borrow, convert::Infallible};
|
use std::{borrow::Borrow, convert::Infallible};
|
||||||
use syn::{
|
use syn::{
|
||||||
fold::{fold_expr, fold_expr_lit, fold_expr_unary, fold_local, fold_stmt, Fold},
|
Attribute, Block, Error, Expr, ExprIf, ExprLet, ExprLit, ExprRepeat, ExprUnary,
|
||||||
|
GenericArgument, Ident, Item, Lit, LitStr, Local, LocalInit, Pat, Token, Type, UnOp,
|
||||||
|
fold::{Fold, fold_expr, fold_expr_lit, fold_expr_unary, fold_local, fold_stmt},
|
||||||
parenthesized,
|
parenthesized,
|
||||||
parse::{Parse, ParseStream},
|
parse::{Parse, ParseStream},
|
||||||
parse_quote, parse_quote_spanned,
|
parse_quote, parse_quote_spanned,
|
||||||
spanned::Spanned,
|
spanned::Spanned,
|
||||||
token::Paren,
|
token::Paren,
|
||||||
Attribute, Block, Error, Expr, ExprIf, ExprLet, ExprLit, ExprRepeat, ExprUnary,
|
|
||||||
GenericArgument, Ident, Item, Lit, LitStr, Local, LocalInit, Pat, Token, Type, UnOp,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mod expand_aggregate_literals;
|
mod expand_aggregate_literals;
|
||||||
|
|
|
@ -2,19 +2,18 @@
|
||||||
// See Notices.txt for copyright information
|
// See Notices.txt for copyright information
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
kw,
|
HdlAttr, kw,
|
||||||
module::transform_body::{
|
module::transform_body::{
|
||||||
expand_match::{parse_enum_path, EnumPath},
|
|
||||||
ExprOptions, Visitor,
|
ExprOptions, Visitor,
|
||||||
|
expand_match::{EnumPath, parse_enum_path},
|
||||||
},
|
},
|
||||||
HdlAttr,
|
|
||||||
};
|
};
|
||||||
use quote::{format_ident, quote_spanned};
|
use quote::{format_ident, quote_spanned};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use syn::{
|
use syn::{
|
||||||
parse_quote_spanned, punctuated::Punctuated, spanned::Spanned, token::Paren, Expr, ExprArray,
|
Expr, ExprArray, ExprCall, ExprGroup, ExprMethodCall, ExprParen, ExprPath, ExprRepeat,
|
||||||
ExprCall, ExprGroup, ExprMethodCall, ExprParen, ExprPath, ExprRepeat, ExprStruct, ExprTuple,
|
ExprStruct, ExprTuple, FieldValue, Token, TypePath, parse_quote_spanned,
|
||||||
FieldValue, Token, TypePath,
|
punctuated::Punctuated, spanned::Spanned, token::Paren,
|
||||||
};
|
};
|
||||||
|
|
||||||
impl Visitor<'_> {
|
impl Visitor<'_> {
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
// See Notices.txt for copyright information
|
// See Notices.txt for copyright information
|
||||||
use crate::{
|
use crate::{
|
||||||
fold::{impl_fold, DoFold},
|
Errors, HdlAttr, PairsIterExt,
|
||||||
|
fold::{DoFold, impl_fold},
|
||||||
kw,
|
kw,
|
||||||
module::transform_body::{
|
module::transform_body::{
|
||||||
empty_let, with_debug_clone_and_fold, wrap_ty_with_expr, ExprOptions, Visitor,
|
ExprOptions, Visitor, empty_let, with_debug_clone_and_fold, wrap_ty_with_expr,
|
||||||
},
|
},
|
||||||
Errors, HdlAttr, PairsIterExt,
|
|
||||||
};
|
};
|
||||||
use proc_macro2::{Span, TokenStream};
|
use proc_macro2::{Span, TokenStream};
|
||||||
use quote::{format_ident, quote_spanned, ToTokens, TokenStreamExt};
|
use quote::{ToTokens, TokenStreamExt, format_ident, quote_spanned};
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
use syn::{
|
use syn::{
|
||||||
fold::{fold_arm, fold_expr_match, fold_local, fold_pat, Fold},
|
Arm, Attribute, Expr, ExprMatch, FieldPat, Ident, Local, Member, Pat, PatIdent, PatOr,
|
||||||
|
PatParen, PatPath, PatRest, PatStruct, PatTuple, PatTupleStruct, PatWild, Path, PathSegment,
|
||||||
|
Token, TypePath,
|
||||||
|
fold::{Fold, fold_arm, fold_expr_match, fold_local, fold_pat},
|
||||||
parse_quote_spanned,
|
parse_quote_spanned,
|
||||||
punctuated::Punctuated,
|
punctuated::Punctuated,
|
||||||
spanned::Spanned,
|
spanned::Spanned,
|
||||||
token::{Brace, Paren},
|
token::{Brace, Paren},
|
||||||
Arm, Attribute, Expr, ExprMatch, FieldPat, Ident, Local, Member, Pat, PatIdent, PatOr,
|
|
||||||
PatParen, PatPath, PatRest, PatStruct, PatTuple, PatTupleStruct, PatWild, Path, PathSegment,
|
|
||||||
Token, TypePath,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
macro_rules! visit_trait {
|
macro_rules! visit_trait {
|
||||||
|
@ -444,7 +444,7 @@ trait ParseMatchPat: Sized {
|
||||||
fn struct_(state: &mut HdlMatchParseState<'_>, v: MatchPatStruct) -> Result<Self, ()>;
|
fn struct_(state: &mut HdlMatchParseState<'_>, v: MatchPatStruct) -> Result<Self, ()>;
|
||||||
fn tuple(state: &mut HdlMatchParseState<'_>, v: MatchPatTuple) -> Result<Self, ()>;
|
fn tuple(state: &mut HdlMatchParseState<'_>, v: MatchPatTuple) -> Result<Self, ()>;
|
||||||
fn enum_variant(state: &mut HdlMatchParseState<'_>, v: MatchPatEnumVariant)
|
fn enum_variant(state: &mut HdlMatchParseState<'_>, v: MatchPatEnumVariant)
|
||||||
-> Result<Self, ()>;
|
-> Result<Self, ()>;
|
||||||
fn parse(state: &mut HdlMatchParseState<'_>, pat: Pat) -> Result<Self, ()> {
|
fn parse(state: &mut HdlMatchParseState<'_>, pat: Pat) -> Result<Self, ()> {
|
||||||
match pat {
|
match pat {
|
||||||
Pat::Ident(PatIdent {
|
Pat::Ident(PatIdent {
|
||||||
|
|
|
@ -5,8 +5,8 @@ use crate::{Cfg, CfgAttr, Cfgs, Errors};
|
||||||
use proc_macro2::Ident;
|
use proc_macro2::Ident;
|
||||||
use std::{collections::VecDeque, marker::PhantomData};
|
use std::{collections::VecDeque, marker::PhantomData};
|
||||||
use syn::{
|
use syn::{
|
||||||
punctuated::{Pair, Punctuated},
|
|
||||||
Token,
|
Token,
|
||||||
|
punctuated::{Pair, Punctuated},
|
||||||
};
|
};
|
||||||
|
|
||||||
struct State<P: Phase> {
|
struct State<P: Phase> {
|
||||||
|
@ -131,9 +131,9 @@ trait PhaseDispatch {
|
||||||
type Args<P: Phase>;
|
type Args<P: Phase>;
|
||||||
type Output<P: Phase>;
|
type Output<P: Phase>;
|
||||||
fn dispatch_collect(self, args: Self::Args<CollectCfgsPhase>)
|
fn dispatch_collect(self, args: Self::Args<CollectCfgsPhase>)
|
||||||
-> Self::Output<CollectCfgsPhase>;
|
-> Self::Output<CollectCfgsPhase>;
|
||||||
fn dispatch_process(self, args: Self::Args<ProcessCfgsPhase>)
|
fn dispatch_process(self, args: Self::Args<ProcessCfgsPhase>)
|
||||||
-> Self::Output<ProcessCfgsPhase>;
|
-> Self::Output<ProcessCfgsPhase>;
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Phase: Sized + 'static {
|
trait Phase: Sized + 'static {
|
||||||
|
@ -2510,7 +2510,7 @@ pub(crate) fn process_cfgs(item: syn::Item, cfgs: Cfgs<bool>) -> syn::Result<Opt
|
||||||
errors: Errors::new(),
|
errors: Errors::new(),
|
||||||
_phantom: PhantomData,
|
_phantom: PhantomData,
|
||||||
};
|
};
|
||||||
let retval = TopItem(item).process(&mut state).map(|v| v.0 .0);
|
let retval = TopItem(item).process(&mut state).map(|v| v.0.0);
|
||||||
state.errors.finish()?;
|
state.errors.finish()?;
|
||||||
Ok(retval)
|
Ok(retval)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
// See Notices.txt for copyright information
|
// See Notices.txt for copyright information
|
||||||
use proc_macro2::{Span, TokenStream};
|
use proc_macro2::{Span, TokenStream};
|
||||||
use quote::{format_ident, quote, ToTokens};
|
use quote::{ToTokens, format_ident, quote};
|
||||||
use std::{collections::BTreeMap, fs};
|
use std::{collections::BTreeMap, fs};
|
||||||
use syn::{fold::Fold, parse_quote};
|
use syn::{fold::Fold, parse_quote};
|
||||||
|
|
||||||
|
|
|
@ -314,10 +314,8 @@ impl<T: Iterator<Item: IntoAnnotations>> Iterator for IterIntoAnnotations<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
T: FusedIterator<
|
T: FusedIterator<Item: IntoAnnotations<IntoAnnotations: IntoIterator<IntoIter: FusedIterator>>>,
|
||||||
Item: IntoAnnotations<IntoAnnotations: IntoIterator<IntoIter: FusedIterator>>,
|
> FusedIterator for IterIntoAnnotations<T>
|
||||||
>,
|
|
||||||
> FusedIterator for IterIntoAnnotations<T>
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,22 +3,22 @@
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
expr::{
|
expr::{
|
||||||
ops::{ArrayLiteral, ExprFromIterator, ExprIntoIterator, ExprPartialEq},
|
|
||||||
CastToBits, Expr, HdlPartialEq, ReduceBits, ToExpr,
|
CastToBits, Expr, HdlPartialEq, ReduceBits, ToExpr,
|
||||||
|
ops::{ArrayLiteral, ExprFromIterator, ExprIntoIterator, ExprPartialEq},
|
||||||
},
|
},
|
||||||
int::{Bool, DynSize, KnownSize, Size, SizeType, DYN_SIZE},
|
int::{Bool, DYN_SIZE, DynSize, KnownSize, Size, SizeType},
|
||||||
intern::{Intern, Interned, LazyInterned},
|
intern::{Intern, Interned, LazyInterned},
|
||||||
module::transform::visit::{Fold, Folder, Visit, Visitor},
|
module::transform::visit::{Fold, Folder, Visit, Visitor},
|
||||||
sim::value::{SimValue, SimValuePartialEq},
|
sim::value::{SimValue, SimValuePartialEq},
|
||||||
source_location::SourceLocation,
|
source_location::SourceLocation,
|
||||||
ty::{
|
ty::{
|
||||||
serde_impls::SerdeCanonicalType, CanonicalType, MatchVariantWithoutScope, StaticType, Type,
|
CanonicalType, MatchVariantWithoutScope, StaticType, Type, TypeProperties, TypeWithDeref,
|
||||||
TypeProperties, TypeWithDeref,
|
serde_impls::SerdeCanonicalType,
|
||||||
},
|
},
|
||||||
util::ConstUsize,
|
util::ConstUsize,
|
||||||
};
|
};
|
||||||
use bitvec::slice::BitSlice;
|
use bitvec::slice::BitSlice;
|
||||||
use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Error};
|
||||||
use std::{iter::FusedIterator, ops::Index};
|
use std::{iter::FusedIterator, ops::Index};
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
|
|
|
@ -3,16 +3,16 @@
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
expr::{
|
expr::{
|
||||||
ops::{ArrayLiteral, BundleLiteral, ExprPartialEq},
|
|
||||||
CastToBits, Expr, ReduceBits, ToExpr,
|
CastToBits, Expr, ReduceBits, ToExpr,
|
||||||
|
ops::{ArrayLiteral, BundleLiteral, ExprPartialEq},
|
||||||
},
|
},
|
||||||
int::{Bool, DynSize},
|
int::{Bool, DynSize},
|
||||||
intern::{Intern, Interned},
|
intern::{Intern, Interned},
|
||||||
sim::value::{SimValue, SimValuePartialEq, ToSimValue, ToSimValueWithType},
|
sim::value::{SimValue, SimValuePartialEq, ToSimValue, ToSimValueWithType},
|
||||||
source_location::SourceLocation,
|
source_location::SourceLocation,
|
||||||
ty::{
|
ty::{
|
||||||
impl_match_variant_as_self, CanonicalType, MatchVariantWithoutScope, OpaqueSimValue,
|
CanonicalType, MatchVariantWithoutScope, OpaqueSimValue, StaticType, Type, TypeProperties,
|
||||||
StaticType, Type, TypeProperties, TypeWithDeref,
|
TypeWithDeref, impl_match_variant_as_self,
|
||||||
},
|
},
|
||||||
util::HashMap,
|
util::HashMap,
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,10 +8,10 @@ use crate::{
|
||||||
util::{job_server::AcquiredJob, streaming_read_utf8::streaming_read_utf8},
|
util::{job_server::AcquiredJob, streaming_read_utf8::streaming_read_utf8},
|
||||||
};
|
};
|
||||||
use clap::{
|
use clap::{
|
||||||
builder::{OsStringValueParser, TypedValueParser},
|
|
||||||
Parser, Subcommand, ValueEnum, ValueHint,
|
Parser, Subcommand, ValueEnum, ValueHint,
|
||||||
|
builder::{OsStringValueParser, TypedValueParser},
|
||||||
};
|
};
|
||||||
use eyre::{eyre, Report};
|
use eyre::{Report, eyre};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{
|
use std::{
|
||||||
error,
|
error,
|
||||||
|
@ -301,7 +301,9 @@ impl VerilogArgs {
|
||||||
input.split_once(file_separator_prefix)
|
input.split_once(file_separator_prefix)
|
||||||
{
|
{
|
||||||
let Some((next_file_name, rest)) = rest.split_once(file_separator_suffix) else {
|
let Some((next_file_name, rest)) = rest.split_once(file_separator_suffix) else {
|
||||||
return Err(CliError(eyre!("parsing firtool's output failed: found {file_separator_prefix:?} but no {file_separator_suffix:?}")));
|
return Err(CliError(eyre!(
|
||||||
|
"parsing firtool's output failed: found {file_separator_prefix:?} but no {file_separator_suffix:?}"
|
||||||
|
)));
|
||||||
};
|
};
|
||||||
input = rest;
|
input = rest;
|
||||||
(chunk, Some(next_file_name.as_ref()))
|
(chunk, Some(next_file_name.as_ref()))
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
||||||
int::Bool,
|
int::Bool,
|
||||||
reset::{Reset, ResetType},
|
reset::{Reset, ResetType},
|
||||||
source_location::SourceLocation,
|
source_location::SourceLocation,
|
||||||
ty::{impl_match_variant_as_self, CanonicalType, StaticType, Type, TypeProperties},
|
ty::{CanonicalType, StaticType, Type, TypeProperties, impl_match_variant_as_self},
|
||||||
};
|
};
|
||||||
use bitvec::slice::BitSlice;
|
use bitvec::slice::BitSlice;
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
expr::{
|
expr::{
|
||||||
ops::{ExprPartialEq, VariantAccess},
|
|
||||||
Expr, ToExpr,
|
Expr, ToExpr,
|
||||||
|
ops::{ExprPartialEq, VariantAccess},
|
||||||
},
|
},
|
||||||
hdl,
|
hdl,
|
||||||
int::{Bool, UIntValue},
|
int::{Bool, UIntValue},
|
||||||
intern::{Intern, Interned},
|
intern::{Intern, Interned},
|
||||||
module::{
|
module::{
|
||||||
connect, enum_match_variants_helper, incomplete_wire, wire,
|
EnumMatchVariantAndInactiveScopeImpl, EnumMatchVariantsIterImpl, Scope, connect,
|
||||||
EnumMatchVariantAndInactiveScopeImpl, EnumMatchVariantsIterImpl, Scope,
|
enum_match_variants_helper, incomplete_wire, wire,
|
||||||
},
|
},
|
||||||
sim::value::{SimValue, SimValuePartialEq},
|
sim::value::{SimValue, SimValuePartialEq},
|
||||||
source_location::SourceLocation,
|
source_location::SourceLocation,
|
||||||
|
@ -254,12 +254,12 @@ impl Enum {
|
||||||
|
|
||||||
pub trait EnumType:
|
pub trait EnumType:
|
||||||
Type<
|
Type<
|
||||||
BaseType = Enum,
|
BaseType = Enum,
|
||||||
MaskType = Bool,
|
MaskType = Bool,
|
||||||
MatchActiveScope = Scope,
|
MatchActiveScope = Scope,
|
||||||
MatchVariantAndInactiveScope = EnumMatchVariantAndInactiveScope<Self>,
|
MatchVariantAndInactiveScope = EnumMatchVariantAndInactiveScope<Self>,
|
||||||
MatchVariantsIter = EnumMatchVariantsIter<Self>,
|
MatchVariantsIter = EnumMatchVariantsIter<Self>,
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
type SimBuilder: From<Self>;
|
type SimBuilder: From<Self>;
|
||||||
fn variants(&self) -> Interned<[EnumVariant]>;
|
fn variants(&self) -> Interned<[EnumVariant]>;
|
||||||
|
|
|
@ -13,8 +13,8 @@ use crate::{
|
||||||
intern::{Intern, Interned},
|
intern::{Intern, Interned},
|
||||||
memory::{DynPortType, MemPort, PortType},
|
memory::{DynPortType, MemPort, PortType},
|
||||||
module::{
|
module::{
|
||||||
transform::visit::{Fold, Folder, Visit, Visitor},
|
|
||||||
Instance, ModuleIO,
|
Instance, ModuleIO,
|
||||||
|
transform::visit::{Fold, Folder, Visit, Visitor},
|
||||||
},
|
},
|
||||||
phantom_const::PhantomConst,
|
phantom_const::PhantomConst,
|
||||||
reg::Reg,
|
reg::Reg,
|
||||||
|
@ -283,7 +283,10 @@ impl<T: Type + fmt::Debug> fmt::Debug for Expr<T> {
|
||||||
} = self;
|
} = self;
|
||||||
let expr_ty = __ty.canonical();
|
let expr_ty = __ty.canonical();
|
||||||
let enum_ty = __enum.to_expr().__ty;
|
let enum_ty = __enum.to_expr().__ty;
|
||||||
assert_eq!(expr_ty, enum_ty, "expr ty mismatch:\nExpr {{\n__enum: {__enum:?},\n__ty: {__ty:?},\n__flow: {__flow:?}\n}}");
|
assert_eq!(
|
||||||
|
expr_ty, enum_ty,
|
||||||
|
"expr ty mismatch:\nExpr {{\n__enum: {__enum:?},\n__ty: {__ty:?},\n__flow: {__flow:?}\n}}"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
self.__enum.fmt(f)
|
self.__enum.fmt(f)
|
||||||
}
|
}
|
||||||
|
@ -529,11 +532,7 @@ impl Flow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub const fn flip_if(self, flipped: bool) -> Flow {
|
pub const fn flip_if(self, flipped: bool) -> Flow {
|
||||||
if flipped {
|
if flipped { self.flip() } else { self }
|
||||||
self.flip()
|
|
||||||
} else {
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,12 @@ use crate::{
|
||||||
clock::{Clock, ToClock},
|
clock::{Clock, ToClock},
|
||||||
enum_::{Enum, EnumType, EnumVariant},
|
enum_::{Enum, EnumType, EnumVariant},
|
||||||
expr::{
|
expr::{
|
||||||
|
CastBitsTo as _, CastTo, CastToBits as _, Expr, ExprEnum, Flow, HdlPartialEq,
|
||||||
|
HdlPartialOrd, NotALiteralExpr, ReduceBits, ToExpr, ToLiteralBits,
|
||||||
target::{
|
target::{
|
||||||
GetTarget, Target, TargetPathArrayElement, TargetPathBundleField,
|
GetTarget, Target, TargetPathArrayElement, TargetPathBundleField,
|
||||||
TargetPathDynArrayElement, TargetPathElement,
|
TargetPathDynArrayElement, TargetPathElement,
|
||||||
},
|
},
|
||||||
CastBitsTo as _, CastTo, CastToBits as _, Expr, ExprEnum, Flow, HdlPartialEq,
|
|
||||||
HdlPartialOrd, NotALiteralExpr, ReduceBits, ToExpr, ToLiteralBits,
|
|
||||||
},
|
},
|
||||||
int::{
|
int::{
|
||||||
Bool, BoolOrIntType, DynSize, IntType, KnownSize, SInt, SIntType, SIntValue, Size, UInt,
|
Bool, BoolOrIntType, DynSize, IntType, KnownSize, SInt, SIntType, SIntValue, Size, UInt,
|
||||||
|
|
|
@ -11,32 +11,32 @@ use crate::{
|
||||||
clock::Clock,
|
clock::Clock,
|
||||||
enum_::{Enum, EnumType, EnumVariant},
|
enum_::{Enum, EnumType, EnumVariant},
|
||||||
expr::{
|
expr::{
|
||||||
|
CastBitsTo, Expr, ExprEnum,
|
||||||
ops::{self, VariantAccess},
|
ops::{self, VariantAccess},
|
||||||
target::{
|
target::{
|
||||||
Target, TargetBase, TargetPathArrayElement, TargetPathBundleField, TargetPathElement,
|
Target, TargetBase, TargetPathArrayElement, TargetPathBundleField, TargetPathElement,
|
||||||
},
|
},
|
||||||
CastBitsTo, Expr, ExprEnum,
|
|
||||||
},
|
},
|
||||||
formal::FormalKind,
|
formal::FormalKind,
|
||||||
int::{Bool, DynSize, IntType, SIntValue, UInt, UIntValue},
|
int::{Bool, DynSize, IntType, SIntValue, UInt, UIntValue},
|
||||||
intern::{Intern, Interned},
|
intern::{Intern, Interned},
|
||||||
memory::{Mem, PortKind, PortName, ReadUnderWrite},
|
memory::{Mem, PortKind, PortName, ReadUnderWrite},
|
||||||
module::{
|
module::{
|
||||||
transform::{
|
|
||||||
simplify_enums::{simplify_enums, SimplifyEnumsError, SimplifyEnumsKind},
|
|
||||||
simplify_memories::simplify_memories,
|
|
||||||
},
|
|
||||||
AnnotatedModuleIO, Block, ExternModuleBody, ExternModuleParameter,
|
AnnotatedModuleIO, Block, ExternModuleBody, ExternModuleParameter,
|
||||||
ExternModuleParameterValue, Module, ModuleBody, NameOptId, NormalModuleBody, Stmt,
|
ExternModuleParameterValue, Module, ModuleBody, NameOptId, NormalModuleBody, Stmt,
|
||||||
StmtConnect, StmtDeclaration, StmtFormal, StmtIf, StmtInstance, StmtMatch, StmtReg,
|
StmtConnect, StmtDeclaration, StmtFormal, StmtIf, StmtInstance, StmtMatch, StmtReg,
|
||||||
StmtWire,
|
StmtWire,
|
||||||
|
transform::{
|
||||||
|
simplify_enums::{SimplifyEnumsError, SimplifyEnumsKind, simplify_enums},
|
||||||
|
simplify_memories::simplify_memories,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
reset::{AsyncReset, Reset, ResetType, SyncReset},
|
reset::{AsyncReset, Reset, ResetType, SyncReset},
|
||||||
source_location::SourceLocation,
|
source_location::SourceLocation,
|
||||||
ty::{CanonicalType, Type},
|
ty::{CanonicalType, Type},
|
||||||
util::{
|
util::{
|
||||||
const_str_array_is_strictly_ascending, BitSliceWriteWithBase, DebugAsRawString,
|
BitSliceWriteWithBase, DebugAsRawString, GenericConstBool, HashMap, HashSet,
|
||||||
GenericConstBool, HashMap, HashSet,
|
const_str_array_is_strictly_ascending,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use bitvec::slice::BitSlice;
|
use bitvec::slice::BitSlice;
|
||||||
|
@ -925,7 +925,10 @@ impl<'a> Exporter<'a> {
|
||||||
},
|
},
|
||||||
) in expr.field_values().into_iter().zip(ty.fields())
|
) in expr.field_values().into_iter().zip(ty.fields())
|
||||||
{
|
{
|
||||||
debug_assert!(!flipped, "can't have bundle literal with flipped field -- this should have been caught in BundleLiteral::new_unchecked");
|
debug_assert!(
|
||||||
|
!flipped,
|
||||||
|
"can't have bundle literal with flipped field -- this should have been caught in BundleLiteral::new_unchecked"
|
||||||
|
);
|
||||||
let name = bundle_ns.borrow_mut().get(name);
|
let name = bundle_ns.borrow_mut().get(name);
|
||||||
let field_value = self.expr(Expr::canonical(field_value), definitions, const_ty);
|
let field_value = self.expr(Expr::canonical(field_value), definitions, const_ty);
|
||||||
definitions.add_definition_line(format_args!("connect {ident}.{name}, {field_value}"));
|
definitions.add_definition_line(format_args!("connect {ident}.{name}, {field_value}"));
|
||||||
|
@ -1261,7 +1264,9 @@ impl<'a> Exporter<'a> {
|
||||||
"UInt<0>(0)".into()
|
"UInt<0>(0)".into()
|
||||||
};
|
};
|
||||||
for (variant_index, variant) in ty.variants().into_iter().enumerate() {
|
for (variant_index, variant) in ty.variants().into_iter().enumerate() {
|
||||||
let when_cond = format!("eq(UInt<{discriminant_bit_width}>({variant_index}), tail({value_str}, {body_bit_width}))");
|
let when_cond = format!(
|
||||||
|
"eq(UInt<{discriminant_bit_width}>({variant_index}), tail({value_str}, {body_bit_width}))"
|
||||||
|
);
|
||||||
if variant_index == ty.variants().len() - 1 {
|
if variant_index == ty.variants().len() - 1 {
|
||||||
definitions.add_definition_line(format_args!("{extra_indent}else:"));
|
definitions.add_definition_line(format_args!("{extra_indent}else:"));
|
||||||
} else if variant_index == 0 {
|
} else if variant_index == 0 {
|
||||||
|
|
|
@ -4,22 +4,22 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
array::ArrayType,
|
array::ArrayType,
|
||||||
expr::{
|
expr::{
|
||||||
target::{GetTarget, Target},
|
|
||||||
Expr, NotALiteralExpr, ToExpr, ToLiteralBits,
|
Expr, NotALiteralExpr, ToExpr, ToLiteralBits,
|
||||||
|
target::{GetTarget, Target},
|
||||||
},
|
},
|
||||||
hdl,
|
hdl,
|
||||||
intern::{Intern, Interned, Memoize},
|
intern::{Intern, Interned, Memoize},
|
||||||
sim::value::{SimValue, ToSimValueWithType},
|
sim::value::{SimValue, ToSimValueWithType},
|
||||||
source_location::SourceLocation,
|
source_location::SourceLocation,
|
||||||
ty::{impl_match_variant_as_self, CanonicalType, StaticType, Type, TypeProperties},
|
ty::{CanonicalType, StaticType, Type, TypeProperties, impl_match_variant_as_self},
|
||||||
util::{interned_bit, ConstBool, ConstUsize, GenericConstBool, GenericConstUsize},
|
util::{ConstBool, ConstUsize, GenericConstBool, GenericConstUsize, interned_bit},
|
||||||
};
|
};
|
||||||
use bitvec::{order::Lsb0, slice::BitSlice, vec::BitVec, view::BitView};
|
use bitvec::{order::Lsb0, slice::BitSlice, vec::BitVec, view::BitView};
|
||||||
use num_bigint::{BigInt, BigUint, Sign};
|
use num_bigint::{BigInt, BigUint, Sign};
|
||||||
use num_traits::{One, Signed, Zero};
|
use num_traits::{One, Signed, Zero};
|
||||||
use serde::{
|
use serde::{
|
||||||
de::{DeserializeOwned, Error, Visitor},
|
|
||||||
Deserialize, Deserializer, Serialize, Serializer,
|
Deserialize, Deserializer, Serialize, Serializer,
|
||||||
|
de::{DeserializeOwned, Error, Visitor},
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
borrow::{BorrowMut, Cow},
|
borrow::{BorrowMut, Cow},
|
||||||
|
@ -224,11 +224,7 @@ impl<T: KnownSize> Size for T {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_from_usize(v: usize) -> Option<Self::SizeType> {
|
fn try_from_usize(v: usize) -> Option<Self::SizeType> {
|
||||||
if v == T::VALUE {
|
if v == T::VALUE { Some(T::SIZE) } else { None }
|
||||||
Some(T::SIZE)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,20 +4,20 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
bundle::{Bundle, BundleField, BundleType, BundleTypePropertiesBuilder, NoBuilder},
|
bundle::{Bundle, BundleField, BundleType, BundleTypePropertiesBuilder, NoBuilder},
|
||||||
expr::{
|
expr::{
|
||||||
ops::{ExprCastTo, ExprPartialEq, ExprPartialOrd},
|
|
||||||
CastBitsTo, CastTo, CastToBits, Expr, HdlPartialEq, HdlPartialOrd,
|
CastBitsTo, CastTo, CastToBits, Expr, HdlPartialEq, HdlPartialOrd,
|
||||||
|
ops::{ExprCastTo, ExprPartialEq, ExprPartialOrd},
|
||||||
},
|
},
|
||||||
int::{Bool, DynSize, KnownSize, Size, SizeType, UInt, UIntType},
|
int::{Bool, DynSize, KnownSize, Size, SizeType, UInt, UIntType},
|
||||||
intern::{Intern, Interned},
|
intern::{Intern, Interned},
|
||||||
phantom_const::PhantomConst,
|
phantom_const::PhantomConst,
|
||||||
sim::value::{SimValue, SimValuePartialEq, ToSimValueWithType},
|
sim::value::{SimValue, SimValuePartialEq, ToSimValueWithType},
|
||||||
source_location::SourceLocation,
|
source_location::SourceLocation,
|
||||||
ty::{impl_match_variant_as_self, CanonicalType, StaticType, Type, TypeProperties},
|
ty::{CanonicalType, StaticType, Type, TypeProperties, impl_match_variant_as_self},
|
||||||
};
|
};
|
||||||
use bitvec::{order::Lsb0, slice::BitSlice, view::BitView};
|
use bitvec::{order::Lsb0, slice::BitSlice, view::BitView};
|
||||||
use serde::{
|
use serde::{
|
||||||
de::{value::UsizeDeserializer, Error, Visitor},
|
|
||||||
Deserialize, Deserializer, Serialize, Serializer,
|
Deserialize, Deserializer, Serialize, Serializer,
|
||||||
|
de::{Error, Visitor, value::UsizeDeserializer},
|
||||||
};
|
};
|
||||||
use std::{fmt, marker::PhantomData, ops::Index};
|
use std::{fmt, marker::PhantomData, ops::Index};
|
||||||
|
|
||||||
|
@ -45,15 +45,18 @@ impl Type for UIntInRangeMaskType {
|
||||||
|
|
||||||
fn from_canonical(canonical_type: CanonicalType) -> Self {
|
fn from_canonical(canonical_type: CanonicalType) -> Self {
|
||||||
let fields = Bundle::from_canonical(canonical_type).fields();
|
let fields = Bundle::from_canonical(canonical_type).fields();
|
||||||
let [BundleField {
|
let [
|
||||||
name: value_name,
|
BundleField {
|
||||||
flipped: false,
|
name: value_name,
|
||||||
ty: value,
|
flipped: false,
|
||||||
}, BundleField {
|
ty: value,
|
||||||
name: range_name,
|
},
|
||||||
flipped: false,
|
BundleField {
|
||||||
ty: range,
|
name: range_name,
|
||||||
}] = *fields
|
flipped: false,
|
||||||
|
ty: range,
|
||||||
|
},
|
||||||
|
] = *fields
|
||||||
else {
|
else {
|
||||||
panic!("expected UIntInRangeMaskType");
|
panic!("expected UIntInRangeMaskType");
|
||||||
};
|
};
|
||||||
|
@ -323,15 +326,18 @@ macro_rules! define_uint_in_range_type {
|
||||||
|
|
||||||
fn from_canonical(canonical_type: CanonicalType) -> Self {
|
fn from_canonical(canonical_type: CanonicalType) -> Self {
|
||||||
let fields = Bundle::from_canonical(canonical_type).fields();
|
let fields = Bundle::from_canonical(canonical_type).fields();
|
||||||
let [BundleField {
|
let [
|
||||||
name: value_name,
|
BundleField {
|
||||||
flipped: false,
|
name: value_name,
|
||||||
ty: value,
|
flipped: false,
|
||||||
}, BundleField {
|
ty: value,
|
||||||
name: range_name,
|
},
|
||||||
flipped: false,
|
BundleField {
|
||||||
ty: range,
|
name: range_name,
|
||||||
}] = *fields
|
flipped: false,
|
||||||
|
ty: range,
|
||||||
|
},
|
||||||
|
] = *fields
|
||||||
else {
|
else {
|
||||||
panic!("expected {}", stringify!($UIntInRange));
|
panic!("expected {}", stringify!($UIntInRange));
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::{
|
||||||
array::{Array, ArrayType},
|
array::{Array, ArrayType},
|
||||||
bundle::{Bundle, BundleType},
|
bundle::{Bundle, BundleType},
|
||||||
clock::Clock,
|
clock::Clock,
|
||||||
expr::{ops::BundleLiteral, repeat, Expr, Flow, ToExpr, ToLiteralBits},
|
expr::{Expr, Flow, ToExpr, ToLiteralBits, ops::BundleLiteral, repeat},
|
||||||
hdl,
|
hdl,
|
||||||
int::{Bool, DynSize, Size, UInt, UIntType},
|
int::{Bool, DynSize, Size, UInt, UIntType},
|
||||||
intern::{Intern, Interned},
|
intern::{Intern, Interned},
|
||||||
|
|
|
@ -8,12 +8,12 @@ use crate::{
|
||||||
clock::{Clock, ClockDomain},
|
clock::{Clock, ClockDomain},
|
||||||
enum_::{Enum, EnumMatchVariantsIter, EnumType},
|
enum_::{Enum, EnumMatchVariantsIter, EnumType},
|
||||||
expr::{
|
expr::{
|
||||||
|
Expr, Flow, ToExpr,
|
||||||
ops::VariantAccess,
|
ops::VariantAccess,
|
||||||
target::{
|
target::{
|
||||||
GetTarget, Target, TargetBase, TargetPathArrayElement, TargetPathBundleField,
|
GetTarget, Target, TargetBase, TargetPathArrayElement, TargetPathBundleField,
|
||||||
TargetPathElement,
|
TargetPathElement,
|
||||||
},
|
},
|
||||||
Expr, Flow, ToExpr,
|
|
||||||
},
|
},
|
||||||
formal::FormalKind,
|
formal::FormalKind,
|
||||||
int::{Bool, DynSize, Size},
|
int::{Bool, DynSize, Size},
|
||||||
|
@ -1459,7 +1459,9 @@ impl TargetState {
|
||||||
})
|
})
|
||||||
.reduce(TargetWritten::conditional_merge_written)
|
.reduce(TargetWritten::conditional_merge_written)
|
||||||
else {
|
else {
|
||||||
unreachable!("merge_conditional_sub_blocks_into_block must be called with at least one sub-block");
|
unreachable!(
|
||||||
|
"merge_conditional_sub_blocks_into_block must be called with at least one sub-block"
|
||||||
|
);
|
||||||
};
|
};
|
||||||
let mut written_in_blocks = written_in_blocks.borrow_mut();
|
let mut written_in_blocks = written_in_blocks.borrow_mut();
|
||||||
if target_block >= written_in_blocks.len() {
|
if target_block >= written_in_blocks.len() {
|
||||||
|
@ -2290,14 +2292,12 @@ pub fn annotate<T: Type>(target: Expr<T>, annotations: impl IntoAnnotations) {
|
||||||
}
|
}
|
||||||
TargetBase::MemPort(v) => {
|
TargetBase::MemPort(v) => {
|
||||||
ModuleBuilder::with(|m| {
|
ModuleBuilder::with(|m| {
|
||||||
RefCell::borrow_mut(unwrap!(unwrap!(m
|
RefCell::borrow_mut(unwrap!(
|
||||||
.impl_
|
unwrap!(m.impl_.borrow_mut().body.builder_normal_body_opt())
|
||||||
.borrow_mut()
|
.body
|
||||||
.body
|
.memory_map
|
||||||
.builder_normal_body_opt())
|
.get_mut(&v.mem_name())
|
||||||
.body
|
))
|
||||||
.memory_map
|
|
||||||
.get_mut(&v.mem_name())))
|
|
||||||
.port_annotations
|
.port_annotations
|
||||||
.extend(annotations)
|
.extend(annotations)
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,12 +6,12 @@ use crate::{
|
||||||
bundle::{BundleField, BundleType},
|
bundle::{BundleField, BundleType},
|
||||||
enum_::{EnumType, EnumVariant},
|
enum_::{EnumType, EnumVariant},
|
||||||
expr::{
|
expr::{
|
||||||
|
ExprEnum,
|
||||||
ops::{self, ArrayLiteral},
|
ops::{self, ArrayLiteral},
|
||||||
target::{
|
target::{
|
||||||
Target, TargetBase, TargetChild, TargetPathArrayElement, TargetPathBundleField,
|
Target, TargetBase, TargetChild, TargetPathArrayElement, TargetPathBundleField,
|
||||||
TargetPathDynArrayElement, TargetPathElement,
|
TargetPathDynArrayElement, TargetPathElement,
|
||||||
},
|
},
|
||||||
ExprEnum,
|
|
||||||
},
|
},
|
||||||
formal::FormalKind,
|
formal::FormalKind,
|
||||||
int::{SIntValue, UIntValue},
|
int::{SIntValue, UIntValue},
|
||||||
|
@ -41,10 +41,16 @@ impl fmt::Display for DeduceResetsError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
DeduceResetsError::ResetIsNotDrivenByAsyncOrSync { source_location } => {
|
DeduceResetsError::ResetIsNotDrivenByAsyncOrSync { source_location } => {
|
||||||
write!(f, "deduce_reset failed: Reset signal is not driven by any AsyncReset or SyncReset signals: {source_location}")
|
write!(
|
||||||
|
f,
|
||||||
|
"deduce_reset failed: Reset signal is not driven by any AsyncReset or SyncReset signals: {source_location}"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
DeduceResetsError::ResetIsDrivenByBothAsyncAndSync { source_location } => {
|
DeduceResetsError::ResetIsDrivenByBothAsyncAndSync { source_location } => {
|
||||||
write!(f, "deduce_reset failed: Reset signal is driven by both AsyncReset and SyncReset signals: {source_location}")
|
write!(
|
||||||
|
f,
|
||||||
|
"deduce_reset failed: Reset signal is driven by both AsyncReset and SyncReset signals: {source_location}"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2099,7 +2105,7 @@ impl<P: Pass> RunPass<P> for StmtDeclaration {
|
||||||
) -> Result<PassOutput<Self, P>, DeduceResetsError> {
|
) -> Result<PassOutput<Self, P>, DeduceResetsError> {
|
||||||
let (annotations, reg) = match self {
|
let (annotations, reg) = match self {
|
||||||
StmtDeclaration::Wire(v) => {
|
StmtDeclaration::Wire(v) => {
|
||||||
return Ok(v.run_pass(pass_args)?.map(StmtDeclaration::Wire))
|
return Ok(v.run_pass(pass_args)?.map(StmtDeclaration::Wire));
|
||||||
}
|
}
|
||||||
&StmtDeclaration::Reg(StmtReg { annotations, reg }) => (annotations, AnyReg::from(reg)),
|
&StmtDeclaration::Reg(StmtReg { annotations, reg }) => (annotations, AnyReg::from(reg)),
|
||||||
&StmtDeclaration::RegSync(StmtReg { annotations, reg }) => {
|
&StmtDeclaration::RegSync(StmtReg { annotations, reg }) => {
|
||||||
|
@ -2109,7 +2115,7 @@ impl<P: Pass> RunPass<P> for StmtDeclaration {
|
||||||
(annotations, AnyReg::from(reg))
|
(annotations, AnyReg::from(reg))
|
||||||
}
|
}
|
||||||
StmtDeclaration::Instance(v) => {
|
StmtDeclaration::Instance(v) => {
|
||||||
return Ok(v.run_pass(pass_args)?.map(StmtDeclaration::Instance))
|
return Ok(v.run_pass(pass_args)?.map(StmtDeclaration::Instance));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let annotations = annotations.run_pass(pass_args.as_mut())?;
|
let annotations = annotations.run_pass(pass_args.as_mut())?;
|
||||||
|
|
|
@ -5,16 +5,16 @@ use crate::{
|
||||||
bundle::{Bundle, BundleField, BundleType},
|
bundle::{Bundle, BundleField, BundleType},
|
||||||
enum_::{Enum, EnumType, EnumVariant},
|
enum_::{Enum, EnumType, EnumVariant},
|
||||||
expr::{
|
expr::{
|
||||||
ops::{self, EnumLiteral},
|
|
||||||
CastBitsTo, CastTo, CastToBits, Expr, ExprEnum, HdlPartialEq, ToExpr,
|
CastBitsTo, CastTo, CastToBits, Expr, ExprEnum, HdlPartialEq, ToExpr,
|
||||||
|
ops::{self, EnumLiteral},
|
||||||
},
|
},
|
||||||
hdl,
|
hdl,
|
||||||
int::UInt,
|
int::UInt,
|
||||||
intern::{Intern, Interned, Memoize},
|
intern::{Intern, Interned, Memoize},
|
||||||
memory::{DynPortType, Mem, MemPort},
|
memory::{DynPortType, Mem, MemPort},
|
||||||
module::{
|
module::{
|
||||||
transform::visit::{Fold, Folder},
|
|
||||||
Block, Id, Module, NameId, ScopedNameId, Stmt, StmtConnect, StmtIf, StmtMatch, StmtWire,
|
Block, Id, Module, NameId, ScopedNameId, Stmt, StmtConnect, StmtIf, StmtMatch, StmtWire,
|
||||||
|
transform::visit::{Fold, Folder},
|
||||||
},
|
},
|
||||||
source_location::SourceLocation,
|
source_location::SourceLocation,
|
||||||
ty::{CanonicalType, Type},
|
ty::{CanonicalType, Type},
|
||||||
|
@ -810,7 +810,7 @@ impl Folder for State {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.gen_name(&format!(
|
.gen_name(&format!(
|
||||||
"{}_{}",
|
"{}_{}",
|
||||||
memory.scoped_name().1 .0,
|
memory.scoped_name().1.0,
|
||||||
port.port_name()
|
port.port_name()
|
||||||
)),
|
)),
|
||||||
port.source_location(),
|
port.source_location(),
|
||||||
|
|
|
@ -9,8 +9,8 @@ use crate::{
|
||||||
intern::{Intern, Interned},
|
intern::{Intern, Interned},
|
||||||
memory::{Mem, MemPort, PortType},
|
memory::{Mem, MemPort, PortType},
|
||||||
module::{
|
module::{
|
||||||
transform::visit::{Fold, Folder},
|
|
||||||
Block, Id, Module, NameId, ScopedNameId, Stmt, StmtConnect, StmtWire,
|
Block, Id, Module, NameId, ScopedNameId, Stmt, StmtConnect, StmtWire,
|
||||||
|
transform::visit::{Fold, Folder},
|
||||||
},
|
},
|
||||||
source_location::SourceLocation,
|
source_location::SourceLocation,
|
||||||
ty::{CanonicalType, Type},
|
ty::{CanonicalType, Type},
|
||||||
|
@ -634,7 +634,7 @@ impl ModuleState {
|
||||||
split_state: &SplitState<'_>,
|
split_state: &SplitState<'_>,
|
||||||
) -> Mem {
|
) -> Mem {
|
||||||
let mem_name = NameId(
|
let mem_name = NameId(
|
||||||
Intern::intern_owned(format!("{}{mem_name_path}", input_mem.scoped_name().1 .0)),
|
Intern::intern_owned(format!("{}{mem_name_path}", input_mem.scoped_name().1.0)),
|
||||||
Id::new(),
|
Id::new(),
|
||||||
);
|
);
|
||||||
let mem_name = ScopedNameId(input_mem.scoped_name().0, mem_name);
|
let mem_name = ScopedNameId(input_mem.scoped_name().0, mem_name);
|
||||||
|
|
|
@ -11,12 +11,11 @@ use crate::{
|
||||||
clock::Clock,
|
clock::Clock,
|
||||||
enum_::{Enum, EnumType, EnumVariant},
|
enum_::{Enum, EnumType, EnumVariant},
|
||||||
expr::{
|
expr::{
|
||||||
ops,
|
Expr, ExprEnum, ops,
|
||||||
target::{
|
target::{
|
||||||
Target, TargetBase, TargetChild, TargetPathArrayElement, TargetPathBundleField,
|
Target, TargetBase, TargetChild, TargetPathArrayElement, TargetPathBundleField,
|
||||||
TargetPathDynArrayElement, TargetPathElement,
|
TargetPathDynArrayElement, TargetPathElement,
|
||||||
},
|
},
|
||||||
Expr, ExprEnum,
|
|
||||||
},
|
},
|
||||||
formal::FormalKind,
|
formal::FormalKind,
|
||||||
int::{Bool, SIntType, SIntValue, Size, UIntType, UIntValue},
|
int::{Bool, SIntType, SIntValue, Size, UIntType, UIntValue},
|
||||||
|
|
|
@ -3,23 +3,22 @@
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
expr::{
|
expr::{
|
||||||
ops::{ExprPartialEq, ExprPartialOrd},
|
|
||||||
Expr, ToExpr,
|
Expr, ToExpr,
|
||||||
|
ops::{ExprPartialEq, ExprPartialOrd},
|
||||||
},
|
},
|
||||||
int::Bool,
|
int::Bool,
|
||||||
intern::{Intern, Interned, InternedCompare, LazyInterned, LazyInternedTrait, Memoize},
|
intern::{Intern, Interned, InternedCompare, LazyInterned, LazyInternedTrait, Memoize},
|
||||||
sim::value::{SimValue, SimValuePartialEq, ToSimValue, ToSimValueWithType},
|
sim::value::{SimValue, SimValuePartialEq, ToSimValue, ToSimValueWithType},
|
||||||
source_location::SourceLocation,
|
source_location::SourceLocation,
|
||||||
ty::{
|
ty::{
|
||||||
impl_match_variant_as_self,
|
CanonicalType, StaticType, Type, TypeProperties, impl_match_variant_as_self,
|
||||||
serde_impls::{SerdeCanonicalType, SerdePhantomConst},
|
serde_impls::{SerdeCanonicalType, SerdePhantomConst},
|
||||||
CanonicalType, StaticType, Type, TypeProperties,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use bitvec::slice::BitSlice;
|
use bitvec::slice::BitSlice;
|
||||||
use serde::{
|
use serde::{
|
||||||
de::{DeserializeOwned, Error},
|
|
||||||
Deserialize, Deserializer, Serialize, Serializer,
|
Deserialize, Deserializer, Serialize, Serializer,
|
||||||
|
de::{DeserializeOwned, Error},
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
any::Any,
|
any::Any,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
// See Notices.txt for copyright information
|
// See Notices.txt for copyright information
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
|
__,
|
||||||
annotations::{
|
annotations::{
|
||||||
BlackBoxInlineAnnotation, BlackBoxPathAnnotation, CustomFirrtlAnnotation,
|
BlackBoxInlineAnnotation, BlackBoxPathAnnotation, CustomFirrtlAnnotation,
|
||||||
DocStringAnnotation, DontTouchAnnotation, SVAttributeAnnotation,
|
DocStringAnnotation, DontTouchAnnotation, SVAttributeAnnotation,
|
||||||
|
@ -11,33 +12,32 @@ pub use crate::{
|
||||||
clock::{Clock, ClockDomain, ToClock},
|
clock::{Clock, ClockDomain, ToClock},
|
||||||
enum_::{Enum, HdlNone, HdlOption, HdlSome},
|
enum_::{Enum, HdlNone, HdlOption, HdlSome},
|
||||||
expr::{
|
expr::{
|
||||||
repeat, CastBitsTo, CastTo, CastToBits, Expr, HdlPartialEq, HdlPartialOrd, MakeUninitExpr,
|
CastBitsTo, CastTo, CastToBits, Expr, HdlPartialEq, HdlPartialOrd, MakeUninitExpr,
|
||||||
ReduceBits, ToExpr,
|
ReduceBits, ToExpr, repeat,
|
||||||
},
|
},
|
||||||
formal::{
|
formal::{
|
||||||
all_const, all_seq, any_const, any_seq, formal_global_clock, formal_reset, hdl_assert,
|
MakeFormalExpr, all_const, all_seq, any_const, any_seq, formal_global_clock, formal_reset,
|
||||||
hdl_assert_with_enable, hdl_assume, hdl_assume_with_enable, hdl_cover,
|
hdl_assert, hdl_assert_with_enable, hdl_assume, hdl_assume_with_enable, hdl_cover,
|
||||||
hdl_cover_with_enable, MakeFormalExpr,
|
hdl_cover_with_enable,
|
||||||
},
|
},
|
||||||
hdl, hdl_module,
|
hdl, hdl_module,
|
||||||
int::{Bool, DynSize, KnownSize, SInt, SIntType, SIntValue, Size, UInt, UIntType, UIntValue},
|
int::{Bool, DynSize, KnownSize, SInt, SIntType, SIntValue, Size, UInt, UIntType, UIntValue},
|
||||||
memory::{Mem, MemBuilder, ReadUnderWrite},
|
memory::{Mem, MemBuilder, ReadUnderWrite},
|
||||||
module::{
|
module::{
|
||||||
annotate, connect, connect_any, incomplete_wire, instance, memory, memory_array,
|
Instance, Module, ModuleBuilder, annotate, connect, connect_any, incomplete_wire, instance,
|
||||||
memory_with_init, reg_builder, wire, Instance, Module, ModuleBuilder,
|
memory, memory_array, memory_with_init, reg_builder, wire,
|
||||||
},
|
},
|
||||||
phantom_const::PhantomConst,
|
phantom_const::PhantomConst,
|
||||||
reg::Reg,
|
reg::Reg,
|
||||||
reset::{AsyncReset, Reset, SyncReset, ToAsyncReset, ToReset, ToSyncReset},
|
reset::{AsyncReset, Reset, SyncReset, ToAsyncReset, ToReset, ToSyncReset},
|
||||||
sim::{
|
sim::{
|
||||||
|
ExternModuleSimulationState, Simulation,
|
||||||
time::{SimDuration, SimInstant},
|
time::{SimDuration, SimInstant},
|
||||||
value::{SimValue, ToSimValue, ToSimValueWithType},
|
value::{SimValue, ToSimValue, ToSimValueWithType},
|
||||||
ExternModuleSimulationState, Simulation,
|
|
||||||
},
|
},
|
||||||
source_location::SourceLocation,
|
source_location::SourceLocation,
|
||||||
ty::{AsMask, CanonicalType, Type},
|
ty::{AsMask, CanonicalType, Type},
|
||||||
util::{ConstUsize, GenericConstUsize},
|
util::{ConstUsize, GenericConstUsize},
|
||||||
wire::Wire,
|
wire::Wire,
|
||||||
__,
|
|
||||||
};
|
};
|
||||||
pub use bitvec::{slice::BitSlice, vec::BitVec};
|
pub use bitvec::{slice::BitSlice, vec::BitVec};
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
// See Notices.txt for copyright information
|
// See Notices.txt for copyright information
|
||||||
use crate::{
|
use crate::{
|
||||||
clock::Clock,
|
clock::Clock,
|
||||||
expr::{ops, Expr, ToExpr},
|
expr::{Expr, ToExpr, ops},
|
||||||
int::{Bool, SInt, UInt},
|
int::{Bool, SInt, UInt},
|
||||||
source_location::SourceLocation,
|
source_location::SourceLocation,
|
||||||
ty::{impl_match_variant_as_self, CanonicalType, StaticType, Type, TypeProperties},
|
ty::{CanonicalType, StaticType, Type, TypeProperties, impl_match_variant_as_self},
|
||||||
};
|
};
|
||||||
use bitvec::slice::BitSlice;
|
use bitvec::slice::BitSlice;
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,11 @@ use crate::{
|
||||||
bundle::{BundleField, BundleType},
|
bundle::{BundleField, BundleType},
|
||||||
enum_::{EnumType, EnumVariant},
|
enum_::{EnumType, EnumVariant},
|
||||||
expr::{
|
expr::{
|
||||||
ops,
|
ExprEnum, Flow, ToLiteralBits, ops,
|
||||||
target::{
|
target::{
|
||||||
GetTarget, Target, TargetBase, TargetPathArrayElement, TargetPathBundleField,
|
GetTarget, Target, TargetBase, TargetPathArrayElement, TargetPathBundleField,
|
||||||
TargetPathElement,
|
TargetPathElement,
|
||||||
},
|
},
|
||||||
ExprEnum, Flow, ToLiteralBits,
|
|
||||||
},
|
},
|
||||||
int::{BoolOrIntType, UIntValue},
|
int::{BoolOrIntType, UIntValue},
|
||||||
intern::{
|
intern::{
|
||||||
|
@ -20,10 +19,10 @@ use crate::{
|
||||||
},
|
},
|
||||||
memory::PortKind,
|
memory::PortKind,
|
||||||
module::{
|
module::{
|
||||||
transform::deduce_resets::deduce_resets, AnnotatedModuleIO, Block, ExternModuleBody, Id,
|
AnnotatedModuleIO, Block, ExternModuleBody, Id, InstantiatedModule, ModuleBody, NameId,
|
||||||
InstantiatedModule, ModuleBody, NameId, NormalModuleBody, ScopedNameId, Stmt, StmtConnect,
|
NormalModuleBody, ScopedNameId, Stmt, StmtConnect, StmtDeclaration, StmtFormal, StmtIf,
|
||||||
StmtDeclaration, StmtFormal, StmtIf, StmtInstance, StmtMatch, StmtReg, StmtWire,
|
StmtInstance, StmtMatch, StmtReg, StmtWire, TargetInInstantiatedModule,
|
||||||
TargetInInstantiatedModule,
|
transform::deduce_resets::deduce_resets,
|
||||||
},
|
},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
reset::{ResetType, ResetTypeDispatch},
|
reset::{ResetType, ResetTypeDispatch},
|
||||||
|
@ -65,6 +64,7 @@ use std::{
|
||||||
mem,
|
mem,
|
||||||
ops::IndexMut,
|
ops::IndexMut,
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
|
ptr,
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
task::Poll,
|
task::Poll,
|
||||||
|
@ -4568,7 +4568,7 @@ impl Compiler {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.unzip();
|
.unzip();
|
||||||
let name = mem.scoped_name().1 .0;
|
let name = mem.scoped_name().1.0;
|
||||||
let id = TraceMemoryId(self.memories.len());
|
let id = TraceMemoryId(self.memories.len());
|
||||||
let stride = mem.array_type().element().bit_width();
|
let stride = mem.array_type().element().bit_width();
|
||||||
let trace = TraceMem {
|
let trace = TraceMem {
|
||||||
|
@ -5596,7 +5596,7 @@ trait TraceWriterDynTrait: fmt::Debug + 'static {
|
||||||
fn set_signal_clock_dyn(&mut self, id: TraceScalarId, value: bool) -> std::io::Result<()>;
|
fn set_signal_clock_dyn(&mut self, id: TraceScalarId, value: bool) -> std::io::Result<()>;
|
||||||
fn set_signal_sync_reset_dyn(&mut self, id: TraceScalarId, value: bool) -> std::io::Result<()>;
|
fn set_signal_sync_reset_dyn(&mut self, id: TraceScalarId, value: bool) -> std::io::Result<()>;
|
||||||
fn set_signal_async_reset_dyn(&mut self, id: TraceScalarId, value: bool)
|
fn set_signal_async_reset_dyn(&mut self, id: TraceScalarId, value: bool)
|
||||||
-> std::io::Result<()>;
|
-> std::io::Result<()>;
|
||||||
fn set_signal_enum_discriminant_dyn(
|
fn set_signal_enum_discriminant_dyn(
|
||||||
&mut self,
|
&mut self,
|
||||||
id: TraceScalarId,
|
id: TraceScalarId,
|
||||||
|
@ -6283,8 +6283,8 @@ impl EarliestWaitTargets {
|
||||||
fn iter<'a>(
|
fn iter<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
) -> impl Clone
|
) -> impl Clone
|
||||||
+ Iterator<Item = WaitTarget<CompiledValue<CanonicalType>, &'a SimValue<CanonicalType>>>
|
+ Iterator<Item = WaitTarget<CompiledValue<CanonicalType>, &'a SimValue<CanonicalType>>>
|
||||||
+ 'a {
|
+ 'a {
|
||||||
self.settle
|
self.settle
|
||||||
.then_some(WaitTarget::Settle)
|
.then_some(WaitTarget::Settle)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -6727,7 +6727,10 @@ impl SimulationImpl {
|
||||||
let this = &mut *self;
|
let this = &mut *self;
|
||||||
let mut sim = this.sim.borrow_mut();
|
let mut sim = this.sim.borrow_mut();
|
||||||
let sim = &mut *sim;
|
let sim = &mut *sim;
|
||||||
assert!(cx.waker().will_wake(&sim.generator_waker), "can't use ExternModuleSimulationState's methods outside of ExternModuleSimulation");
|
assert!(
|
||||||
|
cx.waker().will_wake(&sim.generator_waker),
|
||||||
|
"can't use ExternModuleSimulationState's methods outside of ExternModuleSimulation"
|
||||||
|
);
|
||||||
this.targets.convert_earlier_instants_to_settle(sim.instant);
|
this.targets.convert_earlier_instants_to_settle(sim.instant);
|
||||||
if this.targets.is_empty() {
|
if this.targets.is_empty() {
|
||||||
this.targets.settle = true;
|
this.targets.settle = true;
|
||||||
|
@ -7736,7 +7739,7 @@ impl<Args: Eq, Fut> Eq for SimGeneratorFn<Args, Fut> {}
|
||||||
impl<Args: PartialEq, Fut> PartialEq for SimGeneratorFn<Args, Fut> {
|
impl<Args: PartialEq, Fut> PartialEq for SimGeneratorFn<Args, Fut> {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
let Self { args, f } = self;
|
let Self { args, f } = self;
|
||||||
*args == other.args && *f == other.f
|
*args == other.args && ptr::fn_addr_eq(*f, other.f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7752,9 +7755,9 @@ impl<Args: Clone, Fut> Clone for SimGeneratorFn<Args, Fut> {
|
||||||
impl<Args: Copy, Fut> Copy for SimGeneratorFn<Args, Fut> {}
|
impl<Args: Copy, Fut> Copy for SimGeneratorFn<Args, Fut> {}
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
T: fmt::Debug + Clone + Eq + Hash + Send + Sync + 'static,
|
T: fmt::Debug + Clone + Eq + Hash + Send + Sync + 'static,
|
||||||
Fut: IntoFuture<Output = ()> + 'static,
|
Fut: IntoFuture<Output = ()> + 'static,
|
||||||
> ExternModuleSimGenerator for SimGeneratorFn<T, Fut>
|
> ExternModuleSimGenerator for SimGeneratorFn<T, Fut>
|
||||||
{
|
{
|
||||||
fn run<'a>(&'a self, sim: ExternModuleSimulationState) -> impl IntoFuture<Output = ()> + 'a {
|
fn run<'a>(&'a self, sim: ExternModuleSimulationState) -> impl IntoFuture<Output = ()> + 'a {
|
||||||
(self.f)(self.args.clone(), sim)
|
(self.f)(self.args.clone(), sim)
|
||||||
|
@ -7763,7 +7766,7 @@ impl<
|
||||||
|
|
||||||
trait DynExternModuleSimGenerator: Any + Send + Sync + SupportsPtrEqWithTypeId + fmt::Debug {
|
trait DynExternModuleSimGenerator: Any + Send + Sync + SupportsPtrEqWithTypeId + fmt::Debug {
|
||||||
fn dyn_run<'a>(&'a self, sim: ExternModuleSimulationState)
|
fn dyn_run<'a>(&'a self, sim: ExternModuleSimulationState)
|
||||||
-> Box<dyn Future<Output = ()> + 'a>;
|
-> Box<dyn Future<Output = ()> + 'a>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: ExternModuleSimGenerator> DynExternModuleSimGenerator for T {
|
impl<T: ExternModuleSimGenerator> DynExternModuleSimGenerator for T {
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::{
|
||||||
intern::{Intern, Interned, Memoize},
|
intern::{Intern, Interned, Memoize},
|
||||||
source_location::SourceLocation,
|
source_location::SourceLocation,
|
||||||
ty::CanonicalType,
|
ty::CanonicalType,
|
||||||
util::{get_many_mut, HashMap, HashSet},
|
util::{HashMap, HashSet},
|
||||||
};
|
};
|
||||||
use bitvec::{boxed::BitBox, slice::BitSlice};
|
use bitvec::{boxed::BitBox, slice::BitSlice};
|
||||||
use num_bigint::BigInt;
|
use num_bigint::BigInt;
|
||||||
|
@ -2073,21 +2073,21 @@ pub(crate) struct BorrowedStatePart<'a, K: StatePartKind> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
'a,
|
'a,
|
||||||
K: StatePartKind<
|
K: StatePartKind<
|
||||||
BorrowedState<'a>: DerefMut<Target: IndexMut<usize, Output = T> + BorrowMut<[T]>>,
|
BorrowedState<'a>: DerefMut<Target: IndexMut<usize, Output = T> + BorrowMut<[T]>>,
|
||||||
>,
|
>,
|
||||||
T,
|
T,
|
||||||
> BorrowedStatePart<'a, K>
|
> BorrowedStatePart<'a, K>
|
||||||
{
|
{
|
||||||
pub(crate) fn get_many_mut<const N: usize>(
|
pub(crate) fn get_disjoint_mut<const N: usize>(
|
||||||
&mut self,
|
&mut self,
|
||||||
indexes: [StatePartIndex<K>; N],
|
indexes: [StatePartIndex<K>; N],
|
||||||
) -> [&mut T; N] {
|
) -> [&mut T; N] {
|
||||||
get_many_mut(
|
(*self.value)
|
||||||
(*self.value).borrow_mut(),
|
.borrow_mut()
|
||||||
indexes.map(|v| v.value as usize),
|
.get_disjoint_mut(indexes.map(|v| v.value as usize))
|
||||||
)
|
.expect("indexes are disjoint")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2568,7 +2568,7 @@ impl_insns! {
|
||||||
src: StatePartIndex<StatePartKindBigSlots>,
|
src: StatePartIndex<StatePartKindBigSlots>,
|
||||||
} => {
|
} => {
|
||||||
if dest != src {
|
if dest != src {
|
||||||
let [dest, src] = state.big_slots.get_many_mut([dest, src]);
|
let [dest, src] = state.big_slots.get_disjoint_mut([dest, src]);
|
||||||
dest.clone_from(src);
|
dest.clone_from(src);
|
||||||
}
|
}
|
||||||
next!();
|
next!();
|
||||||
|
@ -2590,7 +2590,7 @@ impl_insns! {
|
||||||
} => {
|
} => {
|
||||||
if let Some(src) = state.eval_array_indexed(src) {
|
if let Some(src) = state.eval_array_indexed(src) {
|
||||||
if dest != src {
|
if dest != src {
|
||||||
let [dest, src] = state.big_slots.get_many_mut([dest, src]);
|
let [dest, src] = state.big_slots.get_disjoint_mut([dest, src]);
|
||||||
dest.clone_from(src);
|
dest.clone_from(src);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2619,7 +2619,7 @@ impl_insns! {
|
||||||
} => {
|
} => {
|
||||||
if let Some(dest) = state.eval_array_indexed(dest) {
|
if let Some(dest) = state.eval_array_indexed(dest) {
|
||||||
if dest != src {
|
if dest != src {
|
||||||
let [dest, src] = state.big_slots.get_many_mut([dest, src]);
|
let [dest, src] = state.big_slots.get_disjoint_mut([dest, src]);
|
||||||
dest.clone_from(src);
|
dest.clone_from(src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ use crate::{
|
||||||
reset::{AsyncReset, Reset, SyncReset},
|
reset::{AsyncReset, Reset, SyncReset},
|
||||||
ty::{CanonicalType, StaticType, Type},
|
ty::{CanonicalType, StaticType, Type},
|
||||||
util::{
|
util::{
|
||||||
alternating_cell::{AlternatingCell, AlternatingCellMethods},
|
|
||||||
ConstUsize,
|
ConstUsize,
|
||||||
|
alternating_cell::{AlternatingCell, AlternatingCellMethods},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use bitvec::{slice::BitSlice, vec::BitVec};
|
use bitvec::{slice::BitSlice, vec::BitVec};
|
||||||
|
|
|
@ -7,12 +7,12 @@ use crate::{
|
||||||
int::UInt,
|
int::UInt,
|
||||||
intern::{Intern, Interned},
|
intern::{Intern, Interned},
|
||||||
sim::{
|
sim::{
|
||||||
time::{SimDuration, SimInstant},
|
|
||||||
TraceArray, TraceAsyncReset, TraceBool, TraceBundle, TraceClock, TraceDecl,
|
TraceArray, TraceAsyncReset, TraceBool, TraceBundle, TraceClock, TraceDecl,
|
||||||
TraceEnumDiscriminant, TraceEnumWithFields, TraceFieldlessEnum, TraceInstance,
|
TraceEnumDiscriminant, TraceEnumWithFields, TraceFieldlessEnum, TraceInstance,
|
||||||
TraceLocation, TraceMem, TraceMemPort, TraceMemoryId, TraceMemoryLocation, TraceModule,
|
TraceLocation, TraceMem, TraceMemPort, TraceMemoryId, TraceMemoryLocation, TraceModule,
|
||||||
TraceModuleIO, TraceReg, TraceSInt, TraceScalar, TraceScalarId, TraceScope, TraceSyncReset,
|
TraceModuleIO, TraceReg, TraceSInt, TraceScalar, TraceScalarId, TraceScope, TraceSyncReset,
|
||||||
TraceUInt, TraceWire, TraceWriter, TraceWriterDecls,
|
TraceUInt, TraceWire, TraceWriter, TraceWriterDecls,
|
||||||
|
time::{SimDuration, SimInstant},
|
||||||
},
|
},
|
||||||
util::HashMap,
|
util::HashMap,
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,7 +16,7 @@ use crate::{
|
||||||
util::ConstUsize,
|
util::ConstUsize,
|
||||||
};
|
};
|
||||||
use bitvec::slice::BitSlice;
|
use bitvec::slice::BitSlice;
|
||||||
use serde::{de::DeserializeOwned, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer, de::DeserializeOwned};
|
||||||
use std::{fmt, hash::Hash, iter::FusedIterator, ops::Index, sync::Arc};
|
use std::{fmt, hash::Hash, iter::FusedIterator, ops::Index, sync::Arc};
|
||||||
|
|
||||||
pub(crate) mod serde_impls;
|
pub(crate) mod serde_impls;
|
||||||
|
@ -334,16 +334,16 @@ pub trait Type:
|
||||||
type MatchVariant: 'static + Send + Sync;
|
type MatchVariant: 'static + Send + Sync;
|
||||||
type MatchActiveScope;
|
type MatchActiveScope;
|
||||||
type MatchVariantAndInactiveScope: MatchVariantAndInactiveScope<
|
type MatchVariantAndInactiveScope: MatchVariantAndInactiveScope<
|
||||||
MatchVariant = Self::MatchVariant,
|
MatchVariant = Self::MatchVariant,
|
||||||
MatchActiveScope = Self::MatchActiveScope,
|
MatchActiveScope = Self::MatchActiveScope,
|
||||||
>;
|
>;
|
||||||
type MatchVariantsIter: Iterator<Item = Self::MatchVariantAndInactiveScope>
|
type MatchVariantsIter: Iterator<Item = Self::MatchVariantAndInactiveScope>
|
||||||
+ ExactSizeIterator
|
+ ExactSizeIterator
|
||||||
+ FusedIterator
|
+ FusedIterator
|
||||||
+ DoubleEndedIterator;
|
+ DoubleEndedIterator;
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn match_variants(this: Expr<Self>, source_location: SourceLocation)
|
fn match_variants(this: Expr<Self>, source_location: SourceLocation)
|
||||||
-> Self::MatchVariantsIter;
|
-> Self::MatchVariantsIter;
|
||||||
fn mask_type(&self) -> Self::MaskType;
|
fn mask_type(&self) -> Self::MaskType;
|
||||||
fn canonical(&self) -> CanonicalType;
|
fn canonical(&self) -> CanonicalType;
|
||||||
fn from_canonical(canonical_type: CanonicalType) -> Self;
|
fn from_canonical(canonical_type: CanonicalType) -> Self;
|
||||||
|
|
|
@ -35,8 +35,8 @@ pub use scoped_ref::ScopedRef;
|
||||||
|
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use misc::{
|
pub use misc::{
|
||||||
get_many_mut, interned_bit, iter_eq_by, BitSliceWriteWithBase, DebugAsDisplay,
|
BitSliceWriteWithBase, DebugAsDisplay, DebugAsRawString, MakeMutSlice, RcWriter, interned_bit,
|
||||||
DebugAsRawString, MakeMutSlice, RcWriter,
|
iter_eq_by,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod job_server;
|
pub mod job_server;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
// See Notices.txt for copyright information
|
// See Notices.txt for copyright information
|
||||||
use serde::{
|
use serde::{
|
||||||
de::{DeserializeOwned, Error, Unexpected},
|
|
||||||
Deserialize, Deserializer, Serialize, Serializer,
|
Deserialize, Deserializer, Serialize, Serializer,
|
||||||
|
de::{DeserializeOwned, Error, Unexpected},
|
||||||
};
|
};
|
||||||
use std::{fmt::Debug, hash::Hash, mem::ManuallyDrop, ptr};
|
use std::{fmt::Debug, hash::Hash, mem::ManuallyDrop, ptr};
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
// See Notices.txt for copyright information
|
// See Notices.txt for copyright information
|
||||||
use serde::{
|
use serde::{
|
||||||
de::{DeserializeOwned, Error, Unexpected},
|
|
||||||
Deserialize, Deserializer, Serialize, Serializer,
|
Deserialize, Deserializer, Serialize, Serializer,
|
||||||
|
de::{DeserializeOwned, Error, Unexpected},
|
||||||
};
|
};
|
||||||
use std::{fmt::Debug, hash::Hash};
|
use std::{fmt::Debug, hash::Hash};
|
||||||
|
|
||||||
|
|
|
@ -163,22 +163,6 @@ impl fmt::UpperHex for BitSliceWriteWithBase<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
#[track_caller]
|
|
||||||
pub fn get_many_mut<T, const N: usize>(slice: &mut [T], indexes: [usize; N]) -> [&mut T; N] {
|
|
||||||
for i in 0..N {
|
|
||||||
for j in 0..i {
|
|
||||||
assert!(indexes[i] != indexes[j], "duplicate index");
|
|
||||||
}
|
|
||||||
assert!(indexes[i] < slice.len(), "index out of bounds");
|
|
||||||
}
|
|
||||||
// Safety: checked that no indexes are duplicates and no indexes are out of bounds
|
|
||||||
unsafe {
|
|
||||||
let base = slice.as_mut_ptr(); // convert to a raw pointer before loop to avoid aliasing with &mut [T]
|
|
||||||
std::array::from_fn(|i| &mut *base.add(indexes[i]))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct RcWriter(Rc<Cell<Vec<u8>>>);
|
pub struct RcWriter(Rc<Cell<Vec<u8>>>);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0277]: `Cell<util::alternating_cell::State>` cannot be shared between thr
|
||||||
11 | fn f(v: SimValue<()>) -> Interned<SimValue<()>> {
|
11 | fn f(v: SimValue<()>) -> Interned<SimValue<()>> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ `Cell<util::alternating_cell::State>` cannot be shared between threads safely
|
| ^^^^^^^^^^^^^^^^^^^^^^ `Cell<util::alternating_cell::State>` cannot be shared between threads safely
|
||||||
|
|
|
|
||||||
= help: within `SimValue<()>`, the trait `Sync` is not implemented for `Cell<util::alternating_cell::State>`, which is required by `SimValue<()>: Sync`
|
= help: within `SimValue<()>`, the trait `Sync` is not implemented for `Cell<util::alternating_cell::State>`
|
||||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock`
|
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock`
|
||||||
note: required because it appears within the type `util::alternating_cell::AlternatingCell<value::SimValueInner<()>>`
|
note: required because it appears within the type `util::alternating_cell::AlternatingCell<value::SimValueInner<()>>`
|
||||||
--> src/util/alternating_cell.rs
|
--> src/util/alternating_cell.rs
|
||||||
|
@ -28,7 +28,7 @@ error[E0277]: `UnsafeCell<value::SimValueInner<()>>` cannot be shared between th
|
||||||
11 | fn f(v: SimValue<()>) -> Interned<SimValue<()>> {
|
11 | fn f(v: SimValue<()>) -> Interned<SimValue<()>> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<value::SimValueInner<()>>` cannot be shared between threads safely
|
| ^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<value::SimValueInner<()>>` cannot be shared between threads safely
|
||||||
|
|
|
|
||||||
= help: within `SimValue<()>`, the trait `Sync` is not implemented for `UnsafeCell<value::SimValueInner<()>>`, which is required by `SimValue<()>: Sync`
|
= help: within `SimValue<()>`, the trait `Sync` is not implemented for `UnsafeCell<value::SimValueInner<()>>`
|
||||||
note: required because it appears within the type `util::alternating_cell::AlternatingCell<value::SimValueInner<()>>`
|
note: required because it appears within the type `util::alternating_cell::AlternatingCell<value::SimValueInner<()>>`
|
||||||
--> src/util/alternating_cell.rs
|
--> src/util/alternating_cell.rs
|
||||||
|
|
|
|
||||||
|
@ -49,29 +49,29 @@ error[E0277]: the trait bound `SimValue<()>: Intern` is not satisfied
|
||||||
--> tests/ui/simvalue_is_not_internable.rs:12:26
|
--> tests/ui/simvalue_is_not_internable.rs:12:26
|
||||||
|
|
|
|
||||||
12 | Intern::intern_sized(v)
|
12 | Intern::intern_sized(v)
|
||||||
| -------------------- ^ the trait `Hash` is not implemented for `SimValue<()>`, which is required by `SimValue<()>: Intern`
|
| -------------------- ^ the trait `Hash` is not implemented for `SimValue<()>`
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: the following other types implement trait `Intern`:
|
|
||||||
BitSlice
|
|
||||||
[T]
|
|
||||||
str
|
|
||||||
= note: required for `SimValue<()>` to implement `Intern`
|
= note: required for `SimValue<()>` to implement `Intern`
|
||||||
|
help: consider dereferencing here
|
||||||
|
|
|
||||||
|
12 | Intern::intern_sized(*v)
|
||||||
|
| +
|
||||||
|
|
||||||
error[E0277]: the trait bound `SimValue<()>: Intern` is not satisfied
|
error[E0277]: the trait bound `SimValue<()>: Intern` is not satisfied
|
||||||
--> tests/ui/simvalue_is_not_internable.rs:12:26
|
--> tests/ui/simvalue_is_not_internable.rs:12:26
|
||||||
|
|
|
|
||||||
12 | Intern::intern_sized(v)
|
12 | Intern::intern_sized(v)
|
||||||
| -------------------- ^ the trait `std::cmp::Eq` is not implemented for `SimValue<()>`, which is required by `SimValue<()>: Intern`
|
| -------------------- ^ the trait `std::cmp::Eq` is not implemented for `SimValue<()>`
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: the following other types implement trait `Intern`:
|
|
||||||
BitSlice
|
|
||||||
[T]
|
|
||||||
str
|
|
||||||
= note: required for `SimValue<()>` to implement `Intern`
|
= note: required for `SimValue<()>` to implement `Intern`
|
||||||
|
help: consider dereferencing here
|
||||||
|
|
|
||||||
|
12 | Intern::intern_sized(*v)
|
||||||
|
| +
|
||||||
|
|
||||||
error[E0277]: `Cell<util::alternating_cell::State>` cannot be shared between threads safely
|
error[E0277]: `Cell<util::alternating_cell::State>` cannot be shared between threads safely
|
||||||
--> tests/ui/simvalue_is_not_internable.rs:12:26
|
--> tests/ui/simvalue_is_not_internable.rs:12:26
|
||||||
|
@ -81,7 +81,7 @@ error[E0277]: `Cell<util::alternating_cell::State>` cannot be shared between thr
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: within `SimValue<()>`, the trait `Sync` is not implemented for `Cell<util::alternating_cell::State>`, which is required by `SimValue<()>: Sync`
|
= help: within `SimValue<()>`, the trait `Sync` is not implemented for `Cell<util::alternating_cell::State>`
|
||||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock`
|
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock`
|
||||||
note: required because it appears within the type `util::alternating_cell::AlternatingCell<value::SimValueInner<()>>`
|
note: required because it appears within the type `util::alternating_cell::AlternatingCell<value::SimValueInner<()>>`
|
||||||
--> src/util/alternating_cell.rs
|
--> src/util/alternating_cell.rs
|
||||||
|
@ -101,6 +101,10 @@ note: required by a bound in `intern_sized`
|
||||||
| fn intern(&self) -> Interned<Self>;
|
| fn intern(&self) -> Interned<Self>;
|
||||||
| fn intern_sized(self) -> Interned<Self>
|
| fn intern_sized(self) -> Interned<Self>
|
||||||
| ------------ required by a bound in this associated function
|
| ------------ required by a bound in this associated function
|
||||||
|
help: consider dereferencing here
|
||||||
|
|
|
||||||
|
12 | Intern::intern_sized(*v)
|
||||||
|
| +
|
||||||
|
|
||||||
error[E0277]: `UnsafeCell<value::SimValueInner<()>>` cannot be shared between threads safely
|
error[E0277]: `UnsafeCell<value::SimValueInner<()>>` cannot be shared between threads safely
|
||||||
--> tests/ui/simvalue_is_not_internable.rs:12:26
|
--> tests/ui/simvalue_is_not_internable.rs:12:26
|
||||||
|
@ -110,7 +114,7 @@ error[E0277]: `UnsafeCell<value::SimValueInner<()>>` cannot be shared between th
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: within `SimValue<()>`, the trait `Sync` is not implemented for `UnsafeCell<value::SimValueInner<()>>`, which is required by `SimValue<()>: Sync`
|
= help: within `SimValue<()>`, the trait `Sync` is not implemented for `UnsafeCell<value::SimValueInner<()>>`
|
||||||
note: required because it appears within the type `util::alternating_cell::AlternatingCell<value::SimValueInner<()>>`
|
note: required because it appears within the type `util::alternating_cell::AlternatingCell<value::SimValueInner<()>>`
|
||||||
--> src/util/alternating_cell.rs
|
--> src/util/alternating_cell.rs
|
||||||
|
|
|
|
||||||
|
@ -129,6 +133,10 @@ note: required by a bound in `intern_sized`
|
||||||
| fn intern(&self) -> Interned<Self>;
|
| fn intern(&self) -> Interned<Self>;
|
||||||
| fn intern_sized(self) -> Interned<Self>
|
| fn intern_sized(self) -> Interned<Self>
|
||||||
| ------------ required by a bound in this associated function
|
| ------------ required by a bound in this associated function
|
||||||
|
help: consider dereferencing here
|
||||||
|
|
|
||||||
|
12 | Intern::intern_sized(*v)
|
||||||
|
| +
|
||||||
|
|
||||||
error[E0277]: `Cell<util::alternating_cell::State>` cannot be shared between threads safely
|
error[E0277]: `Cell<util::alternating_cell::State>` cannot be shared between threads safely
|
||||||
--> tests/ui/simvalue_is_not_internable.rs:12:5
|
--> tests/ui/simvalue_is_not_internable.rs:12:5
|
||||||
|
@ -136,7 +144,7 @@ error[E0277]: `Cell<util::alternating_cell::State>` cannot be shared between thr
|
||||||
12 | Intern::intern_sized(v)
|
12 | Intern::intern_sized(v)
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^ `Cell<util::alternating_cell::State>` cannot be shared between threads safely
|
| ^^^^^^^^^^^^^^^^^^^^^^^ `Cell<util::alternating_cell::State>` cannot be shared between threads safely
|
||||||
|
|
|
|
||||||
= help: within `SimValue<()>`, the trait `Sync` is not implemented for `Cell<util::alternating_cell::State>`, which is required by `SimValue<()>: Sync`
|
= help: within `SimValue<()>`, the trait `Sync` is not implemented for `Cell<util::alternating_cell::State>`
|
||||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock`
|
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock`
|
||||||
note: required because it appears within the type `util::alternating_cell::AlternatingCell<value::SimValueInner<()>>`
|
note: required because it appears within the type `util::alternating_cell::AlternatingCell<value::SimValueInner<()>>`
|
||||||
--> src/util/alternating_cell.rs
|
--> src/util/alternating_cell.rs
|
||||||
|
@ -160,7 +168,7 @@ error[E0277]: `UnsafeCell<value::SimValueInner<()>>` cannot be shared between th
|
||||||
12 | Intern::intern_sized(v)
|
12 | Intern::intern_sized(v)
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<value::SimValueInner<()>>` cannot be shared between threads safely
|
| ^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<value::SimValueInner<()>>` cannot be shared between threads safely
|
||||||
|
|
|
|
||||||
= help: within `SimValue<()>`, the trait `Sync` is not implemented for `UnsafeCell<value::SimValueInner<()>>`, which is required by `SimValue<()>: Sync`
|
= help: within `SimValue<()>`, the trait `Sync` is not implemented for `UnsafeCell<value::SimValueInner<()>>`
|
||||||
note: required because it appears within the type `util::alternating_cell::AlternatingCell<value::SimValueInner<()>>`
|
note: required because it appears within the type `util::alternating_cell::AlternatingCell<value::SimValueInner<()>>`
|
||||||
--> src/util/alternating_cell.rs
|
--> src/util/alternating_cell.rs
|
||||||
|
|
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue