回复 10# 灵淼
`include "constants.vams"
`include "disciplines.vams"
module over_voltage_protect_6v(OUT, GND, VDD, VIN);
inout VDD,GND;
input VIN;
output VOUT;
electrical OUT, GND, VDD, VIN;
parameter real Vref_high=6.6;
parameter real Vref_low =6.27;
parameter real Out_high=5;
parameter real Out_low =0;
integer out;
analog begin
@(initial_step) out=V(VIN)>Vref_high?1:0;
@(cross(V(VIN)-Vref_high,1)) out=1;
@(cross(V(VIN)-Vref_low,-1)) out=0;
V(VOUT)<+transition(out?Out_high:Out_low,1n,1n,1n);
end
endmodule |