74175で作った回路をそのままVHDLで記述し直してみる。ただしインターフェイスはパラメタライズし、リセット回路も追加した。結局前回と同じことをしているのであって意味がなかった。
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity sute_vhdl is generic( NUM_PHASES: natural := 16 ); port( aclr_n: in std_logic; sclr_n: in std_logic; clk : in std_logic; n_phase_clk: out std_logic_vector(NUM_PHASES-1 downto 0) ); end entity; architecture rtl of sute_vhdl is procedure reset is begin n_phase_clk(NUM_PHASES-1 downto 1) <= (others => '0'); n_phase_clk(0) <= '1'; end procedure; begin process(all) begin -- 非同期リセット if aclr_n = '0' then reset; elsif rising_edge(clk) then -- 同期リセット if sclr_n = '0' then reset; else -- MSB以外が全部0なら、 if unsigned(n_phase_clk(NUM_PHASES-2 downto 0)) = 0 then -- 全体を左シフトしてLSBに1を入れるが、 n_phase_clk(NUM_PHASES-1 downto 0) <= n_phase_clk(NUM_PHASES-2 downto 0) & '1'; -- そうでなければ、 else -- 全体を左シフトしてLSBに0を入れる。 n_phase_clk(NUM_PHASES-1 downto 0) <= n_phase_clk(NUM_PHASES-2 downto 0) & '0'; end if; end if; end if; end process; end architecture;