Artur Petrosyan
Artur Petrosyan

Reputation: 11

Random pulse generation in SystemVerilog

I am new in SystemVerilog world need help. I am currently developing a small Verilog System which needs a random pulse generation module.

The module needs to randomly generate a pulse based on some probability value.

Could you please help me implementing such a system?

I have found some examples which do random pulse generation. 1. Random pulse generator however this example doesn't include any probability, and this one is in Verilog. 2. Pulse generator in System Verilog. This example has some information about probability. But it generates only numbers and I cannot figure out how to change the numbers to pulses, and make the probability work.

Upvotes: 0

Views: 484

Answers (1)

dave_59
dave_59

Reputation: 42788

You can take any uniform random number and turn it to a probability by comparing it to a value. Given that the largest 32-bit number is 2,147,483,647, you have a 10% chance of seeing a number less than 214,748,364. Work your probabilities into a power of 2 simplifies thing. Since the probability of any one of the bits being 1 is 50%, the probability of any set of 3 bits being 1 is 12.5%.

Upvotes: 2

Related Questions