Array of bits on to a signal in VHDL

Discussion in 'VHDL' started by JSreeniv, Jul 14, 2009.

  1. JSreeniv

    JSreeniv Guest

    Hi all,
    I need some suggestion on writing testbench of non-systhesizable code
    I have 32-bit hex word; for example: 0x1000 1000 and this should be
    transmitted on rcom_tx output signal using Manchester encoding(for 1--
    >10, 0-->01). 32-bit hex word in Binary forma is

    b^0001_0000_0000_0000_0001_0000_0000_0000
    Now the manchester form is(MSB-->LSB):
    01010110_01010101_01010101_01010101_10010101_01010101_01010101_01010101
    for every bit of manchester there is 50 ns +/- 15 ns delay
    so what i am writing as my concepts of VHDL: For MSB(01010110)
    wait for 50 ns; rcom_tx<='0';
    wait for 50 ns; rcom_tx<='1';
    wait for 50 ns; rcom_tx<='0';
    wait for 50 ns; rcom_tx<='1';
    wait for 50 ns; rcom_tx<='0';
    wait for 50 ns; rcom_tx<='1';
    wait for 50 ns; rcom_tx<='1';
    wait for 50 ns; rcom_tx<='0';
    ----------------------------------------------
    Here i need confirmation that: Is there any other easy way of writing
    this data on rcom_tx with delay. And also suggest how to represent the
    tolerance value with this.

    Please give me suggestions
    Sreeniv
     
    JSreeniv, Jul 14, 2009
    #1
    1. Advertising

  2. On Jul 14, 10:04 am, JSreeniv <> wrote:
    > Hi all,
    > I need some suggestion on writing testbench of non-systhesizable code
    > I have 32-bit hex word; for example: 0x1000 1000 and this should be
    > transmitted on rcom_tx output signal using Manchester encoding(for 1-->10, 0-->01). 32-bit hex word in Binary forma is
    >
    > b^0001_0000_0000_0000_0001_0000_0000_0000
    > Now the manchester form is(MSB-->LSB):
    > 01010110_01010101_01010101_01010101_10010101_01010101_01010101_01010101
    > for every bit of manchester there is 50 ns +/- 15 ns delay
    > so what i am writing as my concepts of VHDL: For MSB(01010110)
    > wait for 50 ns; rcom_tx<='0';
    > wait for 50 ns; rcom_tx<='1';
    > wait for 50 ns; rcom_tx<='0';
    > wait for 50 ns; rcom_tx<='1';
    > wait for 50 ns; rcom_tx<='0';
    > wait for 50 ns; rcom_tx<='1';
    > wait for 50 ns; rcom_tx<='1';
    > wait for 50 ns; rcom_tx<='0';
    > ----------------------------------------------
    > Here i need confirmation that: Is there any other easy way of writing
    > this data on rcom_tx with delay. And also suggest how to represent the
    > tolerance value with this.
    >
    > Please give me suggestions
    > Sreeniv


    u can store the value in a variable and shift it every 50 ns using a
    FOR loop.
     
    Shanmugavel D, Jul 14, 2009
    #2
    1. Advertising

  3. JSreeniv

    backhus Guest

    On 14 Jul., 07:04, JSreeniv <> wrote:
    > Hi all,
    > I need some suggestion on writing testbench of non-systhesizable code
    > I have 32-bit hex word; for example: 0x1000 1000 and this should be
    > transmitted on rcom_tx output signal using Manchester encoding(for 1-->10, 0-->01). 32-bit hex word in Binary forma is
    >
    > b^0001_0000_0000_0000_0001_0000_0000_0000
    > Now the manchester form is(MSB-->LSB):
    > 01010110_01010101_01010101_01010101_10010101_01010101_01010101_01010101
    > for every bit of manchester there is 50 ns +/- 15 ns delay
    > so what i am writing as my concepts of VHDL: For MSB(01010110)
    > wait for 50 ns; rcom_tx<='0';
    > wait for 50 ns; rcom_tx<='1';
    > wait for 50 ns; rcom_tx<='0';
    > wait for 50 ns; rcom_tx<='1';
    > wait for 50 ns; rcom_tx<='0';
    > wait for 50 ns; rcom_tx<='1';
    > wait for 50 ns; rcom_tx<='1';
    > wait for 50 ns; rcom_tx<='0';
    > ----------------------------------------------
    > Here i need confirmation that: Is there any other easy way of writing
    > this data on rcom_tx with delay. And also suggest how to represent the
    > tolerance value with this.
    >
    > Please give me suggestions
    > Sreeniv


    Hi Sreeniv,
    as said before, a loop is a good idea.

    Another, but not so good, possibility is the after statement:

    rcom_tx <= 0,
    1 after 50 ns,
    1 after 100 ns,
    1 after 150 ns,
    1 after 200 ns,
    1 after 250 ns,
    1 after 300 ns,
    1 after 350 ns;

    To model your jitter you can use ( 35 ns + tx_jitter).
    Where txjitter is a value between 0 and 30 ns that has to be
    calculated somehow.
    Pseudo random noise sequences are a good choice. (made with simple
    shift registers (LFSRs)).
    They produce always the same sequence, so your tests can be verified
    anytime with the same stimuli.
    And with a simple seed value you can change the behavior in a
    controlled manner.

    Have a nice simulation
    Eilert
     
    backhus, Jul 14, 2009
    #3
  4. JSreeniv

    Andy Guest

    Purely personal preference, but I might make random_delay() be a
    function that returns the time value to wait: "wait for random_delay
    (...);". Might be more reusable elsewhere, and/or useable with a
    delayed assignment. Again, just one POV.

    Note also that Bromley's approach to indexing the array is more
    efficient in a testbench than shifting the data as suggested earlier
    by Shanmugavel.

    Testbench efficiency (simulation speed) is often very different from
    synthesized hardware efficiency. Accordingly, indexing the array in HW
    would be much less efficient than a shift register.

    Andy
     
    Andy, Jul 15, 2009
    #4
  5. JSreeniv

    JSreeniv Guest

    On Jul 14, 12:42 pm, Jonathan Bromley <>
    wrote:
    > On Tue, 14 Jul 2009 00:29:02 -0700 (PDT), backhus wrote:
    > >To model your jitter you can use ( 35 ns + tx_jitter).
    > >Where txjitter is a value between 0 and 30 ns that has to be
    > >calculated somehow.
    > >Pseudo random noise sequences are a good choice. (made with simple
    > >shift registers (LFSRs)).

    >
    > I disagree.  Managing the result of an LFSR to get useful
    > random numbers is messy and non-trivial.  Surely it's far
    > easier to use ieee.math_real.uniform() in a testbench?
    >
    > >They produce always the same sequence, so your tests can be verified
    > >anytime with the same stimuli.
    > >And with a simple seed value you can change the behavior in a
    > >controlled manner.

    >
    > That's true for uniform() also.
    >
    > ...
    > use ieee.math_real.all;
    > ...
    > ...
    >   constant START_SEED: positive := 42;  -- or whatever
    >   ...
    > begin
    >   ...
    >   process bitstream_generator;
    >     variable seed1, seed2: positive := START_SEED;
    >     procedure random_delay(min, max: time) is
    >       variable random_real: real;
    >     begin
    >       -- Delay for randomized time, average (min+max)/2
    >       uniform(seed1, seed2, random_real);
    >       wait for min + (max-min) * random_real;
    >     end;
    >   begin
    >     for i in stimulus_vector'range loop -- MSB downto LSB
    >       -- Put out one data bit on to the line
    >       serial_line <= stimulus_vector(i);
    >       random_delay(35 ns, 65 ns);
    >     end loop;
    >     ...
    >
    > This is only a sketch - there's much more you can do,
    > of course.
    >
    > Enjoy.
    > --
    > Jonathan Bromley, Consultant
    >
    > DOULOS - Developing Design Know-howVHDL* Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
    >
    > Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
    > ://www.MYCOMPANY.com
    >
    > The contents of this message may contain personal views which
    > are not the views of Doulos Ltd., unless specifically stated.


    Hi Bromley,

    Thanks for your response,
    could you please elaborate more about this issue
    where i have 29 data words of each 32-bit, and anytime i can sent any
    number of data's..so this is the complexity i am getting confuse. My
    data each time is only in Hexadecimal format and what i done is i
    wrote a package to convert hex to binary and then binary to Manchester
    encoding with including the wait time 50 ns for every bit of encoded
    data but its not working. I done using two procedures in a package and
    felt its not very efficient way..so could please give some suggestion
    on this..to how to proceed.

    thanks
     
    JSreeniv, Aug 19, 2009
    #5
    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. GGG
    Replies:
    10
    Views:
    12,730
    Donar
    Jul 6, 2006
  2. sarmin kho
    Replies:
    2
    Views:
    854
    A. Lloyd Flanagan
    Jun 15, 2004
  3. Miki Tebeka
    Replies:
    1
    Views:
    464
    Marcin 'Qrczak' Kowalczyk
    Jun 14, 2004
  4. sergey

    "casting" bits to bits?

    sergey, Nov 8, 2006, in forum: VHDL
    Replies:
    1
    Views:
    750
    sergey
    Nov 8, 2006
  5. Tomás

    Value Bits Vs Object Bits

    Tomás, Jun 2, 2006, in forum: C Programming
    Replies:
    13
    Views:
    564
    Hallvard B Furuseth
    Jul 1, 2006
Loading...

Share This Page