module V_jk_ff(q, qbar, clk, j, k); input clk,j,k; output q,qbar; voltage q, qbar, clk,j,k; parameter real tdelay = 5n from [0:inf), ttransit = 5n from [0:inf), vout_high = 5, vout_low = 0 from (-inf:vout_high), vth = 1.4; integer x; analog begin @(initial_step) x = 0; @(cross(V(clk) - vth, +1)) begin if (V(j) > vth) case (V(k) > vth) 1 : x = !x; 0 : x = 1; endcase else if (V(k) > vth) x = 0; end V(q) <+ transition( vout_high*x + vout_low*!x, tdelay, ttransit ); V(qbar) <+ transition( vout_high*!x + vout_low*x , tdelay, ttransit ); end endmodule