Observables, Verilog style

I was looking for an observable implementation similar to Verilog AMS or SystemVerilog.
There you would have constructs like

always @(sig1 && posedge(sig2)) // when sig1 (analog) changes AND sig2 (digital) does trans 0->1
   a = funCB(b,c);              // callback function

Compared to known implementations in Julia (React.jl or Observable.jl), there is a richer functionality: besides change, you can trigger on direction of change, and you can have shortcuts using observables.

I see two possibilities: implement from scratch or extend those above with some syntactic sugar using macros.
With the latter I have even less experience.
Any ideas?

You can do conditions with Observables.jl but you can’t have two observables triggering at the same time. They can only ever trigger one after the other, so the AND condition doesn’t really make sense.

But for all other conditions you could do:

onany(observable_1, observable_2) do obs1_val, obs2_val
    if condition(obs1_val, obs2_val)
1 Like

Thanks for the conditions hint.
Yes, the combination of events results is often difficult. A clean up before firing callbacks would require a custom implementation.