One hot coverage of 32-bit vector

Hello friends,

Recently I came across a situation where I had to write a functional coverage for a 32-bit register of DUT which has a one hot kind of value configured i.e. only one bit can be set at a time. Then first idea that came in my mind was to write a single bin for each bit i.e. 32 bins/coverpoints in total. But that was not a good solution at all if you have 64 bits to be covered.

While reading the System Verilog LRM, I came to below solution.

Link for pseudo code

As this snippet is only for coverage purpose, it won’t check whether only a single bit is getting written. You need to write extra checks which make sure that only single bit is being written at a time.

Hope this will help you.


2 responses

  1. Super Alay 🙂


    1. Thank you Karthik.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: