R
Ramya Murali
Guest
Hi all, I have recently started using the package IEEE.numeric_std to
deal with unsigned numbers (as opposed to IEEE.std_logic_arith).
I would like to check if an unsigned number is a zero by logical OR
operation on each of its bits.
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity test is
port (a_in : unsigned (3 downto 0);
b_out : unsigned (0 downto 0));
end entity test;
architecture beh of test is
begin
b_out <= a_in(0) or a_in(1) or a_in(2) or a_in(3);
end architecture beh;
When I compile the above using Modelsim, I get an error "error
resolving infix expression 'or' as type numeric_std.unsigned".
However, c_out <= a_in or b_in where a_in, b_in and c_out are defined
as unsigned ( 3 downto 0) compiles correctly.
From what I understand, logical operations are defined for unsigned
type in the package numeric_std. If so, what is incorrect in the first
case?
deal with unsigned numbers (as opposed to IEEE.std_logic_arith).
I would like to check if an unsigned number is a zero by logical OR
operation on each of its bits.
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity test is
port (a_in : unsigned (3 downto 0);
b_out : unsigned (0 downto 0));
end entity test;
architecture beh of test is
begin
b_out <= a_in(0) or a_in(1) or a_in(2) or a_in(3);
end architecture beh;
When I compile the above using Modelsim, I get an error "error
resolving infix expression 'or' as type numeric_std.unsigned".
However, c_out <= a_in or b_in where a_in, b_in and c_out are defined
as unsigned ( 3 downto 0) compiles correctly.
From what I understand, logical operations are defined for unsigned
type in the package numeric_std. If so, what is incorrect in the first
case?