36 lines
721 B
Rust
36 lines
721 B
Rust
use super::types::Type;
|
|
|
|
/// ID of a definition (e.g. variable, block, function)
|
|
#[derive(Debug, Clone, Copy)]
|
|
pub struct DefId(pub u32);
|
|
#[derive(Debug, Clone, Copy)]
|
|
pub struct ExprId(pub u32);
|
|
|
|
/// an abstract element that performs some kind of computation on inputs
|
|
#[derive(Debug, Clone)]
|
|
pub struct Expr {
|
|
pub id: ExprId,
|
|
pub kind: ExprKind,
|
|
pub typ: Type,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub enum ExprKind {
|
|
Literal,
|
|
Path(DefId),
|
|
Call { called: DefId, args: Vec<Expr> },
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct Signal {
|
|
pub id: DefId,
|
|
pub typ: Type,
|
|
}
|
|
|
|
/// A block of HDL code, e.g. comb block
|
|
#[derive(Debug, Clone)]
|
|
pub struct Block {
|
|
pub signals: Vec<Signal>,
|
|
pub expr: Expr,
|
|
}
|