The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> How to Write a PWL Current Source,Please Help!!!THX https://designers-guide.org/forum/YaBB.pl?num=1510206643 Message started by DavidAnger on Nov 8th, 2017, 9:50pm |
Title: How to Write a PWL Current Source,Please Help!!!THX Post by DavidAnger on Nov 8th, 2017, 9:50pm Hello! I want to make a MTK PE+ protocol tester. So I want make a current wave like this: _|-|_|-|_|---|_|---|_|---|_|-----|_ (i_bus=0->delay TimeD->i_bus=itarget->delay TimeC->i_bus=0->delay TimeD->i_bus=itarget->delay TimeC->i_bus=0->delay TimeD->i_bus=itarget->delay TimeB->i_bus=0->delay TimeD->i_bus=itarget->delay TimeB->i_bus=0->delay TimeD->i_bus=itarget->delay TimeB->i_bus=0->delay TimeD->i_bus=itarget->delay TimeA->i_bus=0->delay TimeD) *TimeA=500ms *TimeB=300ms *TimeC=TimeD=100ms my code is: Code:
I know it is not right, but i don't know how to make delay in the loop. Please help, Thanks! |
Title: Re: How to Write a PWL Current Source,Please Help!!!THX Post by Geoffrey_Coram on Nov 9th, 2017, 7:05am I can't figure out what you are trying to do. I don't understand this: i_bus=0->delay TimeD->i_bus=itarget->delay TimeC->i_bus=0... and I don't know what MTK PE+ is. To me, a "PWL current source" is a spice element that takes an array of time,value pairs and generates a current that depends only on the time ($abstime). Your code shows that there is some additional input based on V(vbus) and V(vtarget), but I don't know what that is, or how it relates to the current wave you mention in the text. |
Title: Re: How to Write a PWL Current Source,Please Help!!!THX Post by DavidAnger on Nov 9th, 2017, 10:54pm Geoffrey_Coram wrote on Nov 9th, 2017, 7:05am:
Hi, Geoffrey_Coram I just want to known how to make delay in a loop. Can I make a PWL source with Duty 30% like this? Code:
I use this model to running, the simulation will get stuck at the "while" loop. So how to solved this? |
Title: Re: How to Write a PWL Current Source,Please Help!!!THX Post by Geoffrey_Coram on Nov 10th, 2017, 7:29am Code:
So, at the start of the simulation, $abstime = 0, and then pulse_timer = 0 + 100u*30/100, and of course the while loop gets stuck: $abstime =0 is less than 30u, so it keeps looping. |
Title: Re: How to Write a PWL Current Source,Please Help!!!THX Post by Geoffrey_Coram on Nov 10th, 2017, 7:39am Try this: Code:
|
Title: Re: How to Write a PWL Current Source,Please Help!!!THX Post by DavidAnger on Nov 12th, 2017, 7:04pm Geoffrey_Coram wrote on Nov 10th, 2017, 7:29am:
Thanks a lot! OK I got It. It's different between software that the expressions are not spend time. :D So $abstime just can changed at the analog loop beginning? And how can I make delay in "analog" loop? just like verilog "#delay"? |
Title: Re: How to Write a PWL Current Source,Please Help!!!THX Post by Geoffrey_Coram on Nov 13th, 2017, 6:22am There is no analog equivalent to digital #delay. You can do something like Code:
|
Title: Re: How to Write a PWL Current Source,Please Help!!!THX Post by DavidAnger on Nov 13th, 2017, 10:57pm Geoffrey_Coram wrote on Nov 13th, 2017, 6:22am:
Great Thanks! :D |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |