+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Newbie level 3
    Points: 352, Level: 4

    Join Date
    Nov 2015
    Posts
    3
    Helped
    0 / 0
    Points
    352
    Level
    4

    Accessing range of array elements VHDL

    Hey Guys,

    I have a serializer which I am using as an transmitter, the data set i will transmit I define it in the beginning. Then by using every clock cycle i am reading it from the array and sending it to serializer. Is there a better way to read the array or is there any disadvantages of using it in this way ?

    Code VHDL - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    
    type data_array is array (0 to 479999) of integer range 0 to 1;
    constant data :data_array:=(1,0,0,1,1,0,1,0,1,0,0,1,0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,0,1,0,0,1,0,0);
     
    tx_parallel_data(0)<=to_unsigned(data(0+counter),1)(0);
        tx_parallel_data(1)<=to_unsigned(data(1+counter),1)(0);
        tx_parallel_data(2)<=to_unsigned(data(2+counter),1)(0);
        tx_parallel_data(3)<=to_unsigned(data(3+counter),1)(0);
        tx_parallel_data(4)<=to_unsigned(data(4+counter),1)(0);
        tx_parallel_data(5)<=to_unsigned(data(5+counter),1)(0);
        tx_parallel_data(6)<=to_unsigned(data(6+counter),1)(0);
        tx_parallel_data(7)<=to_unsigned(data(7+counter),1)(0);
        tx_parallel_data(8)<=to_unsigned(data(8+counter),1)(0);
        tx_parallel_data(9)<=to_unsigned(data(9+counter),1)(0);
        tx_parallel_data(10)<=to_unsigned(data(10+counter),1)(0);
        tx_parallel_data(11)<=to_unsigned(data(11+counter),1)(0);
        tx_parallel_data(12)<=to_unsigned(data(12+counter),1)(0);
        tx_parallel_data(13)<=to_unsigned(data(13+counter),1)(0);
        tx_parallel_data(14)<=to_unsigned(data(14+counter),1)(0);
        tx_parallel_data(15)<=to_unsigned(data(15+counter),1)(0);
        tx_parallel_data(16)<=to_unsigned(data(16+counter),1)(0);
        tx_parallel_data(17)<=to_unsigned(data(17+counter),1)(0);
        tx_parallel_data(18)<=to_unsigned(data(18+counter),1)(0);
        tx_parallel_data(19)<=to_unsigned(data(19+counter),1)(0);
        tx_parallel_data(20)<=to_unsigned(data(20+counter),1)(0);
        tx_parallel_data(21)<=to_unsigned(data(21+counter),1)(0);
        tx_parallel_data(22)<=to_unsigned(data(22+counter),1)(0);
        tx_parallel_data(23)<=to_unsigned(data(23+counter),1)(0);
        tx_parallel_data(24)<=to_unsigned(data(24+counter),1)(0);
        tx_parallel_data(25)<=to_unsigned(data(25+counter),1)(0);
        tx_parallel_data(26)<=to_unsigned(data(26+counter),1)(0);
        tx_parallel_data(27)<=to_unsigned(data(27+counter),1)(0);
        tx_parallel_data(28)<=to_unsigned(data(28+counter),1)(0);
        tx_parallel_data(29)<=to_unsigned(data(29+counter),1)(0);
        tx_parallel_data(30)<=to_unsigned(data(30+counter),1)(0);
        tx_parallel_data(31)<=to_unsigned(data(31+counter),1)(0);
     
    counter:=counter+32;
        if counter> limitforData then
            counter:=0;
        end if;

    Thank you!
    Last edited by ads-ee; 11th September 2017 at 17:44. Reason: added syntax tags

    •   Alt11th September 2017, 11:53

      advertising

        
       

  2. #2
    Advanced Member level 5
    Points: 34,868, Level: 45
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,389
    Helped
    1861 / 1861
    Points
    34,868
    Level
    45

    Re: Accessing range of array elements VHDL

    Wow - this appears to be one of the more overcomplicated solutions to something I think Ive seen in 15 years.
    From reading your (syntactically incorrect example), you're trying to use a ROM to store a set of values you want to send out over some serial interface? why store so many idividual bits as integers (constrained to the size of 1 bit?)
    Why not just store the array as a set of 32 bit values, then load them from the rom and then shift the output?
    Could you please elaborate on these questions:
    there is no serialiser in your code - is that some other block? is tx_parallel_data the input to the serialiser?
    Can you post the actual code? have you got a testbench?


    1 members found this post helpful.

    •   Alt11th September 2017, 13:11

      advertising

        
       

  3. #3
    Newbie level 3
    Points: 352, Level: 4

    Join Date
    Nov 2015
    Posts
    3
    Helped
    0 / 0
    Points
    352
    Level
    4

    Re: Accessing range of array elements VHDL

    Quote Originally Posted by TrickyDicky View Post
    Wow - this appears to be one of the more overcomplicated solutions to something I think Ive seen in 15 years.
    From reading your (syntactically incorrect example), you're trying to use a ROM to store a set of values you want to send out over some serial interface? why store so many idividual bits as integers (constrained to the size of 1 bit?)
    Why not just store the array as a set of 32 bit values, then load them from the rom and then shift the output?
    Could you please elaborate on these questions:
    there is no serialiser in your code - is that some other block? is tx_parallel_data the input to the serialiser?
    Can you post the actual code? have you got a testbench?
    Actually, you have helped me with you suggestion of 32 bit values. It has solved my problem!



--[[ ]]--