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.

array 2d in vhdl data transfer

Status
Not open for further replies.

p11

Banned
Joined
Jan 25, 2014
Messages
177
Helped
0
Reputation
0
Reaction score
0
Trophy points
16
Activity points
0
Code:
architecture Behavioral of rom is  


type memory is array (0 to 7) of STD_LOGIC_VECTOR (3 DOWNTO 0);
constant dat : memory := (x"3", x"2",x"4", x"0",x"6",x"0",x"5",x"0");



now if i want to assign the 1st value of the array then how to do it ??? i mean if i write


dout (3 downto 0)<=dat (0) ( 3 downto 0);


is it ok ???
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
48,405
Helped
14,251
Reputation
28,763
Reaction score
12,939
Trophy points
1,393
Location
Bochum, Germany
Activity points
280,118
It's O.K. if dout type is std_logic_vector and 3 downto 0 a valid subrange. If dout is defined as std_logic_vector (3 downto 0), you can simply write
Code:
dout <= dat(0);
 
  • Like
Reactions: p11

    p11

    Points: 2
    Helpful Answer Positive Rating

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,300
Code:
dout (3 downto 0)<=dat (0) [COLOR="#FF0000"](3 downto 0)[/COLOR] ;
It's fine.
But you can do without the part marked in red - this is because the array element is already defined as ( 3 downto 0 ) .
As long as the target of the assignment is of the same width as the source - there's no need to explicitly define the boundaries at the time of assignment.
 
  • Like
Reactions: p11

    p11

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top