• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. IUS82s012: is this legal "for ( genvar g = 0; g < 4; ++g...

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 64
  • Views 1743
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

IUS82s012: is this legal "for ( genvar g = 0; g < 4; ++g ) ..."?

cubicle82
cubicle82 over 16 years ago

I tried auto-declaring a generate-var inside a generate-block:

module a;

wire [3:0] x;

generate
for ( genvar g = 0; g < 4; ++g ) begin :gen_g
    assign x[g] = 1'b0;
end : gen_g
endgenerate

endmodule : a

irun-8.2s012 gives me this error-message:

for ( genvar g = 0; g < 4; ++g ) begin :gen_g
           |
ncvlog: *E,FNDKWD (a.sv,6|11): A Verilog keyword was found where an identifier was expected.

 

Naturally, I can just move the 'genvar g'  oustide of the for() block.  But it would be nice to be able to use inline-style of loop-var declaration with genvars.

  • Cancel
Parents
  • cubicle82
    cubicle82 over 16 years ago

    RE: ++g vs g++

    Oh, it's an old habit! In C/C++ code, I very rarely embed a dec/inc index-operation with data-manipulation.  I.e.:

      str[ i++ ] = 0;

      or my least favorite: *optr++ = *iptr++;

    Instead, I tend to separate it into multiple statements, simply because I find it easier to read.  Other programmers will use both forms, depending on the loop-situation.  Although the code is more compact, I (personally) find it harder to read, especially late at night after staring at the monitor for 5 hours :)

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • cubicle82
    cubicle82 over 16 years ago

    RE: ++g vs g++

    Oh, it's an old habit! In C/C++ code, I very rarely embed a dec/inc index-operation with data-manipulation.  I.e.:

      str[ i++ ] = 0;

      or my least favorite: *optr++ = *iptr++;

    Instead, I tend to separate it into multiple statements, simply because I find it easier to read.  Other programmers will use both forms, depending on the loop-situation.  Although the code is more compact, I (personally) find it harder to read, especially late at night after staring at the monitor for 5 hours :)

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information