Skip to content

Instantly share code, notes, and snippets.

@MasWag
Created December 15, 2014 08:28
Show Gist options
  • Save MasWag/a020f3db3620ecf25af4 to your computer and use it in GitHub Desktop.
Save MasWag/a020f3db3620ecf25af4 to your computer and use it in GitHub Desktop.
比較でnumeric_stdを使うと便利
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity cmp_test is
port (
Q0 : out std_logic;
Q1 : out std_logic);
end entity cmp_test;
architecture rtl of cmp_test is
constant A : std_logic_vector (31 downto 0) := x"f1010100";
constant B : std_logic_vector (31 downto 0) := x"01010100";
begin -- architecture rtl
with signed (A) < signed (B) select
Q0 <=
'1' when true,
'0' when others;
with unsigned (A) < unsigned (B) select
Q1 <=
'1' when true,
'0' when others;
end architecture rtl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment