1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! Standard components built from `hdl-cat-circuit` primitives
//! and `hdl-cat-sync` state machinery.
//!
//! # Component catalogue
//!
//! | Component | Shape | Summary |
//! |---|---|---|
//! | [`half_adder`] | `CircuitArrow<bool⊗bool, bool⊗bool>` | `(a, b) → (sum, carry)` |
//! | [`full_adder`] | `CircuitArrow<(bool⊗bool)⊗bool, bool⊗bool>` | `(a, b, cin) → (sum, cout)` |
//! | [`counter()`] | `Sync<Obj<Bits<N>>, CircuitUnit, Obj<Bits<N>>>` | `state + 1` each cycle |
//! | [`down_counter()`] | `Sync<Obj<Bits<N>>, CircuitUnit, Obj<Bits<N>>>` | `state - 1` each cycle |
//! | [`accumulator()`] | `Sync<Obj<Bits<N>>, Obj<Bits<N>>, Obj<Bits<N>>>` | `state + input` each cycle |
//! | [`toggle_ff`] | `Sync<Obj<bool>, CircuitUnit, Obj<bool>>` | flips the state each cycle |
//! | [`shift_register_left()`] | `Sync<Obj<Bits<N>>, Obj<bool>, Obj<Bits<N>>>` | shift left, new bit at bit 0 |
//!
//! # Examples
//!
//! ## Accumulating a stream of values
//!
//! ```
//! # fn main() -> Result<(), hdl_cat_error::Error> {
//! use hdl_cat_std::accumulator;
//!
//! let acc = accumulator::<8>()?;
//! assert_eq!(acc.state_wire_count(), 1);
//! assert_eq!(acc.input_wires().len(), 2); // state + input
//! # Ok(()) }
//! ```
//!
//! ## Building a half-adder from primitive gates
//!
//! ```
//! # fn main() -> Result<(), hdl_cat_error::Error> {
//! use hdl_cat_std::half_adder;
//!
//! let ha = half_adder()?;
//! assert_eq!(ha.inputs().len(), 2); // a, b
//! assert_eq!(ha.outputs().len(), 2); // sum, carry
//! assert_eq!(ha.graph().instructions().len(), 2); // XOR + AND
//! # Ok(()) }
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;