0
VHDL에 회선 내용을위한 링 버퍼를 구현하여 일반화하고 싶습니다. 내 문제는 추가 신호 또는 변수를 도입하지 않고 내부 데이터를 초기화하는 방법입니다.VHDL std_logic_vector의 일반 배열을 초기화하십시오.
보통 나는
signal initialized_vector : std_logic_vector(15 downto 0) := (others => '0');
하여 std_logic_vector을 초기화하기 수 그러나 나는 어떻게 기본적으로 배열에 그렇게하는 단서가 없다. 당신은 std_logic_vector 경우와 거의 동일 할 수
entity convolution_ringbuffer is
generic (
BitDepth_signal : integer := 24;
BufferSize : integer := 10
);
port (
data_in : in std_logic_vector(BitDepth_signal-1 downto 0);
sclk : in std_logic;
enable : in std_logic;
data_out : out std_logic_vector(BitDepth_signal-1 downto 0)
);
end convolution_ringbuffer;
architecture behavioral of convolution_ringbuffer is
type internal_data is array(0 to BufferSize-1) of std_logic_vector(BitDepth_signal-1 downto 0);
signal data_internal : internal_data;
begin
process (sclk)
variable current_position : integer range 0 to (BufferSize-1) := 0;
begin
if (rising_edge(sclk) and enable = '1') then
data_internal(current_position) <= std_logic_vector(data_in);
if (current_position < BufferSize-1) then
current_position := current_position + 1;
else
current_position := 0;
end if;
end if;
if (falling_edge(sclk)) then
data_out <= std_logic_vector(data_internal(current_position));
end if;
end process;
end behavioral;
덕분에 많은 매력처럼 작동 – ThomasM