The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 8:31pm
Pages: 1
Send Topic Print
Syntax error while using genvar (Read 2916 times)
magathi
New Member
*
Offline



Posts: 3
Utah
Syntax error while using genvar
Aug 31st, 2007, 10:30am
 
Iam just tring to implement the adc example in the 'designers guide to verilog ams'
This is part of the code Iam using....

parameter integer bits = 8 from [1:24];      
genvar i;
integer g;

analog begin
     @(cross(V(clk)-thresh,+1) or initial_step) begin
     sample =V(in);
     midpoint = fullscale/2.0;
     for (g=bits-1; g>=0; g=g-1)begin
           if (sample>midpoint) begin
             result[g]=vdd;
             sample = sample-midpoint;
           end
           else begin
             result[g]=0.0;
           end
           sample =2.0*sample;
     end
     end //end cross

     for (i=0;i<bits; i= i+1)
     begin
     V(out[i])<+transition(result[i],td,tt);
     end
     end //analog end

when I try simulating this using  AMS (Analog design environment XL) this is the error I get....
Error found by spectre.
   Problem found in instance `pip_adc_top.I9' of module `pip_adc'
     for (i=0;i<bits; i= i+1)
               |
ncelab: *E,SYERROR (/home/mjayara/test/pip_adc_top/adexl/results/data/Interactive.44/1/test:pip_adc
_top:1/netlist/ihnl/test/pip_adc/verilogams/verilog.vams,39|11): In for-loop control, genvar expression can only consists of integer constant or other unrolled genvar variables expression.

Could someone help me out.... As far as I see it Iam using integer constants in the genvar expression......
Back to top
 
 
View Profile   IP Logged
Marq Kole
Senior Member
****
Offline

Hmmm. That's
weird...

Posts: 122
Eindhoven, The Netherlands
Re: Syntax error while using genvar
Reply #1 - Sep 26th, 2007, 1:49am
 
Hi,

Is the analog for-loop allowed to depend on a parameter in the version of AMS Designer you are using? You could try to replace the "bits" in the for-loop control by an integer constant. Is the "out" array terminal also dependent on "bits"? If not, try to use the same value here. In the past I've used macro variables to get around this limitation in Verilog-A/AMS compilers, i.e. `BITS.

Marq
Back to top
 
 
View Profile   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.