Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 106903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:40:12+00:00 2026-05-11T01:40:12+00:00

In Specman, how can I tell if a reference to a unit has the

  • 0

In Specman, how can I tell if a reference to a unit has the do-not-generate modifier, ‘!’, at the reference’s definition?

e.g.

unit foo_u { };   extend sys {    foo : foo_u is instance;    foo_ptr_generated : foo_u;    keep foo_ptr_generated == foo;    !foo_ptr_notgenerated : foo_u;    connect_pointers() is also {       foo_ptr_notgenerated = foo;    }; }; 

Without inspecting the code or relying on a naming convention, how can I tell that foo_ptr_generated went through Specman’s constraint solver and foo_ptr_notgenerated was procedurally set?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:40:12+00:00Added an answer on May 11, 2026 at 1:40 am

    Finally figured this out. This code will determine which references are generated and which aren’t in Specman 6 via the reflection interface:

    <' type my_t : [ A,B,C]; unit foo_u {    sub_typiness : my_t;    other_sub_typiness : my_t;      when A'sub_typiness foo_u {       !bar_ptr : bar_u;    };     when B'other_sub_typiness foo_u {       in_b_sub_type : int;    };     when A'sub_typiness B'other_sub_typiness foo_u {       in_a_b_subtype :int;    };    b : bah_u is instance; };   unit bar_u {    sub_typiness : my_t;    other_sub_typiness :my_t;     when B'sub_typiness bar_u {       !foo_ptr : foo_u;    };    when C'other_sub_typiness bar_u {       inc_sub_type : int;    };     when A'other_sub_typiness bar_u {       !you_shouldnt_see_this_field : bah_u;    };     when B'sub_typiness C'other_sub_typiness bar_u{       in_b_c_subtype :int;    };    !b : bah_u;    b2 : bah_u; };  unit bah_u {  };   extend any_unit {     !path_to_parent :string;    !my_e_path : string;      post_generate() is also {       if not me is a sys {           path_to_parent = get_parent_unit().e_path();       };       my_e_path = e_path();    };     print_pointers() is {       for each ( wf ) in rf_manager.get_struct_of_instance(me).as_a(rf_like_struct).sd_.all_when_fields {          if not str_match(wf.name,'/___/'){           };       };       for each (sub_unit) in get_all_units(any_unit) {          sub_unit.print_pointers();       };    }; };  struct wank_s {    oh_joy: int; }; extend sys {    foo : A'sub_typiness B'other_sub_typiness foo_u is instance;    bar : B'sub_typiness C'other_sub_typiness bar_u is instance;    keep bar.b2 == foo.b;     wank : wank_s;     connect_pointers() is also {       foo.bar_ptr = bar;       bar.foo_ptr = foo;       bar.b = foo.b;    };     !possible_ptr : any_unit;    !is_a_unit : bool;    !an_e_path : string;    !a_unit : any_unit;    !a_field : field;    --     -- rf_manager.get_all_unit_instances    my_specman( cmd : string ) : bool is {       try {          --out(cmd);          specman(cmd);       } else {          return FALSE;       };       return TRUE;    };     check_generation() is also {       out('PRINT OUT FIELDS');       var all_units : list of any_unit;       for each any_unit(u) in get_all_units(any_unit) {          for each ( wf ) in rf_manager.get_struct_of_instance(u).as_a(rf_like_struct).sd_.all_when_fields {             --print wf.source_ref;             --print wf.source_ref.to_string().as_a(uint);             --if wf.source_ref.to_string().as_a(uint) > 1000 and not str_match(wf.name,'/___/'){             if not str_match(wf.name,'/___|driver_trans/'){                an_e_path = append(u.e_path(),'.',wf.name);                an_e_path = append(an_e_path, ' - marked_as_reachable=',wf.fgi.marked_as_reachable);                if wf.base_type is a struct_descriptor (s){                   an_e_path = append(an_e_path, ' - instantiated == ', s.instantiated);                };                 if wf.base_type is a struct_descriptor (s) and not s is a list_descriptor and not s is a long_descriptor {                    sys.is_a_unit = FALSE;                   if not my_specman(append('sys.is_a_unit = ( ',u.e_path(),'.',wf.name,                      ' != NULL)')) {                      sys.is_a_unit = FALSE;                   };                   if sys.is_a_unit {                      if not my_specman(append(' sys.is_a_unit = (',u.e_path(),'.',wf.name,                         '.as_a(any_struct) == ',u.e_path(),'.',wf.name,'.get_enclosing_unit(any_unit).as_a(any_struct))')) {                         sys.is_a_unit = FALSE;                      };                   };                    if sys.is_a_unit and str_match(wf.name,'/([\w_]+'+[\w_']*)[\w_]+/') {                      if not my_specman( append( 'sys.is_a_unit = ( ',u.e_path(),                            ' is a ', $1, ' ',                             rf_manager.get_struct_of_instance(u).as_a(rf_like_struct).sd_.name,                            ')')) {                         sys.is_a_unit = FALSE;                      };                   };                     if is_a_unit {                      sys.a_unit = NULL;                      if not my_specman(append('sys.a_unit = (',u.e_path(),'.',wf.name,                         '.as_a(any_unit))')) {                         sys.a_unit = NULL;                      };                       if sys.a_unit != NULL {                          sys.an_e_path = NULL;                         var printout := append(':: ',u.e_path(), '.', wf.name);                         compute my_specman(append( 'sys.an_e_path = ',u.e_path(),'.',wf.name,                            '.my_e_path'));                         if append(u.e_path(),'.',wf.name) != sys.an_e_path {                            printout = append(printout, ' -> ');                             printout = append(printout, sys.an_e_path);                            if wf.fgi != NULL and wf.fgi.gcs.size() > 0 and (                               wf.fgi.gcs[0].last_reduction != UNDEF or                               wf.fgi.gcs[0].gcois.size() > 0 ) {                                 printout = append(printout, ' GENERATED POINTER');                            };                         };                         out(printout);                       };                   };                };                  --out( '    ',an_e_path);                 --specman(append('print ',u.e_path(),'.',wf.name));             };          };           --for each ( m ) in rf_manager.get_struct_of_instance(u).as_a(rf_like_struct).sd_.methods {          --   if m != NULL {          --      out(m.md.name);          --   };          --};          --print u.get_all_attribute_names();          --print u.get_attribute('agent');          --print u.agent_kind();           -- for each (m) in rf_manager.get_struct_of_instance(u).get_declared_methods() {          --    print m;          -- };          -- out('fields at '',u.e_path(),''s struct level:');          -- for each (f) in rf_manager.get_struct_of_instance(u).get_declared_fields() {          --    out( '    ',u.e_path(),' -> ',f.f_.short_name);          -- };          -- out('fields at '',u.e_path(),''s exact sub-type level:');          -- for each (f) in rf_manager.get_exact_subtype_of_instance(u).get_declared_fields() {          --    out( '    ',u.e_path(),' -> ',f.f_.short_name);          -- };          -- out('');       };        -- out('\nPRINT OUT UNIT INSTANCES');       -- for each any_unit(u) in {sys;foo;bar} {       --    for each (i) in rf_manager.get_all_unit_instances(u) {       --       if i != u {       --          out(u.e_path(), ' has unit ', i.e_path());       --       };       --    };       -- };     };  };  '> 

    Running with:

    specman -c 'load rf_test.e; gen' 

    Produces:

    Generating the test using seed 1... PRINT OUT FIELDS :: sys.bar.B'sub_typiness'foo_ptr -> sys.foo :: sys.bar.b -> sys.foo.b :: sys.bar.b2 -> sys.foo.b GENERATED POINTER :: sys.foo.A'sub_typiness'bar_ptr -> sys.bar :: sys.foo.b :: sys.logger.base_unit -> sys :: sys.logger :: sys.foo :: sys.bar  Starting the test ... Running the test ... 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Specman I can convert a variable to a string using either: x.to_string(); or
Where can I find an updated syntax file for specman? There are a number
Specman has the apply() method to perform the same action on all elements of
I want to count the number of set bits in a uint in Specman:
I have the following code in specman: var x := some.very.long.path.to.a.variable.in.another.struct; while (x ==
I am writing a class to implement an algorithm. This algorithm has three levels
I have the following code in specman that I inherited: some_method() is { var
i'm new to specman. how do i use the output_from() function. and what does
I want to be able to specify the file name stem for the log
Supposing I have a string: str = ab,cd,ef and I want to split it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.