Re: Generating "random" bytes

Discussion in 'VHDL' started by bknpk@hotmail.com, Aug 13, 2013.

  1. Guest

    בת×ריך ×™×•× ×©×œ×™×©×™, 22 בספטמבר 1998 09:00:00 UTC+2, מ×ת Chris Plachta:
    > Hello,
    >
    > I've been looking for a simple way to generate random (or pseudorandom)
    > std_logic_vectors. I haven't found any standard random number
    > generation command in VHDL. All I really need to do is crank out bytes
    > of random data for simulation purposes.
    >
    > Suggestions?
    >
    > --
    > Chris Plachta
    > Alcatel USA
    > Phone: 707-792-7271
    > FAX: 707-792-6310


    Take a look at bknpk vhdl:
    "...
    This page explains how I randomize the TTL field values. In this project I have already discussed the issue of generating random numbers. While previous case was merely delay between packets, this one is a little bit complex.When the DUT is in learning state (see FSM description), small changes in the TTL are required. Later an attack scenario is presented to the DUT, by vhdl bench.

    --random numbers generation
    signal rand_ttl_delta : std_logic_vector(3 downto 0) := "1000";
    signal rand_ttl_deltai : integer := 8;
    ....
    rand_ttl_delta <= f_my_rand (4, rand_ttl_delta);
    -- 3 2 1
    -- 109876543210987654321098765
    if(o_tot_cnt(31 downto 5) = "000000000000000000000000000") then
    --small changes during average calculation (learning state)
    gen_rand := "00" & rand_ttl_delta(1 downto 0);
    else
    gen_rand := rand_ttl_delta;
    end if;
    tmp_ptr.data := tmp_ptr.data + gen_rand;
    --
    write(my_line, string'("gen_rand "));
    hwrite(my_line, tmp_ptr.data);
    write(my_line, string'(" "));
    --write(my_line, gen_ipv4);
    hwrite(my_line, o_tot_cnt);
    write(my_line, string'(" "));
    write(my_line, now);
    writeline(output, my_line);
    ...."
    http://bknpk.no-ip.biz/my_web/SDIO/ip_ttl_filter_ttl_rand.html
    , Aug 13, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Collins
    Replies:
    3
    Views:
    5,986
    Jason Collins
    Feb 18, 2004
  2. mrby

    4-bytes or 8-bytes alignment?

    mrby, Nov 2, 2004, in forum: C Programming
    Replies:
    8
    Views:
    397
    Mark McIntyre
    Nov 2, 2004
  3. globalrev
    Replies:
    4
    Views:
    734
    Gabriel Genellina
    Apr 20, 2008
  4. VK
    Replies:
    15
    Views:
    1,095
    Dr J R Stockton
    May 2, 2010
  5. Andy
    Replies:
    0
    Views:
    201
Loading...

Share This Page