ALU / インクリメンタinc16

p.42
今度は何かを1増やす回路を作る。何か命令の実行中に次の命令をフェッチする手段として使うとの由。さまざまな実装が考えられるようだが、とりあえず下のように半加算器を連結する形にしておく。リプルは生じるが記述が容易だ。

inc16:

library ieee;
use ieee.std_logic_1164.all;

entity inc16 is
    port (
        inp: in std_logic_vector(15 downto 0);
        outp: out std_logic_vector(15 downto 0)
    );
end entity;

architecture behavior of inc16 is
    signal temp_carry: std_logic_vector(0 to 15);
begin
    digit_0: entity work.half_adder
    port map (
        a => inp(0),
        b => '1',
        sum => outp(0),
        carry => temp_carry(0)
    );
    
    digit_others: for i in 1 to 15 generate
        half_adder: entity work.half_adder
        port map (
            a => inp(i),
            b => temp_carry(i-1),
            sum => outp(i),
            carry => temp_carry(i)
        );
    end generate;
end architecture;

シミュレーション結果: