The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Apr 18th, 2024, 2:44pm
Pages: 1
Send Topic Print
genvar for loop instantiation (Read 399 times)
Shubham_Kumar
New Member
*
Offline



Posts: 2

genvar for loop instantiation
Dec 18th, 2022, 8:01pm
 
While modelling a VCDL need to instantiate 40 delay cells.

Following code gives error during compilation

// VerilogA for DLL_behavioural_vams, vcdl, veriloga

`include "constants.vams"
`include "disciplines.vams"

module vcdl(Phi, CK_in, Vctrl);
input Vctrl, CK_in;
electrical Vctrl, CK_in;
output [39:0] Phi;
electrical [39:0] Phi;

delay_cell dcell0(Phi[0], CK_in, Vctrl);


for(genvar i=1; i<40; i = i+1) begin
     delay_cell dcell(Phi[i], Phi[i-1], Vctrl);
end

endmodule


Log file contents :

Reading file:
       /user_data1/mtech/18IE34001/work_umc_180/DLL_behavioural_vams/vcdl/veriloga/ver
iloga.va
Reading file:
       /software/eda/cadence/installed_bds/SPECTRE171/tools.lnx86/spectre/etc/ahdl/con
stants.vams
Reading file:
       /software/eda/cadence/installed_bds/SPECTRE171/tools.lnx86/spectre/etc/ahdl/dis
ciplines.vams

Error found by spectre during AHDL compile.
  ERROR (VACOMP-2259): "for<<--? (genvar i=1; i<40; i = i+1) begin"
       "/user_data1/mtech/18IE34001/work_umc_180/DLL_behavioural_vams/vcdl/veriloga/ve
riloga.va",
       line 15: syntax error.

   ERROR (VACOMP-1814): Maximum allowable errors exceeded. Exiting AHDL
       compilation....


What is possibly going wrong  :-/?

getVersion()
"@(#)$CDS: virtuoso version 6.1.7-64b 12/16/2018 07:36 (sjfhw317) $"
getVersion("virtuoso")
"sub-version  IC6.1.7-64b.500.23 "
Back to top
 
 
View Profile   IP Logged
jbdavid
Community Fellow
*****
Offline



Posts: 378
Silicon Valley
Re: genvar for loop instantiation
Reply #1 - Dec 18th, 2022, 10:24pm
 
The error message is flagging "for" which I think needs to be included inside some form of block, maybe a generate block?
Good luck
Back to top
 
 

jbdavid
Mixed Signal Design Verification
View Profile WWW   IP Logged
Shubham_Kumar
New Member
*
Offline



Posts: 2

Re: genvar for loop instantiation
Reply #2 - Dec 18th, 2022, 11:06pm
 
I added the for in generate ... endgenerate block. Still getting the same error ! Not sure what exactly is the problem...

// VerilogA for DLL_behavioural_vams, vcdl, veriloga

`include "constants.vams"
`include "disciplines.vams"

module vcdl(Phi, CK_in, Vctrl);
input Vctrl, CK_in;
electrical Vctrl, CK_in;
output [39:0] Phi;
electrical [39:0] Phi;

delay_cell dcell0(Phi[0], CK_in, Vctrl);

generate
for(genvar i=1; i<40; i = i+1) begin
    delay_cell dcell(Phi[i], Phi[i-1], Vctrl);
end
endgenerate

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



Posts: 1998
Massachusetts, USA
Re: genvar for loop instantiation
Reply #3 - Mar 6th, 2023, 7:53am
 
I don't think Verilog-AMS allows variable declarations inside the for-loop: you need to declare genvar i; beforehand.

genvar i;

for(i=1; i<40; i = i+1) begin
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.