sylak
Junior Member
Offline
Posts: 24
Silicon valley
|
I recently came across this verilogA module for analog multiplexer.. but even arfter reading up manuals I have not quite understood how the argument of @cross function works.... I understand up until the 'direction' argument.. .. I know the rest of them are simulator arguments(can recognise abstol) but not how they work ... can someone throw more light on it...???
module analog_mux(vin1, vin2, vsel, vout); input vin1, vin2, vsel; output vout; electrical vin1, vin2, vsel, vout ; parameter real vth = 2.5;
integer selector; real vout_val;
analog begin selector = (V(vsel) > vth) ? 1: 0;
@ (cross(V(vsel) - vth, 1, 1.0, vsel.potential.abstol)) selector = 1;
@ (cross(V(vsel) - vth, -1, 1.0, vsel.potential.abstol)) selector = 0;
if (selector == 1)begin vout_val = V(vin1); end else if (selector == 0)begin vout_val = V(vin2); end
V(vout) <+ vout_val; end endmodule
|