how to initialize a 1D*1D VECTOR?

Status
Not open for further replies.

fahim1

Member level 4
Joined
Jun 4, 2015
Messages
75
Helped
2
Reputation
4
Reaction score
2
Trophy points
8
Activity points
517
hi
how can i initialize a 1d 1d vector that the length and columns of vector are generic?
like this :

Code:
generic  (n :integer :=4;   --number of coefficients 
          m :integer :=4);   --number of bits represent coefficients
.
.
.
.
type registers is array (n-2 downto 0) of std_logic_vector(m-1 downto 0);
.
.
.
signal reg : registers;     ????(how to initialize all the values zero)
 
Last edited by a moderator:

Code:
signal reg : registers := (others => (others => '0'));
 
Reactions: fahim1

    fahim1

    Points: 2
    Helpful Answer Positive Rating

you can also have a 2D matrix in a similar way by checking on the link.

https://vhdlguru.blogspot.de/2010/02/arrays-and-records-in-vhdl.html
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…