$onehot

by Ray Salemi on March 5, 2010

If you are creating automatic stimulus using the randomize() method and you need a value to be one-hot, you can use the built in $onehot assertion.  This assertion returns a 1 if the value inside it is a one-hot.  The assertion looks like this:

assert(myreq.randomize() with{
$onehot(onehot_reg) == 1;});

This code will clear all the bits in onehot_reg then randomly set one of them.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • StumbleUpon
  • Technorati
  • TwitThis

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Leave a Comment

Previous post:

Next post: