Crate cmtrs_macros

Crate cmtrs_macros 

Source

Macros§

always
let #rule_name = always! { [fsm; | pipeline;] [\[#guard\]] (#inputs) [-> (#outputs)] { #body } };
anno
anno!("key" : "value", *);
branch
branch selectively executes statements according to a condition. In fact, branch actually makes branchs on a FSM. Different from if_!, it can have sequential control statements within its body, but itself can not be inside of a step!.
distinguisher
distinguisher!(#distinguish_str)
ext_method
let #method_name = ext_method!{ #enable; #ready; [\[#guard\]] (#inputs) [-> (#outputs)] { #body } };
external
external!([inputs_names], [output_names], Option<clock_name>, Option<reset_name>, firrtl_string);
for_
for_ mimics a C for-loop. There are two types:
generate
generate!(#invoke_gen_fn)
if_
if_!{#cond {#then_body} [else {#else_body}]}
input
input!(#name, #type)
instance
let #instance_name = instance!(#module);
io
let io = io! { (#param: #harware_type),* (#nested_itfc: #instance),* };
itfc_declare
Declare an module interface. Type parameters, IO ports, nested interfaces and method signatures can be declared.
method
let #method_name = method! { [fsm; | pipeline;] [\[#guard\]] (#inputs) [-> (#outputs)] { #body } };
method_rel
method_rel!(#method1 C #method2), conflicts.
method_rel_raw
method_rel_raw!(#methods1 #rel #methods2). #methods is &[RuleHandle]
move_
move_!(|...| {...})
named_always
let rule = named_always! { #name; [\[#guard\]] (#inputs) [-> (#outputs)] { #body } };
named_ext_method
let method = ext_method!{ #name; #enable; #ready; [[#guard\]] (#inputs) [-> (#outputs)] { #body } };
named_instance
named_instance(#instance_name; module);
named_method
let method = named_method! { #name; [\[#guard\]] (#inputs) [-> (#outputs)] { #body } };
named_var
named_var!(#name; #value)
output
output!(#name, #type)
par
par!(#statements;*)
ret
ret!(#value);
ret_raw
ret_raw!(#values)
schedule
schedule!(#rule_or_method, *)
schedule_raw
schedule_raw!(#rules_or_methods), accepts &[RuleHandle]
seq
seq!(#statements;*)
set_name
set_name!(#name)
sim_exit
sim_exit!();
sim_print
sim_print!(#args...)
statement
statement!(#value)
step
step!(#statements;*)
var
var!(#value)

Attribute Macros§

gen_fn
#[gen_fn] is an attribute on functions or methods. Attributed function will act as if it is part of a module. Used together with generate! macro.
module
Implement a module generator for certain interface.