svinst icon indicating copy to clipboard operation
svinst copied to clipboard

SVInst misses package dependencies

Open fpgauserdude opened this issue 1 year ago • 7 comments

module testing
 #(parameter max_tokens_p
   , parameter lg_credit_to_token_decimation_p
   , parameter param_pkg::count_negedge_p test = 0
   , parameter extra_margin_p = 0
   , parameter check_excess_credits_p = 1
   , parameter start_full_p = 1
   , parameter use_async_w_reset_p = 0)
    (
      input w_clk_i
    , input wire w_inc_token_i
    , test_if intf1
    , test_pkg::test_type input_struct
    , input w_reset_i
    , input r_clk_i
    , input r_reset_i
    , input r_dec_credit_i
    , input r_infinite_credits_i  // basically suppress this module
    , output logic r_credits_avail_o
    );


   localparam                     bdy_Pkg::testing param_t = '1;
   bdy_pkg2::testother struct_type;

endmodule

I was hoping that "param_pkg", "test_pkg", "bdy_Pkg", "bdy_pkg2" would be detected as potential package dependencies. I know there are ambiguities in the language that those packages could be referring to static members of a class.

Are there any ways to use SVInst to find these dependencies?

Thanks.

fpgauserdude avatar Sep 05 '24 22:09 fpgauserdude

I have what might be a fix for both the issues I flagged. Are you up for pull requests? It looks like this project might be abandoned (which is really too bad). This is the best utility for verilog/systemverilog dependency analysis that I have been able to find.

fpgauserdude avatar Sep 06 '24 15:09 fpgauserdude

Sure, PRs welcome! I haven't worked on this for awhile, but am glad to hear that you found it useful. This might also be a good time to bump the sv-parser version, since the current version used is ~2 years old.

sgherbst avatar Sep 07 '24 02:09 sgherbst

I'll send you a pull request on a branch. Keep in mind, this is the first rust code I've ever written!

I have also added a new input argument option to accept the code from a pipe on stdin. I needed that feature for my own purposes, but you can obviously reject that if you don't like it.

fpgauserdude avatar Sep 09 '24 14:09 fpgauserdude

I think I need access to create a PR.

fpgauserdude avatar Sep 09 '24 15:09 fpgauserdude

Sorry for the delay - just sent you an invite to be a collaborator for this repository.

sgherbst avatar Sep 23 '24 06:09 sgherbst

Just pushed to branch "package-fixes". The changes would make more sense if you saw the python code that is used to run this code. Note that I added a "class_def" output because, unfortunately, sometimes a class instance is indistinguishable from a package instance (at least in the current version of the sv-parser). I am using the class_defs to remove instances to packages that are known to be classes.

Also note that I have not created any new unit tests for these changes. I suppose I could try and get around to that if you want. I am very new to rust though.

fpgauserdude avatar Sep 23 '24 15:09 fpgauserdude

OK great - could you open a pull request for this branch?

sgherbst avatar Sep 24 '24 03:09 sgherbst