aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue476/repro2
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/gna/issue476/repro2')
-rw-r--r--testsuite/gna/issue476/repro2/pixel_column_pkg.vhd34
-rw-r--r--testsuite/gna/issue476/repro2/pixel_matrix_pkg.vhd37
-rw-r--r--testsuite/gna/issue476/repro2/pixel_pkg.vhd28
-rw-r--r--testsuite/gna/issue476/repro2/test_op.vhd48
-rw-r--r--testsuite/gna/issue476/repro2/test_op1.vhd35
-rwxr-xr-xtestsuite/gna/issue476/repro2/testsuite.sh11
6 files changed, 193 insertions, 0 deletions
diff --git a/testsuite/gna/issue476/repro2/pixel_column_pkg.vhd b/testsuite/gna/issue476/repro2/pixel_column_pkg.vhd
new file mode 100644
index 000000000..6583b6239
--- /dev/null
+++ b/testsuite/gna/issue476/repro2/pixel_column_pkg.vhd
@@ -0,0 +1,34 @@
+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 bit_vector_to_pixel_column
+ (in_vector : in bit_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 bit_vector_to_pixel_column( in_vector : in bit_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) := bit_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 bit_vector_to_pixel_column;
+end package body pixel_column_pkg;
+
diff --git a/testsuite/gna/issue476/repro2/pixel_matrix_pkg.vhd b/testsuite/gna/issue476/repro2/pixel_matrix_pkg.vhd
new file mode 100644
index 000000000..69478a68f
--- /dev/null
+++ b/testsuite/gna/issue476/repro2/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/repro2/pixel_pkg.vhd b/testsuite/gna/issue476/repro2/pixel_pkg.vhd
new file mode 100644
index 000000000..a00f6f519
--- /dev/null
+++ b/testsuite/gna/issue476/repro2/pixel_pkg.vhd
@@ -0,0 +1,28 @@
+package pixel_pkg is
+ generic(
+ NBITS : natural;
+ NBR_OF_CHROMA : natural
+ );
+
+ subtype CHROMA is bit_vector(NBITS-1 downto 0);
+ type TYPE_PIXEL is array (NBR_OF_CHROMA-1 downto 0) of CHROMA;
+
+ function bit_vector_to_pixel
+ (in_vector : in bit_vector(NBR_OF_CHROMA*NBITS-1 downto 0))
+ return TYPE_PIXEL;
+end package pixel_pkg;
+
+package body pixel_pkg is
+
+ function bit_vector_to_pixel
+ ( in_vector : in bit_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) := in_vector((chroma+1)*NBITS-1 downto chroma*NBITS);
+ end loop;
+ return pixel;
+ end function bit_vector_to_pixel;
+end package body pixel_pkg;
+
diff --git a/testsuite/gna/issue476/repro2/test_op.vhd b/testsuite/gna/issue476/repro2/test_op.vhd
new file mode 100644
index 000000000..ae1def6b7
--- /dev/null
+++ b/testsuite/gna/issue476/repro2/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/repro2/test_op1.vhd b/testsuite/gna/issue476/repro2/test_op1.vhd
new file mode 100644
index 000000000..def987f76
--- /dev/null
+++ b/testsuite/gna/issue476/repro2/test_op1.vhd
@@ -0,0 +1,35 @@
+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 bit;
+ signal in_data : in bit_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 inst_pixel_pkg is new work.pixel_pkg
+ generic map (
+ NBITS => NBITS,
+ NBR_OF_CHROMA => NBR_OF_CHROMA
+ );
+
+ package inst_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 => inst_pixel_pkg
+ );
+
+ use inst_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 <= bit_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/repro2/testsuite.sh b/testsuite/gna/issue476/repro2/testsuite.sh
new file mode 100755
index 000000000..cb988307e
--- /dev/null
+++ b/testsuite/gna/issue476/repro2/testsuite.sh
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+. ../../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+analyze pixel_pkg.vhd pixel_column_pkg.vhd test_op1.vhd
+elab_simulate test_op1
+
+clean
+
+echo "Test successful"