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
//! cmtir is the central intermediate representation (IR) for Cement (cmt2) languages and compiler tools.
//!
//! Key features:
//! + Rule-based syntax and semantics
//! + Natural parse-print support
//! + Def-use support for operations
//! + Compatibility with FIRRTL
//!
//! ## Design
//!
//! cmtir is implemented based on [kir](https://github.com/arch-of-shadow/kir), which provides a consistent pattern of parse-print support for all IR components.
//!
//! `src/ir` defines different components of `cmtir`:
//!
//! + `ir::op`: operations.
//! + `ir::instance`: instance declaration and usage.
//! + `ir::literal`: literals.
//! + `ir::rule`: rules.
//! + `ir::structure`: module and circuit.
//! + `ir::error`: span and error messages.
//!
//! All structs in `cmtir` have the consistent pattern of `SExpr` derive, which is a macro that provides parse-print support (see [kir::SExpr](https://github.com/arch-of-shadow/kir/blob/uv/macros/src/sexpr.rs)).
//!
//! For operations, `cmtir` derives `OpIO` trait (also defined in `kir`), which provides def-use support: taking/updating def/use values of operations. For most operations, the `OpIO` trait is derived automatically when `#[opio(xxx)]` is specified on the struct fields.
//!
//! ## External Module
//!
//! `cmtir` accepts **FIRRTL code as external modules**. This is useful for reusing existing modules from the FIRRTL (or Chisel, Chipyard) ecosystem. Also, since FIRRTL supports blackbox SV modules, `cmtir` is also compatible with SV legacy code indirectly.
//!
//! The question is, how `cmtir` treat RTL external modules in the rule-based semantics? `cmtir` provides syntax to declare **external rules** for external modules, each of which specifies the real hardware behavior of the corresponding rule, like setting up some signals. `cmtir` also provides syntax to **bind** `cmtir` module ports and RTL ports in external modules.
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use anyhow;
pub use json;