Expand description
§Fayalite
Fayalite is a library for designing digital hardware – a hardware description language (HDL) embedded in the Rust programming language. Fayalite’s semantics are based on FIRRTL as interpreted by LLVM CIRCT.
§Organization
All Fayalite-based designs are organized as one or more modules
– modules are created by writing a Rust function with the
#[hdl_module] attribute. You can then invoke the function to create a module.
You use the implicitly-added m: ModuleBuilder variable in that
function to add inputs/outputs and other components to that module.
#[hdl_module]
pub fn example_module() {
#[hdl]
let an_input: UInt<10> = m.input(); // create an input that is a 10-bit unsigned integer
#[hdl]
let some_output: UInt<10> = m.output();
connect(some_output, an_input); // assigns the value of `an_input` to `some_output`
}