Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21335 Discussions

[VHDL] Problem with signal type "std_logic_vector(0 downto 0)"

Altera_Forum
Honored Contributor II
4,441 Views

Hello, 

I use IP module, where data bus width is set to '1'. 

In VHDL code it is declared as type "std_logic_vector(0 downto 0)", but for compiler this is not the same as "std_logic", type of signal assigned to this bus. 

I changed manually in the component's source code type "std_logic_vector" to "std_logic", but then Model-Sim started to cry, that somewhere in its library in the component's entity is type "std_logic_vector". 

Does anyone have an idea, how to fix it? Maybe there is a compiler option to ignore it? 

 

greetings
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
2,883 Views

No you need to change the signal type to std_logic everywhere. Maybe you forgot to do the change in one place?

0 Kudos
Altera_Forum
Honored Contributor II
2,883 Views

You can keep it as std_logic_vector and access your variable using parenthesis : data(0), no ?

0 Kudos
Altera_Forum
Honored Contributor II
2,883 Views

 

--- Quote Start ---  

You can keep it as std_logic_vector and access your variable using parenthesis : data(0), no ? 

--- Quote End ---  

 

 

It's working. I tried data(0 downto 0) and it failed, but data(0) is ok. 

Thanks!
0 Kudos
Altera_Forum
Honored Contributor II
2,883 Views

 

--- Quote Start ---  

It's working. I tried data(0 downto 0) and it failed, but data(0) is ok. 

Thanks! 

--- Quote End ---  

 

 

That is because data(0 downto 0) returns a std_logic_vector of length 1. data(0) returns a std_logic 

 

VHDL is strongly typed so it wont let you connect incorrect types without converting them properly.
0 Kudos
Reply