The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 8:38pm
Pages: 1
Send Topic Print
oscillator (Read 1604 times)
kamath
Junior Member
**
Offline



Posts: 16

oscillator
Aug 16th, 2007, 4:27am
 
i am designing period-controlled-oscillator,but not getting the desired output from block.please suggest any changes to be made

module myosc(in,out,clk);
input in,clk;
output out;
electrical in,out,clk;

parameter real vh=1.5;
parameter real vl=0;


parameter real vtrans=0.6;
parameter real maxp=(1/5000000);
parameter real minp=(1/500);
integer comp;
integer n;
real period;
real step;



analog begin

@(initial_step)begin
period=(1/500000);

step=(1/5000) + $abstime;
end

@(timer(step))begin
n=!n;
step=step+(0.5*period);
end

@(cross(V(clk)-vtrans,1))
begin
if((V(in)-vtrans)>0)
comp=1;
else
comp=-1;
period = period +(comp*step);
end

if(period>maxp)
period=maxp;
if(period<minp)
period=minp;

V(out)<+transition(n?vh:vl,0,100p);
end


endmodule
         
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: oscillator
Reply #1 - Aug 16th, 2007, 8:05am
 
kamath wrote on Aug 16th, 2007, 4:27am:
@(initial_step)begin
period=(1/500000);

step=(1/5000) + $abstime;
end


1) Why $abstime?  Won't it always be 0 when initial_step occurs?

2) the step is much larger than the period (step = 200u, period = 2u), so the timer(step) will let 100 periods elapse ...
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.