Dingo (26.12.2017 11:55, просмотров: 382) ответил POV_ на Ну вот как-то так...
Так надо-то? Смотрю, уже ответили, но generate тут и правда совсем не обязателен(и даже лишний). Только у меня параллельный на выход.
library ieee;
use ieee.std_logic_1164.all;
entity pov is
generic (
g_THDEPTH : natural := 16
);
port (
i_rst :in std_logic;
i_clk :in std_logic;
i_SI : in std_logic;
o_SO : out std_logic;
o_POH : out std_logic_vector(g_THDEPTH/2-1 downto 0);
o_POL : out std_logic_vector(g_THDEPTH/2-1 downto 0)
);
end entity;
architecture RTL of pov is
signal sreg : std_logic_vector(g_THDEPTH-1 downto 0);
begin
process( i_rst, i_clk)
begin
if( i_rst='1') then
sreg <= (others => '0');
elsif ( rising_edge(i_clk) ) then
sreg( g_THDEPTH-1 downto 1) <= sreg( g_THDEPTH-2 downto 0);
sreg(0) <= i_SI;
end if;
o_SO <= sreg(g_THDEPTH-1);
o_POH <= sreg(g_THDEPTH-1 downto g_THDEPTH/2);
o_POL <= sreg(g_THDEPTH/2-1 downto 0);
end process;
end RTL;