The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> use genvar for OOMR declarations
https://designers-guide.org/forum/YaBB.pl?num=1633344436

Message started by leoklein on Oct 4th, 2021, 3:47am

Title: use genvar for OOMR declarations
Post by leoklein on Oct 4th, 2021, 3:47am

Hi,
I have an image sensor I want to stimulate from toplevel testbench. So there is no direct/port access to the photodiodes, but I can force them like this:

real I_Cathode;
analog
 I("I_DUT.I_CORE.Cathode[0]",VSS) <+ transition(I_Cathode);
 I("I_DUT.I_CORE.Cathode[1]",VSS) <+ transition(I_Cathode);
...

But obviously I don't want to copy that line million of times, so I was searching for something like:

genvar i
analog
 for (i=0;i<1e6;i=i+1) begin
     $swrite(s,"I_DUT.I_CORE.Cathode[%i]",i);
     I(s,VSS) <+ transition(I_Cathode[i]);
 end


But it is not working as:
     I(s,VSS) <+ transition(I_Cathode[gint]);
          |
xmvlog: *E,EXPBON (...,114|11):  Expecting only branch or node type arguments [5.2(AMSLRM)].

which is somehow expected. Does anybody know a working solution for that?

Best Regards,
leo

Title: Re: use genvar for OOMR declarations
Post by Ken Kundert on Oct 5th, 2021, 4:03pm

There are a couple of issues here.  First is the Verilog-AMS language.  It does not allow you to pass strings to access functions.  Conceptually, the way to do what you want is:

Code:
for (i=0;i<1e6;i=i+1) begin
    I(I_DUT.I_CORE.Cathode[i],VSS) <+ transition(I_Cathode[i]);
end

Second is limitations in the implementations.  You are doing two things that are unusual, you are using a hierarchical reference and you are using a node array.  There is a reasonable chance that one or both are not supported by the simulator you are using (perhaps this is why you attempted to use strings in the first place).

Third is the practical issue of trying to simulate a circuit with a million nodes.  That is going to stretch the limits of most simulators and at a minimum will be too expensive.  You might want to rethink the approach and try to avoid using electrical nodes for the pixels.

-Ken

Title: Re: use genvar for OOMR declarations
Post by leoklein on Oct 14th, 2021, 2:28am

Hi Ken,

thanks a lot for the answer (I didn't get a email notification, so I found it only now).

The proposed solution works with spectre/xcelium - I'm sure I've tried that earlier without the string. Maybe something else was wrong before...

You're right about the 1M instances - I always try to reduce it and in reality worst case is around 23000 which is still slow, but needed due to the nonregular image area...

Best Regards,
leo

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.