2 bit hot encoding using SV constraints

Q) Write a system verilog constraint to make a signal 2 bit hot.

Sol) I have implemented it using $countones==2. What’s another way of solving this without using in-built function?

In reply to Akhil Mehta:

You can solve it by using someone else to do your work for you. :)

When you say " without using in-built function" do you mean any in-built function, or just not $countones?

In reply to dave_59:

Hi Dave, any method other than $countones.

In reply to Akhil Mehta:

Hi, You can refer to this article.