rtps-fpga/syn/test4.vhd
Greek b47d409f13 Make codebase Quartus synthesizable
Remove non-Quartus-supported VHDL 2008 features.
Remove inferred Latches.
Add test Entities to see resulting hw synthesis of various code
segments.
2021-12-07 13:05:24 +01:00

68 lines
2.0 KiB
VHDL

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.math_pkg.all;
use work.rtps_package.all;
-- Test synthesis of array indexing
entity test4 is
port (
clk : in std_logic;
reset : in std_logic;
input : in std_logic_vector(31 downto 0);
input2 : in std_logic_vector(31 downto 0);
output : out std_logic_vector(31 downto 0)
);
end entity;
architecture arch of test4 is
type TEST_ARRAY_TYPE is array (0 to 3) of std_logic_vector(31 downto 0);
signal test_array : TEST_ARRAY_TYPE;
begin
process (all)
begin
if rising_edge(clk) then
if (reset = '1') then
output <= (others => '0');
test_array <= (others => (others => '0'));
else
case (to_integer(unsigned(input))) is
when 0 =>
output <= test_array(0);
test_array(0) <= input2;
when 1 =>
output <= test_array(1);
test_array(1) <= input2;
when 2 =>
output <= test_array(2);
test_array(2) <= input2;
when 3 =>
output <= test_array(3);
test_array(3) <= input2;
when others =>
end case;
end if;
end if;
end process;
-- process (all)
-- begin
-- if rising_edge(clk) then
-- if (reset = '1') then
-- output <= (others => '0');
-- test_array <= (others => (others => '0'));
-- else
-- test_array(to_integer(unsigned(input))) <= input2;
-- output <= test_array(to_integer(unsigned(input)));
-- end if;
-- end if;
-- end process;
end architecture;