Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9182955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:41:08+00:00 2026-06-17T18:41:08+00:00

How do you implement a hardware random number generator in an HDL (verilog)? What

  • 0

How do you implement a hardware random number generator in an HDL (verilog)?

What options need to be considered?


This question is following the self-answer format. Addition answers and updates are encouraged.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:41:09+00:00Added an answer on June 17, 2026 at 6:41 pm

    An LFSR is often the first port of call. Implementation is relatively simple, a shift register with a number of terms XORd together to create the feedback term.

    When considering the implementation of the LFSR, the bit width of the random number and the repeatability of the number need to be considered. With N bits a Maximal LFSR will have (2**N) - 1 states. All zero state can not be used with out additional hardware.

    An example 4 bit LFSR with taps a bit 0 and bit 4:

    module fibonacci_lfsr(
      input  clk,
      input  rst_n,
    
      output [4:0] data
    );
    
    wire feedback = data[4] ^ data[1] ;
    
    always @(posedge clk or negedge rst_n)
      if (~rst_n) 
        data <= 4'hf;
      else
        data <= {data[3:0], feedback} ;
    
    endmodule
    

    Choosing tap points and finding out the sequence length (number of numbers before it repeats) can be found from this table.

    For example a sequence of 17,820,000, 30 bits wide could use taps of :

    0x20000029 => bits "100000000000000000000000101001"   
    0x2000005E => bits "100000000000000000000001011110"
    0x20000089 => bits "100000000000000000000010001001"
    

    The first would have a feedback term of:

    feedback = data[29] ^ data[5] ^ data[3] ^ data[0];
    

    If you are unsure of the order of the taps, remember that the MSB will always be a feedback point. The Last (tap) feedback point defines the effective length of the LFSR, after that it would just be a shift register and have no bearing on the feedback sequence.

    If you needed a sequence of 69,273,666 you would have to implement a 31 bit LFSR and choose 30 bits for your random number.

    LFSRs are a great way to create a 1-bit random number stream but if you are taking multiple consecutive bits that there is a correlation between values, it is the same number shifted plus dither bit. If the number is being used as a dither stream you may want to introduce a mapping layer, for example swap every other bit. Alternatively use an LFSR of different length or tap points for each bit.

    Further Reading

    Efficient Shift Registers, LFSR Counters, and Long Pseudo-Random Sequence Generators,
    A Xilinx app note by Peter Alfke
    .

    Linear Feedback Shift Registers in Virtex Devices,
    A Xilinx app note by Maria George and Peter Alfke
    .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question. Recently I was looking into ways to implement hardware rendering
if we implement java interpreter in hardware then how we can achieve architecture neutrality
To implement github like fork/pull request function in my project, the auto-merge feature need
I posted an answer to another stackoverflow question which requires some digital logic to
I'm writing a vertex shader at the moment, and I need some random numbers.
I need to implement off-screen rendering to texture on an ARM device with PowerVR
I have implement code Record video in Android Phone . This code is working
I need to implement 2 way (caller and receiver) call recording on Windows Mobile.
I need to implement an app that can track a GPS equipped vehicle and
This question os partially a Drupal question and partially a SQL question. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.