Expand description
§DAG functionality for awint
NOTE: This crate acts as the backend for the starlight
crate, but
others may use it for their own projects as well.
NOTE: there is one significant wart, being that the concatenation macros
in dag::*
mode may not be no-ops if a None
is returned. Use unwrap
s
on the outputs of the concatenation macros and check assertions for now.
This crate is intended to be used as a reexport from the awint
crate with
the “dag” feature flag enabled.
Outside of the core functionality which will be useful for big integer
arithmetic in constrained environments, there is a secondary goal with this
system of awint
crates to create a new kind of RTL description library
that is not a DSL but is rather plain Rust code that can be run normally.
This awint_dag
crate supplies a “mimicking” structs with the same names as
their counterparts in awint::awi::*
, the difference being that they
have lazy execution, creating a DAG recording the order in which
different Bits
operations are applied.
See the documentation of the starlight
crate for examples of usage.
§Important Notes
- If you try to use a mimicking
bool
in anif
statement or with some binary operations you will get an error.Bits::mux_
can be used to conditionally merge the result of two computational paths instead of usingif
statements. - The mimicking types have an extra
opaque
constructor kind that has no definitive bit pattern. This can be accessed throughBits::opaque_
,*Awi::opaque(w)
, and in macros likeinlawi!(opaque: ..8)
. This is useful for placeholder values in algorithms that prevents evaluation from doing anything with the sink tree of these values. - The macros from
awint_dag
use whateverusize
,*Awi
, andBits
structs are imported in their scope. If you are mixing regular and mimicking types and are getting name collisions in macros, you can glob importawint::awi::*
orawint::dag::*
in the same scope as the macro (or add an extra block scope around the macro to glob import in), which should fix the errors. - There are generation counters on the
PState
s that are enabled when debug assertions are on - In long running programs that are generating a lot of separate DAGs, you
should use things such as
starlight::Epoch
s for each one, so that thread local data is cleaned up
Re-exports§
pub use common::DummyDefault;
pub use mimick::primitive;
pub use awint_macro_internals::triple_arena;
pub use smallvec;
Modules§
- All mimicking items except the mimicking assertion macros
- Access to special epoch structs and functions. Most users should instead use a downstream epoch management construct such as the
Epoch
from thestarlight
crate. - Mimicking structs used to record a DAG of operations on
awint
types
Macros§
- Mimicking
assert
that takesawi::bool
ordag::bool
- Mimicking
assert_eq
that takes inputs ofAsRef<dag::Bits>
- Mimicking
assert_ne
that takes inputs ofAsRef<dag::Bits>
. This checks for bitwidth equality. - Returns the
Location
at the first layer of macros this is in
Structs§
- Location for an item in the source code. This is essentially a
std::panic::Location<'static>
with all public fields.
Enums§
- This struct is just used for the
eval
function. - The result of an evaluation on an
Op<Awi>
- A mimicking
Op
eration
Traits§
- A trait for mimicking structs that allows access to the internal state