Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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:

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
48,272
Helped
14,226
Reputation
28,713
Reaction score
12,919
Trophy points
1,393
Location
Bochum, Germany
Activity points
279,546
Code:
signal reg : registers := (others => (others => '0'));
 
  • Like
Reactions: fahim1

    fahim1

    Points: 2
    Helpful Answer Positive Rating

sreevenkjan

Full Member level 5
Joined
Nov 4, 2013
Messages
268
Helped
27
Reputation
54
Reaction score
26
Trophy points
28
Location
Germany
Activity points
1,834
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)

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top