Negative number constraints SV

In reply to tejasakulu:

Then that would simply be $countones(a) == 2, not equal ==1.

rand shortint a;
 
constraint c1 {
                  a inside {[-1024:-1]} && $countones(a) ==2;
 
}

-16 has 12 bits set.