RegisterLogin  
Update Profile
   
You are here: Forum  
Minimize 
SVUG Community Forum
Subject: write a random generator that applies wheights to the different values
Prev Next
You are not authorized to post a reply.

Author Messages
MihaelaUser is Offline

Posts:3

02/09/2010 2:23 AM  

In my example there is an enumeration type that defines four operations. Now each enumeration value is associated with a number, starting from 0. So in the case of these commands we would have a number range from 0 to 3, and we only can generate numbers in this range with equal probability.

 

 

  typedef enum  { nop, reset, load, count} command_t;

 

How to write a function that can count the percentage of the occurrence of each of the numbers which could be used to generate a weight?

If the $urandom_range() function returns a number that has already occurred according to the weight then you just discard it, how to call that function again and use the new (most likely different) number?

Thanks,

Mihaela

You are not authorized to post a reply.
Forums > General Discussion > Main Discussion Area > write a random generator that applies wheights to the different values



ActiveForums 3.7
  

 Copyright 2008 by SystemVerilog User Group Contact Us    Privacy Statement