From cea799cfccb340074f6a1f7ef12effe04e60235e Mon Sep 17 00:00:00 2001 From: Minseong Jang Date: Sun, 29 Sep 2024 11:17:34 +0900 Subject: [PATCH] Add documentation of fsm function --- hazardflow-designs/src/std/interface.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hazardflow-designs/src/std/interface.rs b/hazardflow-designs/src/std/interface.rs index 980b0ed..06b7c66 100644 --- a/hazardflow-designs/src/std/interface.rs +++ b/hazardflow-designs/src/std/interface.rs @@ -26,6 +26,16 @@ pub trait Interface: Sized { /// In particular, for a hazard interface [`I`], you must follow the specification described in the "Safety" /// section of [`I::fsm`]. /// + /// # How it is compiled? + /// + /// In the HazardFlow compiler, the fsm function is not actually executed (which would lead to a panic). + /// + /// Instead, the HazardFlow compiler captures the [High-level IR](https://rustc-dev-guide.rust-lang.org/hir.html) + /// generated by the Rust compiler and extracts information about the ingress/egress/state types (`Self`, `E`, `S`) + /// and the arguments (`init_state`, `f`) of the fsm function. + /// + /// Using this information, the HazardFlow compiler generates the corresponding Verilog code. + /// /// # Type parameters /// /// - `Self`: The ingress interface type.