Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crave variables not randomize by default ? #4

Open
hvdschoot opened this issue Apr 8, 2022 · 5 comments
Open

Crave variables not randomize by default ? #4

hvdschoot opened this issue Apr 8, 2022 · 5 comments

Comments

@hvdschoot
Copy link

Hi,

I now have Crave integrated and working in my "elaborate" UVM-SC testbench. Crave variables are being randomized subject to the Crave constraints I put in place - using the experimental API as advised - when invoking randomize(), as one would expect. It is still early going for me and I'd like to do quite a bit more exploration with using

  • more complex constraints
  • layered constraints (i.e. hierarchical across "has-a" class object relationships)
  • overriding constraints (i.e. across "is-a" class object relationships)
  • using crave vectors, arrays
  • etc.

Two issues I am finding thus far I would like to report here:

  1. Crave vectors: using a crave vector yields an internal error, which has since been reproduced and confirmed by Thilo. I have pasted the error down belo for completeness

  2. Crave variables are only randomized when there are explicit active constraints on them, meaning constraints that I have coded. In other words, a crave variable that is not subject to a written constraint does not get randomized at all and instead holds its initial/current value. This is surprising and not aligned with the behavior of SystemVerilog rand variables, where each rand variable gets randomized by default within its type domain. Is this a bug or a Crave "feature"? That is, is this intended behavior?
    If it were then this would not set the stage well for a constrained random approach towards targeting coverage closure where stimulus attributes are minimally constrained early on - letting the power of randomness as loose as possible - until remaining coverage holes need be targeted in a more directed manner with increasing constraints.

Regards - Hans

[cmd.00c4 5m:19s] In file included from /local_vol1_nobackup/user/hvdschoot/projects/vcn5_0_5342109/out.er/linux_3.10.0_64/common/pub/crave/include/crave/backend/../ir/visitor/metaSMTNodeVisitor.hpp:37:0,
[cmd.00c4 5m:19s] from /local_vol1_nobackup/user/hvdschoot/projects/vcn5_0_5342109/out.er/linux_3.10.0_64/common/pub/crave/include/crave/backend/FactoryMetaSMT.hpp:31,
[cmd.00c4 5m:19s] from /local_vol1_nobackup/user/hvdschoot/projects/vcn5_0_5342109/out.er/linux_3.10.0_64/common/pub/crave/include/crave/backend/VariableSolver.hpp:35,
[cmd.00c4 5m:19s] from /local_vol1_nobackup/user/hvdschoot/projects/vcn5_0_5342109/out.er/linux_3.10.0_64/common/pub/crave/include/crave/backend/VariableGenerator.hpp:30,
[cmd.00c4 5m:19s] from /local_vol1_nobackup/user/hvdschoot/projects/vcn5_0_5342109/out.er/linux_3.10.0_64/common/pub/crave/include/crave/backend/Generator.hpp:33,
[cmd.00c4 5m:19s] from /local_vol1_nobackup/user/hvdschoot/projects/vcn5_0_5342109/out.er/linux_3.10.0_64/common/pub/crave/include/crave/ConstrainedRandom.hpp:36,
[cmd.00c4 5m:19s] from /local_vol1_nobackup/user/hvdschoot/projects/vcn5_0_5342109/out.er/linux_3.10.0_64/common/pub/include/vcn_uvmf/sc/src/vcn_test.h:52,
[cmd.00c4 5m:19s] from /local_vol1_nobackup/user/hvdschoot/projects/vcn5_0_5342109/out.er/linux_3.10.0_64/common/pub/include/vcn_uvmf/sc/vcn_uvmf:37,
[cmd.00c4 5m:19s] from /local_vol1_nobackup/user/hvdschoot/projects/vcn5_0_5342109/vidcore/cdefe/src/verif/uvmf_sc_tb_package/ltb/sc_main.cpp:30:
[cmd.00c4 5m:19s] /local_vol1_nobackup/user/hvdschoot/projects/vcn5_0_5342109/out.er/linux_3.10.0_64/common/pub/crave/include/crave/backend/../ir/visitor/../../frontend/RandomBase.hpp: In instantiation of 'void crave::__rand_vec_base1<T1, T2>::gen_values(unsigned int) [with T1 = sc_dt::sc_uint<64>; T2 = sc_dt::sc_uint<64>]':
[cmd.00c4 5m:19s] /local_vol1_nobackup/user/hvdschoot/projects/vcn5_0_5342109/vidcore/cdefe/src/verif/uvmf_sc_tb_package/ltb/sc_main.cpp:465:1: required from here
[cmd.00c4 5m:19s] /local_vol1_nobackup/user/hvdschoot/projects/vcn5_0_5342109/out.er/linux_3.10.0_64/common/pub/crave/include/crave/backend/../ir/visitor/../../frontend/RandomBase.hpp:163:28: error: 'crave::randv<sc_dt::sc_uint<64> > r' has incomplete type
[cmd.00c4 5m:19s] static randv r(NULL);

@SchulzSt
Copy link
Contributor

VWG: @voertler will send out a pull request.

@hvdschoot
Copy link
Author

Hi guys,
I may just get up in a few hours to attend the "very early" meeting this week, in particular becuase I have spent some time on using Crave including testing of the uniform distribution fix etc., but in case I won't make it after all, this is to let you know that I have tested the uniform distribution fix, and see it behaving favorably in that I now get random values for variables even when there are no constraints on such variable. That said, I do still run into quite some issues overall, with constraints not working, or not being solved, and other peculiar things, too convoluted to list here. THe worst is, getting a segmentation fault during the solver process appears more the rule than the exception. Anyway, I will leave it at this for now, and provide more details verbally in the meeting, and/or respond on the github page in response to my action item.

@voertler
Copy link
Contributor

@hvdschoot Sorry not for replying earlier. Is there any way to get a stripped down example with regard to the segmenation fault?And does it only occur with the mentioned pull pequest for uniform distribution?

@hvdschoot
Copy link
Author

hvdschoot commented Feb 22, 2023 via email

@voertler
Copy link
Contributor

I think this issue can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants