VHDL code error for assigning value to signal

Status
Not open for further replies.

kushal nandanwar

Full Member level 3
Joined
Jun 9, 2013
Messages
177
Helped
6
Reputation
12
Reaction score
6
Trophy points
18
Activity points
1,258
Code:
signal H0,H1,H2,H3 : std_logic_vector(7 downto 0) := (others => '0');


H0 <= 00000010;
H1 <= 00000001;
H2 <= 00000011;
H3 <= 00000100;

error

 

std_logic_vector needs double quotes:
Code:
H0 <= "00000010";
H1 <= "00000001";
H2 <= "00000011";
H3 <= "00000100";

Better invest in a VHDL book.
 
std_logic_vector needs double quotes:
Code:
H0 <= "00000010";
H1 <= "00000001";
H2 <= "00000011";
H3 <= "00000100";

Better invest in a VHDL book.

Can I write like this, if I want to assign array

H0 <= "00000010","00000010";
 

You cannot assign array like that. it will show an syntax error

For declaring an array of 15rows and 15 coloumns :

Code:
type sample is array (15 downto 0) of std_logic_vector(15 downto 0);
signal sample_1 : sample;

if clk = '1' and clk'event then
   i <= i + 1;
   sample(i) <= data_in;
end if;

i think if you are using 'i' as std_logic_vector you need to convert 'i' into an integer as follows.
Code:
  sample(conv_integer(i)) <= data_in;

I hope this gives you an explanation.
 

Can I write like this, if I want to assign array

H0 <= "00000010","00000010";

No you cannot, because H0 is a single 8 bit value, not an array.

- - - Updated - - -


I dont quite know what you are trying to acheive? your code assigns a single value in the array on each clock cycle, is this what you intended? This example isnt very good as it doesnt make clear whether you're trying to create a ram or just and array. And I dont understand why you give an example using data_in to assign the i signal?

It also uses the non-standard conv_integer function.
 

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