Last active
August 29, 2015 14:01
-
-
Save tejainece/61911189791910add3ee to your computer and use it in GitHub Desktop.
VHDL comparison operators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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