# array 2d in vhdl data transfer

Status
Not open for further replies.

#### p11

##### Banned
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
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);

p11

### p11

Points: 2

#### shaiko

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.

p11

Points: 2