Ideal Switch using Veriloga

Status
Not open for further replies.

urn

Newbie level 6
Joined
Dec 4, 2009
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
USA
Activity points
1,363
Hi,

I want to implement an ideal switch using veriloga code.

Can any one help me out with this issue.

Thanks in Advance,
 

Maybe you can create a voltage controlled resistor as a switch, when switch-on, set the resistance = 0 , when switch-off, set the resistance = a large number, see, 1e15. In fact, the resistor just is the turn-on and turn-off resistance of the switch.
 

Hi,

Code:
`include "disciplines.vams"

module relay (p, n, ps, ns);
    parameter real thresh=0;	// threshold (V)
    output p, n;
    input ps, ns;
    electrical p, n, ps, ns;

    analog begin
	@(cross( V(ps,ns) - thresh, 0 ))
		;
	if (V(ps,ns) > thresh)
		V(p,n) <+ 0;
	else
		I(p,n) <+ 0;
    end
endmodule

Taken from "The Designer's Guide to Verilog-AMS" by Kundert & Zinke.
Chapter 3, Listing 17.

You can find this example (and a lot more) here: https://www.designers-guide.org/Books/dg-vams/
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…