XST: Problem with simple logical operators

Status
Not open for further replies.

grubby23

Junior Member level 3
Joined
Nov 22, 2007
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,606
0 down vote favorite


Hi,

I have a very simple operator problem in VHDL. I try to compare some inputs with logical operators but get an error message...


Anyway sees the problem?

Cheers
 

Hello,

It's better to do the comparison as follows:

Code:
signal wrfifo_full : std_logic;
signal wrfifo_write_allowed : std_logic;  

...

wrfifo_write_allowed <= psel AND penable AND pwrite AND NOT(wrfifo_full); 

...

process (paddr, wrfifo_write_allowed) is
begin
if (((paddr(8 downto 2) = "1000000")) and (wrfifo_write_allowed = '1') ) then
dt_fifo_wr_i <= '1';
else
dt_fifo_wr_i <= '0';
end if;

end process;
 

THat makes so much more sense, thank you very much for your help!
 

To explain the problem properly:

an "if-then-else" tree requires all comparisons to result in a boolen. For you, you tried to "and" together a boolean : (paddr(8 downto 2) = "1000000") with std_logics (psel, pwrite etc). Unless you write a custom "and" function to do this (that also outputs a boolean), it cannot check the if statement. This is why the error was "operator type missmatch".
 

Thats true but only prior to VHDL2k8. In VHDL2k8 you can write explicitly with "??" operator in the if expression.
 

True. But you'll be hard pressed to find software that supports it currently
 

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