Skip to content

Instantly share code, notes, and snippets.

@tejainece
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save tejainece/61911189791910add3ee to your computer and use it in GitHub Desktop.

Select an option

Save tejainece/61911189791910add3ee to your computer and use it in GitHub Desktop.
VHDL comparison operators
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity comp is port (
a_i : in std_ulogic_vector(3 downto 0);
c_o : out std_ulogic
);
end entity comp;
architecture rtl of comp is
begin
c_o <= '0' when a_i < "0101" else '1';
end architecture;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity comp is port (
a_i : in std_ulogic_vector(3 downto 0);
c_o : out std_ulogic
);
end entity comp;
architecture rtl of comp is
begin
c_o <= '0' when a_i < std_ulogic_vector(to_unsigned(5, 4)) else '1';
end architecture;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity comp is port (
a_i : in std_ulogic_vector(3 downto 0);
c_o : out std_ulogic
);
end entity comp;
architecture rtl of comp is
begin
c_o <= '0' when a_i < 5 else '1';
end architecture;
library ieee;
use ieee.std_logic_1164.all;
entity comp_scal is port (
a_i : in std_ulogic;
c_o : out std_ulogic
);
end entity comp_scal;
architecture rtl of comp_scal is
begin
c_o <= '0' when a_i = '1' else '1';
end architecture;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment