Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

verilog-a case statement in analog block

Status
Not open for further replies.

cnd9

Newbie level 2
Joined
Apr 20, 2016
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
19
Hi,

I'm running verilog-a for the first time and trying to get the following code to work:


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
analog begin
    if (sIntegral > 0) 
        integrand = V(bj);
    else
        integrand = 0;
    sIntegral = idt(integrand,.5);
 
    $fstrobe(fprt,"%f", integrand);
    $fstrobe(fprt,"%f", sIntegral);


etc.....

The behavior I want to see is, "sIntegral" starts at 0.5 and (if V(bj) is negative), keeps decreasing until int(Vdt) becomes less than zero, at which point I want the integration to stop.

Instead, "integrand" initializes to zero, sIntegral initializes to 0.5, and neither change in the simulation as verified with the strobe statements (even though there is definitely a voltage present).

How can I make the conditional statement re-evaluate at each time step so that the integral/integrand will update?


thank you!
 
Last edited by a moderator:

Hi,

You can add the following statements before analog begin and check
Code:
initial begin
integrand =V(bj)
sIntegral = 0.5
end

Also please try the following code,
Make integrand as electrical and add the following statement
Code:
V(integrand) <+ (sIntegral > 0)? V(bj) : 0;
sIntegral = idt(integrand,0.5);

VerilogA executes the statements with "<+" assignment everytime any variable in RHS changes so this should work. Along with initial statement this should work.
I didnt try to verify either of them, but you can give it a try.
 
Last edited by a moderator:

Hi, thanks very much for the reply. In the initial block, should I actually say

"V(integrand) = V(bj)"?

And similarly, for the integral,

sIntegral = idt(V(integrand),0.5)

rather than just using "integral" alone?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top