The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 10:22pm
Pages: 1
Send Topic Print
Help needed for modelling a sensor block in VAMS (Read 3499 times)
shaikh_sarfraz
Junior Member
**
Offline



Posts: 17

Help needed for modelling a sensor block in VAMS
Oct 24th, 2007, 8:48am
 
Hi,
I have to model a sensor block in Verilog-AMS.
The problem is some thing like this:

I have 32 arrays of real values. Each array holds 40 real values.

A0[39:0]= 3 a 4 5 2...............e 1
A1[39:0]=...............................
..............................................
..............................................
A31[39:0]=..........................d 6


Now I have to select each array and take each real value in that array at a time and after some processing assign it into output analog port.

The statements will look like this


electrical [39:0] OUT
genvar i,j;
real dp,pd;


/*There will be 32 real arrays declared*/
real [39:0] A1;
real [39:0] A2;
.......
.......
real [39:0] A32;

analog@(initial_step)
begin      

for (i=0;i<32;i = i+1)

begin
     if (i == 0)
     begin
           for (j=0;j<40;j = j+1)
                               begin
                    dp = A0[j] ;
                    pd = 1.5 - 1.05 - dp/55;
                    V(OUT[j]) <+ pd;
                                end
     end

     if (i == 1)
     begin
           for (j=0;j<40;j = j+1)
           begin
                    dp = A1[j] ;
                    pd = 1.5 - 1.05 - dp/55;
                    V(OUT[j]) <+ pd;
                                end
     end
........
.........
....../*Here we will assign each real array(A0[39:0], A1[39:0]......A31[39:0]) to the output port (OUT[39:0])
one at a time, so there will be 32 if statements for passing 32 real arrays*/

     if (i == 31)
     begin
           for (j=0;j<40;j = j+1)
           begin
                    dp = A31[j] ;
                    pd = 1.5 - 1.05 - dp/55;
                    V(OUT[j]) <+ pd;
                                end
     end
end
end



Here is the list of problems which we are facing:
1). We cannot assign electrical (analog) ports (OUT[39:0]) inside for loop.
2). To solve this problem we used generate statement. But we cannot use nested generate  loop.

In short our problem is that we have 32 arrays with each array holding 40 real values.
Now we have to pass each of these 40 real values to the 40 bit analog output.
And in between we have to process (manipulations) each of these 40 real values , so it requires nested loops.

It seems like the Verilog-AMS language (and AMS simulators) has few limitations due to which this problem is not getting solved.
I will appreciate any help for any body for providing any work around for this problem.

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



Posts: 1999
Massachusetts, USA
Re: Help needed for modelling a sensor block in VA
Reply #1 - Oct 24th, 2007, 12:21pm
 
I think you probably *don't* want the contribution statements
 V(OUT[j]) <+ pd;
to be inside if statements.

I would suggest you create a real array vout, add up all the values from the different i,j blocks in nested for-loops, and then do the contribution in a single generate loop at the end.

(Is it V-AMS that prohibits nested generate loops, or your simulator?)
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
shaikh_sarfraz
Junior Member
**
Offline



Posts: 17

Re: Help needed for modelling a sensor block in VA
Reply #2 - Oct 24th, 2007, 9:28pm
 
Thanks for the suggestion.....I will try it out and see if it succeeds.... Smiley

Regarding the nested generate statements:  I am using Cadence AMS Designer suite. Here I am getting error during complation stage saying that "Affirma AMS doesnot support nested generate statement"

So the toll doesnot supports it.

Also when I checked with Accellera VerilogAMS manual, it says generate statements are obsolete.

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



Posts: 1999
Massachusetts, USA
Re: Help needed for modelling a sensor block in VA
Reply #3 - Oct 30th, 2007, 11:37am
 
shaikh_sarfraz wrote on Oct 24th, 2007, 9:28pm:
Also when I checked with Accellera VerilogAMS manual, it says generate statements are obsolete.


Not really relevant here (you just care about what your tool supports now): I think the original "generate" construct in Verilog-AMS (1.0? 2.0?) is obsolete, but a new generate is coming in LRM 2.3 and is based on some 1364-2005 definition of the construct to be compatible with SystemVerilog.
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.