2022-02-06 22:19:55 +00:00
|
|
|
use super::{types::Type, Context};
|
2022-01-30 22:54:19 +00:00
|
|
|
|
2022-02-06 22:19:55 +00:00
|
|
|
/// an abstract element that performs some kind of computation on inputs
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct Expr<'ty> {
|
2022-01-30 22:54:19 +00:00
|
|
|
pub id: u32,
|
2022-02-06 22:19:55 +00:00
|
|
|
pub inputs: Vec<Expr<'ty>>,
|
2022-01-30 22:54:19 +00:00
|
|
|
pub typ: Type<'ty>,
|
|
|
|
}
|
|
|
|
|
2022-02-06 22:19:55 +00:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct Signal<'ty> {
|
2022-01-30 22:54:19 +00:00
|
|
|
pub id: u32,
|
2022-02-01 18:46:06 +00:00
|
|
|
pub typ: Type<'ty>,
|
2022-01-30 22:54:19 +00:00
|
|
|
}
|
|
|
|
|
2022-02-06 22:19:55 +00:00
|
|
|
/// A block of HDL code, e.g. comb block
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct Block<'ty> {
|
|
|
|
pub signals: Vec<Signal<'ty>>,
|
|
|
|
pub expr: Expr<'ty>,
|
|
|
|
}
|