Maybe rename fire to fired? "fire" seems too much like an action, instead of a query.
Also, is it possible for connect(a,b) to be replaced by some syntax sugar, like a <= b or a := b ?
Maybe adjacent #[hdl] lines could be joined in a single #[hdl] {block}?
It is a bit hard to distinguish combinatoric and clocked assignments. Maybe adopt a naming convention for registers? For instance, reg_count or count_r?
I got that naming from Chisel and I think ReadyValid probably is more familiar to hardware engineers.
a := b isn't valid rust syntax, so that's not something I can do without totally ruining how well rust IDEs can tell you which types and stuff are used. a <= b is hardwired as less-equal, which ends up as Rust's standard PartialOrd trait which is semantically only for comparisons and is forced to return bool (e.g. implementing that would also make it much easier to misuse Expr<T> by using the other comparison operators and or putting it in sorted containers. So, imo neither of those are particularly good choices...Rust just doesn't have that many overridable operators -- which is intentional so expensive stuff doesn't get hidden.
#[hdl] really only covers the construct its immediately attached to, inside that construct it goes back to being normal rust code, so I think it would be more confusing.
That could be useful, though is also somewhat unusual for idiomatic Rust. It is also a bit more annoying when you write code.
I think an even better name would be firing since the idea is that it returns true if a transfer is happening on the next clock edge, and firing_data returns HdlSome(data) if a transfer is happening on the next clock edge.
I'll make that change once CI finishes running since it cancels if you push a new commit before it has finished, and I want it to actually have a chance to store the cached ccache stuff for compiling yosys so it takes a few minutes instead of like 40min.