p.131
a (0b000~0b111)とb (0b000~0b111)との和(0b0000~0b1110)を求める。
さらにa > bのときにcompフラグを立てる。
まだところどころわからない。
-- これがパッケージリスト library ieee; use ieee.std_logic_1164.all; -- ieeeがライブラリー名。std_logic_1164がパッケージ名。 use ieee.numeric_std.all; -- これがエンティティ宣言 entity add_compare_cell is port( a, b: in std_logic_vector(2 downto 0); comp: out std_logic; sum : out std_logic_vector(3 downto 0) ); end entity; -- これがアーキテクチャーボディ architecture detaflow of add_compare_cell is signal a_uns, b_uns: unsigned(3 downto 0); begin a_uns <= unsigned('0' & a); b_uns <= unsigned('0' & b); comp <= '1' when a_uns > b_uns else '0'; sum <= std_logic_vector(a_uns + b_uns); end architecture;