• 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. ncelab 08.20-s003 *E,NLRMOS "Non-local reference to members...

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 64
  • Views 875
  • 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

ncelab 08.20-s003 *E,NLRMOS "Non-local reference to members of struct/union not supported."

cubicle82
cubicle82 over 16 years ago

(Systemverilog) I declared an enum-type inside my struct, and I need to call the enum's built-in functions next(), first(), and name().  Unfortunately, irun refuses to compile the code:

module cpu_state_test;

typedef logic [3:0] t_cpu_pipe_state;
//typedef logic [3:0] t_cpu_pipe_flags;

typedef enum t_cpu_pipe_state {
  S_IDLE = 4'd0,
  S_WAIT = 4'd1,
  S_FET0 = 4'd2,
  S_EXM0 = 4'd3,
  S_EXM1 = 4'd4,
  S_EXWB = 4'd5,
  S_STAL = 4'd6,
  S_HALT = 4'd7
} te_cpu_pipe_state;

typedef struct packed {
  logic ex_div_by_0;      // 0
  logic fetch_unaligned;  // 1
  logic ex_carry;         // 2
  logic ex_overflow;      // 3
  logic ex_saturation;    // 4
  logic [26:0] ex_reserved;// [31:5]
} t_cpu_pipe_flags;

typedef struct packed {
  te_cpu_pipe_state pipe;
  t_cpu_pipe_flags  flags;
  logic [31:0] idata; // instruction-word
  logic [31:0] pc;    // program-counter
  logic [31:0] wddata;// (data) write
  logic [31:0] rddata;// (data) read
} t_cpu_state;

t_cpu_state cpu_state;

initial begin : main
  cpu_state.pipe = cpu_state.pipe.first();
  do begin
    $display("  (0x%0h): %s", cpu_state.pipe, cpu_state.pipe.name() );
    cpu_state.pipe = cpu_state.pipe.next();
  end while ( cpu_state.pipe !== cpu_state.pipe.first() );

  $display( "end of testing...");
  #1 $finish(2);
end : main
endmodule : cpu_state_test

irun: 08.20-s003: (c) Copyright 1995-2008 Cadence Design Systems, Inc.

  cpu_state.pipe = cpu_state.pipe.first();
                                      |
ncelab: *E,NLRMOS (./cpu_state_test.sv,38|38): Non-local reference to members of struct/union not supported.

 

Is this a temporary restriction of irun's Systemverilog compiler? Or is it a bug?  It seems like a member-call to a built-in function should be exempt from the restriction "non-local reference".

  • Cancel
Parents
  • cubicle82
    cubicle82 over 16 years ago

    I was hoping to avoid additional code, but if tha's what it takes to get it to compile, then so be it.

    Thanks Tim.

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

    I was hoping to avoid additional code, but if tha's what it takes to get it to compile, then so be it.

    Thanks Tim.

    • 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