module V_rs_ff(q, qbar, set, reset); input set,reset; output q,qbar; voltage q, qbar, set, reset; 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,y,warning_on; analog begin @(initial_step) begin x = 0; y = 0; warning_on = 1; input_set = V(set) > vth; input_reset = V(reset) > vth; end @(cross(V(set) - vth)) begin input_set = V(set) > vth; warning_on=1; e nd @(cross(V(reset) - vth)) begin input_reset = V(reset) > vth; warning_on=1; e nd if (input_set && input_reset) begin x = 1; y = 1; if (warning_on) begin $strobe("Warning: set and reset high\n"); warning_on = 0; end end else begin case (1) input_set : begin x = 1; y = 0; end input_reset : begin x = 0; y = 1; end endcase end V(q) <+ transition( vout_high*x + vout_low*!x, tdelay, ttransit ); V(qbar) <+ transition( vout_high*y + vout_low*!y, tdelay, ttransit ); end endmodule