diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-12-12 05:25:17 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-12-12 05:25:17 +0100 |
commit | 874fd35e9c185f7892dd5553bfa71e32a57d143f (patch) | |
tree | 62e4d65ea1d89a968fda10283811a54284d8eb46 /testsuite/gna/issue476/repro | |
parent | 650e68b382f5a3c9404b74c7f39a4b769a46350a (diff) | |
download | ghdl-874fd35e9c185f7892dd5553bfa71e32a57d143f.tar.gz ghdl-874fd35e9c185f7892dd5553bfa71e32a57d143f.tar.bz2 ghdl-874fd35e9c185f7892dd5553bfa71e32a57d143f.zip |
Add reproducer for #476
Diffstat (limited to 'testsuite/gna/issue476/repro')
-rw-r--r-- | testsuite/gna/issue476/repro/pixel_column_pkg.vhd | 38 | ||||
-rw-r--r-- | testsuite/gna/issue476/repro/pixel_matrix_pkg.vhd | 37 | ||||
-rw-r--r-- | testsuite/gna/issue476/repro/pixel_pkg.vhd | 32 | ||||
-rw-r--r-- | testsuite/gna/issue476/repro/test_op.vhd | 48 | ||||
-rw-r--r-- | testsuite/gna/issue476/repro/test_op1.vhd | 39 | ||||
-rwxr-xr-x | testsuite/gna/issue476/repro/testsuite.sh | 11 |
6 files changed, 205 insertions, 0 deletions
diff --git a/testsuite/gna/issue476/repro/pixel_column_pkg.vhd b/testsuite/gna/issue476/repro/pixel_column_pkg.vhd new file mode 100644 index 000000000..c9a1d712a --- /dev/null +++ b/testsuite/gna/issue476/repro/pixel_column_pkg.vhd @@ -0,0 +1,38 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +use work.pixel_pkg; + +package pixel_column_pkg is + generic( + NBITS : natural; + NBR_OF_CHROMA : natural; + NBR_OF_ROW : natural; + package local_pixel_pkg is new pixel_pkg + generic map (<>) + ); + + use local_pixel_pkg.all; + + type TYPE_PIXEL_COLUMN is array (NBR_OF_ROW-1 downto 0) of TYPE_PIXEL; + + function std_logic_vector_to_pixel_column + (in_vector : in std_logic_vector(NBR_OF_ROW*NBR_OF_CHROMA*NBITS-1 downto 0)) + return TYPE_PIXEL_COLUMN; + +end package pixel_column_pkg; + +package body pixel_column_pkg is + + function std_logic_vector_to_pixel_column( in_vector : in std_logic_vector(NBR_OF_ROW*NBR_OF_CHROMA*NBITS-1 downto 0)) + return TYPE_PIXEL_COLUMN is + variable pixel_column : TYPE_PIXEL_COLUMN; + begin + for row in 0 to NBR_OF_ROW - 1 loop + pixel_column(row) := std_logic_vector_to_pixel(in_vector((row+1)*NBR_OF_CHROMA*NBITS-1 downto row*NBR_OF_CHROMA*NBITS)); + end loop; + return pixel_column; + end function std_logic_vector_to_pixel_column; +end package body pixel_column_pkg; + diff --git a/testsuite/gna/issue476/repro/pixel_matrix_pkg.vhd b/testsuite/gna/issue476/repro/pixel_matrix_pkg.vhd new file mode 100644 index 000000000..69478a68f --- /dev/null +++ b/testsuite/gna/issue476/repro/pixel_matrix_pkg.vhd @@ -0,0 +1,37 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +use work.pixel_column_pkg; + +package pixel_matrix_pkg is + generic( + NBITS : natural; + NBR_OF_CHROMA : natural; + NBR_OF_ROW : natural; + NBR_OF_COL : natural; + package local_pixel_column_pkg is new pixel_column_pkg generic map (<>) + ); + use local_pixel_column_pkg.all; + + type TYPE_PIXEL_MATRIX is array (NBR_OF_COL-1 downto 0) of TYPE_PIXEL_COLUMN; + -- Note: this pkgs is used to propagate the functions that where defined for a (N x 1) array of pixel + -- to a (N x M) array of pixel + + function std_logic_vector_to_pixel_matrix( in_vector : in std_logic_vector(NBR_OF_COL*NBR_OF_ROW*NBR_OF_CHROMA*NBITS-1 downto 0)) + return TYPE_PIXEL_MATRIX; +end package pixel_matrix_pkg; + +package body pixel_matrix_pkg is + + function std_logic_vector_to_pixel_matrix( in_vector : in std_logic_vector(NBR_OF_COL*NBR_OF_ROW*NBR_OF_CHROMA*NBITS-1 downto 0)) + return TYPE_PIXEL_MATRIX is + variable pixel_matrix : TYPE_PIXEL_MATRIX; + begin + for col in 0 to NBR_OF_COL-1 loop + pixel_matrix(col) := std_logic_vector_to_pixel_column(in_vector((col+1)*NBR_OF_ROW*NBR_OF_CHROMA*NBITS-1 downto col*NBR_OF_ROW*NBR_OF_CHROMA*NBITS)); + end loop; + return pixel_matrix; + end function std_logic_vector_to_pixel_matrix; +end package body pixel_matrix_pkg; + diff --git a/testsuite/gna/issue476/repro/pixel_pkg.vhd b/testsuite/gna/issue476/repro/pixel_pkg.vhd new file mode 100644 index 000000000..b6e988ad2 --- /dev/null +++ b/testsuite/gna/issue476/repro/pixel_pkg.vhd @@ -0,0 +1,32 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +package pixel_pkg is + generic( + NBITS : natural; + NBR_OF_CHROMA : natural + ); + + subtype CHROMA is unsigned(NBITS-1 downto 0); + type TYPE_PIXEL is array (NBR_OF_CHROMA-1 downto 0) of CHROMA; + + function std_logic_vector_to_pixel + (in_vector : in std_logic_vector(NBR_OF_CHROMA*NBITS-1 downto 0)) + return TYPE_PIXEL; +end package pixel_pkg; + +package body pixel_pkg is + + function std_logic_vector_to_pixel + ( in_vector : in std_logic_vector(NBR_OF_CHROMA*NBITS-1 downto 0)) + return TYPE_PIXEL is + variable pixel : TYPE_PIXEL; + begin + for chroma in 0 to NBR_OF_CHROMA -1 loop + pixel(chroma) := unsigned(in_vector((chroma+1)*NBITS-1 downto chroma*NBITS)); + end loop; + return pixel; + end function std_logic_vector_to_pixel; +end package body pixel_pkg; + diff --git a/testsuite/gna/issue476/repro/test_op.vhd b/testsuite/gna/issue476/repro/test_op.vhd new file mode 100644 index 000000000..ae1def6b7 --- /dev/null +++ b/testsuite/gna/issue476/repro/test_op.vhd @@ -0,0 +1,48 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity test_op is + generic ( + NBITS : natural := 1; + NBR_OF_CHROMA : natural := 1; + NBR_OF_ROW : natural := 1; + NBR_OF_COL : natural := 1; + NBR_OF_MATRIX : natural := 1); + port ( + signal clock, rst : in std_logic; + signal in_data : in std_logic_vector(NBR_OF_MATRIX*NBR_OF_COL*NBR_OF_ROW*NBR_OF_CHROMA*NBITS-1 downto 0)); +end entity test_op; + +architecture rtl of test_op is + + package local_pixel_pkg is new work.pixel_pkg + generic map ( + NBITS => NBITS, + NBR_OF_CHROMA => NBR_OF_CHROMA + ); + + package local_pixel_column_pkg is new work.pixel_column_pkg + generic map ( + NBITS => NBITS, + NBR_OF_CHROMA => NBR_OF_CHROMA, + NBR_OF_ROW => NBR_OF_ROW, + local_pixel_pkg => local_pixel_pkg + ); + + package local_pixel_matrix_pkg is new work.pixel_matrix_pkg + generic map ( + NBITS => NBITS, + NBR_OF_CHROMA => NBR_OF_CHROMA, + NBR_OF_ROW => NBR_OF_ROW, + NBR_OF_COL => NBR_OF_COL, + local_pixel_column_pkg => local_pixel_column_pkg + ); + + use local_pixel_matrix_pkg.all; + signal input_pixel_matrix : TYPE_PIXEL_MATRIX; +begin + + -- As soon as a function from the local_pixel_matrix_pkg is used it breaks + input_pixel_matrix <= std_logic_vector_to_pixel_matrix(in_data(NBR_OF_COL*NBR_OF_ROW*NBR_OF_CHROMA*NBITS-1 downto 0)); +end architecture rtl; diff --git a/testsuite/gna/issue476/repro/test_op1.vhd b/testsuite/gna/issue476/repro/test_op1.vhd new file mode 100644 index 000000000..b5416f704 --- /dev/null +++ b/testsuite/gna/issue476/repro/test_op1.vhd @@ -0,0 +1,39 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity test_op1 is + generic ( + NBITS : natural := 1; + NBR_OF_CHROMA : natural := 1; + NBR_OF_ROW : natural := 1; + NBR_OF_COL : natural := 1; + NBR_OF_MATRIX : natural := 1); + port ( + signal clock, rst : in std_logic; + signal in_data : in std_logic_vector(NBR_OF_MATRIX*NBR_OF_COL*NBR_OF_ROW*NBR_OF_CHROMA*NBITS-1 downto 0)); +end entity test_op1; + +architecture rtl of test_op1 is + + package local_pixel_pkg is new work.pixel_pkg + generic map ( + NBITS => NBITS, + NBR_OF_CHROMA => NBR_OF_CHROMA + ); + + package local_pixel_column_pkg is new work.pixel_column_pkg + generic map ( + NBITS => NBITS, + NBR_OF_CHROMA => NBR_OF_CHROMA, + NBR_OF_ROW => NBR_OF_ROW, + local_pixel_pkg => local_pixel_pkg + ); + + use local_pixel_column_pkg.all; + signal input_pixel_column : TYPE_PIXEL_COLUMN; +begin + + -- As soon as a function from the local_pixel_matrix_pkg is used it breaks + input_pixel_column <= std_logic_vector_to_pixel_column(in_data(NBR_OF_ROW*NBR_OF_CHROMA*NBITS-1 downto 0)); +end architecture rtl; diff --git a/testsuite/gna/issue476/repro/testsuite.sh b/testsuite/gna/issue476/repro/testsuite.sh new file mode 100755 index 000000000..69c5cbd16 --- /dev/null +++ b/testsuite/gna/issue476/repro/testsuite.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +. ../../../testenv.sh + +export GHDL_STD_FLAGS=--std=08 +analyze pixel_pkg.vhd pixel_column_pkg.vhd pixel_matrix_pkg.vhd test_op1.vhd +elab_simulate test_op1 + +clean + +echo "Test successful" |