#56 SVE doesn't recognize ` definitions

open
nobody
None
5
2013-02-05
2013-01-31
No

If I use a pre defined value, but put a ` in front, like:

bit [`REG_DATA_WIDTH-1 : 0] data_reg,fusedata;

SVE says "macro "REG_DATA_WIDTH" undefined"

But in another file there's the definition: `define REG_DATA_WIDTH 32

If I remove the ` caracter it's works. But I have a huge project full of these type of use..

Related

Feature Requests: #56

Discussion

  • The scenario above is currently supported by SVE.

    I've attached an example to illustrate this case. Unpack the attached example, import the project into SVE, then rebuild the index (Rebuild SV Index on the project's context menu).

    • RegisterDefines.svi defines a macro (REG_DATA_WIDTH)
    • DeviceInterface.sv includes RegisterDefines.svi and references `REG_DATA_WIDTH
    • DeviceClass.svh is included by DeviceInterface.sv, and also references `REG_DATA_WIDTH

    Hope this helps

     
    Attachments
  • StevenAZ
    StevenAZ
    2013-02-01

    We have also been using this for some time. Check that the argument files.f is being parsed correctly. What I have found is that unless the files.f is being parsed correctly, nothing works properly. Check:
    - That the path to files.f appears to be correct
    - The terminal output where you launched eclipse is clean, and not full of "can't find ..."
    - The console is clean (Windows>ShowView>Console) You may need to enable "debug to console" Windows>Preferences>SV Editor

     
  • Matthew, I did exactly you ask me and it doesn't work (see the attachement)
    I wish to open this as a bug, but I was confusing when I opened this ticket, sorry.

     
    Attachments
  • Alfredo,
    Thank you for trying the above and providing a screenshot. It does appear that there is some issue here -- I'm just not yet certain what it is.

    What happens if you close the editor for DeviceClass.svh, then re-open the file? Is the error marker still shown in the editor?
    
    Please open the Problems view (Window->Show View->Problems). Are any errors from the svi_example project shown in this view?
    
    I will, of course, continue to investigate from my side. However, any additional information you can provide is much appreciated.
    

    Thanks,
    Matthew

     
  • If I close the editor and re-open it the same problem happen.
    I think it's a problem it parser of caracter `, because if I remove it, even if I don't use a include tag on the file, all works fine, and if I select the word it the problem and press F3 the declaration opens.

    The Problems view is clean.

    Another question: If I don't use the include tag on my files I'll have theses error mark? because here we don't use include tags, we use a tool to generate compile command line and include all file needed.

     
  • StevenAZ
    StevenAZ
    2013-02-01

    I have a suspicion that the issue has to do with "globally included" `defines (i.e. A file is included somewhere else, and this file is not included in the file with the errors. I'll put a test case together to prove this out but I am 99% that is what is going on at this point.

     
  • Steven, I agree with you. The SVEditor parser is implemented as single-file compilation unit, and so has no concept of 'global' macros. Some simulator compilers default to SFCU, some default to MFCU, and some provide no control over which mode is used. So, it's reasonable to expect some environments to be dependent on multi-file compilation unit mode.

    Supporting MFCU mode is one requirement on the next phase of SVEditor index development. Sadly, it's not a simple task...

     
  • Erik Jessen
    Erik Jessen
    2013-02-01

    Matt,
    I actually kind of like a switch where one is forced to do the global includes into files, in that it helps a lot to identify what's getting pulled in from where. A huge problem with global files is that people merge multiple projects, each with globaldefines with the same name, and you never know which one(s) are getting picked up.

    So in SV, defines are pretty much deprecated in favor of packages, where one has namespace control. We're trying to move to usingdefines just for meta-control: switching code in/out of use. But even that should be able to be done with configuration statements, in about 99% of the time.
    And the rest is plusargs.

    If you add MFCU, could you still have a 'lint' mode or something where SFCU is used, or you can at least report (as warnings or something) where things aren't followed?
    SVEditor is going to be tremendously valuable as a linter - I'm already looking at adding 'lint' checks on top of the database. I just need a few spare weeks to learn Java and your structures.... LOL...

    Erik

    From: Matthew Ballance [mailto:mballance@users.sf.net]
    Sent: Friday, February 01, 2013 1:57 PM
    To: [sveditor:feature-requests]
    Subject: [sveditor:feature-requests] #56 SVE doesn't recognize ` definitions

    Steven, I agree with you. The SVEditor parser is implemented as single-file compilation unit, and so has no concept of 'global' macros. Some simulator compilers default to SFCU, some default to MFCU, and some provide no control over which mode is used. So, it's reasonable to expect some environments to be dependent on multi-file compilation unit mode.

    Supporting MFCU mode is one requirement on the next phase of SVEditor index development. Sadly, it's not a simple task...


    [feature-requests:#56]http://sourceforge.net/p/sveditor/feature-requests/56/ SVE doesn't recognize ` definitions

    Status: open
    Created: Thu Jan 31, 2013 07:23 PM UTC by Alfredo Salvarani
    Last Updated: Fri Feb 01, 2013 09:50 PM UTC
    Owner: nobody

    If I use a pre defined value, but put a ` in front, like:

    bit [`REG_DATA_WIDTH-1 : 0] data_reg,fusedata;

    SVE says "macro "REG_DATA_WIDTH" undefined"

    But in another file there's the definition: `define REG_DATA_WIDTH 32

    If I remove the ` caracter it's works. But I have a huge project full of these type of use..


    Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/sveditor/feature-requests/56/

    To unsubscribe from further messages, please visit https://sourceforge.net/auth/prefs/


    This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.

     

    Related

    Feature Requests: #56

  • On the new version 1.4.1 the intial problem related here was solved! Thanks!
    But, there's someting left, if I use this kind of declarition:
    typedef logic[BIU_ADDR_WIDTH-1:2] BIU_PFB_ADDR_T; TheBIU_ADDR_WIDTH is marked whit a error mark and if I remove the character ` the error mark is removed. if I press F3 on BIU_ADDR_WIDTH the declaration on svi file is opened. So I think it's easy to solve.
    Thanks!

     
  • Alfredo, glad to hear 1.1.4 is an improvement.

    Erik and others, my current thinking is to add a MFCU (multi-file compilation unit) mode to the parser where macro defines propagate across top-level files within a single argument-file tree, but maintain SFCU (single-file compilation unit) mode as the default where the macro state is reset at the start of each top-level file. My feeling is that providing support for MFCU mode is important, since existing compilers support this mode and (consequently) existing codebases require it. However, I think code that compiles in SFCU mode is easier to understand and reuse, hence keeping SFCU as the default.

     
  • Erik Jessen
    Erik Jessen
    2013-02-05

    I think that's a good idea.
    My personal belief is that with SV (and its capabilities) plus the ever-increasing sizes of designs and IP reuse from many sites, macros (and any other global functions) will become deprecated.

    I personally have had too many problems with `define collisions between vendors during IP integration to use defines for anything other than very quick "patches" during debug.

    And I would recommend to anyone who is doing coding, to use packages and functions instead. You'll be ahead of the curve.

    Erik

    From: Matthew Ballance [mailto:mballance@users.sf.net]
    Sent: Tuesday, February 05, 2013 8:53 AM
    To: [sveditor:feature-requests]
    Subject: [sveditor:feature-requests] #56 SVE doesn't recognize ` definitions

    Alfredo, glad to hear 1.1.4 is an improvement.

    Erik and others, my current thinking is to add a MFCU (multi-file compilation unit) mode to the parser where macro defines propagate across top-level files within a single argument-file tree, but maintain SFCU (single-file compilation unit) mode as the default where the macro state is reset at the start of each top-level file. My feeling is that providing support for MFCU mode is important, since existing compilers support this mode and (consequently) existing codebases require it. However, I think code that compiles in SFCU mode is easier to understand and reuse, hence keeping SFCU as the default.


    [feature-requests:#56]http://sourceforge.net/p/sveditor/feature-requests/56/ SVE doesn't recognize ` definitions

    Status: open
    Created: Thu Jan 31, 2013 07:23 PM UTC by Alfredo Salvarani
    Last Updated: Tue Feb 05, 2013 10:28 AM UTC
    Owner: nobody

    If I use a pre defined value, but put a ` in front, like:

    bit [`REG_DATA_WIDTH-1 : 0] data_reg,fusedata;

    SVE says "macro "REG_DATA_WIDTH" undefined"

    But in another file there's the definition: `define REG_DATA_WIDTH 32

    If I remove the ` caracter it's works. But I have a huge project full of these type of use..


    Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/sveditor/feature-requests/56/

    To unsubscribe from further messages, please visit https://sourceforge.net/auth/prefs/


    This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.

     

    Related

    Feature Requests: #56

  • Now, another strange thing is happening, in some cases a lot of problems shows in one line, but the reference is of (if you press F3 on the word, the declaration is showing accordly)

    The errors is:
    Multiple markers at this line
    - ${workspace_loc}/c55fmc2/projects/c55fmc_tb/vectors/bhv/sv_program_stim/stim_cebist.sv:109 Unexpected token in primary: ":"
    - ${workspace_loc}/c55fmc2/projects/c55fmc_tb/vectors/bhv/sv_program_stim/stim_cebist.sv:109 Expecting one of keyword "endtask" ; received ":"
    - macro "BIU_ADDR_WIDTH" undefined

    On line 109

    Please see the attachment

     
    Attachments
  • Alfredo,
    The parse errors are consistent with SVEditor not finding the macro declaration. An undefined macro is expanded as "" (empty string). So, from the parser's perspective, the declaration would look like this (for example):

    bit[:0] addr;

    Given what you've stated previously about the structure of your code, resolving these missing-macro errors will either involve SVEditor supporting MFCU mode, or will involve some restructuring of your code.
    

    One workaround you could try would be to create an artificial top-level file that includes the .svi files and your source files. This file would `include files in the same order as they are listed in the the argument file. For example, if your argument file looks like this:

    c55fmc2.f:
    BIUDefines.svi
    C55RegisterDefines.svi
    C55GeneralDefines.svi
    stim_cebist.sv

    Your dummy root file would look like this:

    c55fmc2_root.sv:
    include "BIUDefines.svi"include "C55RegisterDefines.svi"
    include "C55GeneralDefines.svi"include "stim_cebist.sv"

    You would then specify this dummy root file in your argument file:
    c55fmc2_new.f:
    c55fmc2_root.sv