[][src]Function kaze::if_

pub fn if_<'a, T>(cond: &'a Signal<'a>, when_true: T) -> If<'a, T>

UNSTABLE: Provides a convenient way to write conditional combinational logic.

Panics

Since this construct wraps the returned values with mux, any panic conditions from that method apply to the generated code as well.

Examples

use kaze::*;

let c = Context::new();

let m = c.module("MyModule");
let i = m.input("i", 1);
let invert = m.input("invert", 1);
let o = if_(invert, {
    !i
}).else_({
    i
});
m.output("o", o);