aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-04-27 09:47:49 +0200
committerTristan Gingold <tgingold@free.fr>2022-04-27 09:47:49 +0200
commitd3883c99871f56fbcc29580f8ca02ce6d5167989 (patch)
tree816e3be789c15fba44907636edbd6f998e74328f
parent630b01519388cbda2929ccb1928f20806dc8ee17 (diff)
downloadghdl-d3883c99871f56fbcc29580f8ca02ce6d5167989.tar.gz
ghdl-d3883c99871f56fbcc29580f8ca02ce6d5167989.tar.bz2
ghdl-d3883c99871f56fbcc29580f8ca02ce6d5167989.zip
testsuite/synth: add a test for #2042
-rw-r--r--testsuite/synth/issue2042/ent.vhdl34
-rw-r--r--testsuite/synth/issue2042/ent1.vhdl34
-rw-r--r--testsuite/synth/issue2042/ent3.vhdl32
-rwxr-xr-xtestsuite/synth/issue2042/testsuite.sh8
4 files changed, 108 insertions, 0 deletions
diff --git a/testsuite/synth/issue2042/ent.vhdl b/testsuite/synth/issue2042/ent.vhdl
new file mode 100644
index 000000000..5e8727a60
--- /dev/null
+++ b/testsuite/synth/issue2042/ent.vhdl
@@ -0,0 +1,34 @@
+library IEEE;
+use IEEE.std_logic_1164.ALL;
+use IEEE.numeric_std.all;
+
+entity ent is
+ generic (
+ g_NumberOfChannels : natural := 4;
+ g_BitsPerChannel : natural := 16
+ );
+ port (
+ CLK : in std_logic;
+ RST : in std_logic;
+ DATA : out std_logic_vector(g_NumberOfChannels*g_BitsPerChannel-1 downto 0)
+ );
+end entity;
+
+architecture arch of ent is
+
+ signal do_out : STD_LOGIC_VECTOR(15 DOWNTO 0);
+
+begin
+
+ process(RST, CLK)
+ variable cnt: natural range 0 to g_NumberOfChannels-1;
+ begin
+ if RST then
+ cnt := 0;
+ elsif rising_edge(CLK) then
+ DATA((cnt+1)*g_BitsPerChannel-1 downto cnt*g_BitsPerChannel) <= do_out(do_out'left downto 1+do_out'left-g_BitsPerChannel);
+ cnt := cnt + 1 when cnt<g_NumberOfChannels-1 else 0;
+ end if;
+ end process;
+
+end architecture;
diff --git a/testsuite/synth/issue2042/ent1.vhdl b/testsuite/synth/issue2042/ent1.vhdl
new file mode 100644
index 000000000..0225e9023
--- /dev/null
+++ b/testsuite/synth/issue2042/ent1.vhdl
@@ -0,0 +1,34 @@
+library IEEE;
+use IEEE.std_logic_1164.ALL;
+use IEEE.numeric_std.all;
+
+entity ent is
+ generic (
+ g_NumberOfChannels : natural := 4;
+ g_BitsPerChannel : natural := 16
+ );
+ port (
+ CLK : in std_logic;
+ RST : in std_logic;
+ DATA : out std_logic_vector(g_NumberOfChannels*g_BitsPerChannel-1 downto 0)
+ );
+end entity;
+
+architecture arch of ent is
+
+ signal do_out : STD_LOGIC_VECTOR(15 DOWNTO 0);
+
+begin
+
+ process(RST, CLK)
+ variable cnt: natural range 0 to g_NumberOfChannels-1;
+ begin
+ if RST then
+ cnt := 0;
+ elsif rising_edge(CLK) then
+ DATA((cnt+1)*g_BitsPerChannel-1 downto cnt*g_BitsPerChannel) <= do_out(do_out'left downto do_out'left-g_BitsPerChannel+1);
+ -- cnt := cnt + 1 when cnt<g_NumberOfChannels-1 else 0;
+ end if;
+ end process;
+
+end architecture;
diff --git a/testsuite/synth/issue2042/ent3.vhdl b/testsuite/synth/issue2042/ent3.vhdl
new file mode 100644
index 000000000..e54e4f41b
--- /dev/null
+++ b/testsuite/synth/issue2042/ent3.vhdl
@@ -0,0 +1,32 @@
+library IEEE;
+use IEEE.std_logic_1164.ALL;
+use IEEE.numeric_std.all;
+
+entity ent is
+ generic (
+ g_NumberOfChannels : natural := 4;
+ g_BitsPerChannel : natural := 16
+ );
+ port (
+ CLK : in std_logic;
+ RST : in std_logic
+ );
+end entity;
+
+architecture arch of ent is
+
+ signal do_out : STD_LOGIC_VECTOR(15 DOWNTO 0);
+
+begin
+
+ process(RST, CLK)
+ variable cnt: natural range 0 to g_NumberOfChannels-1;
+ begin
+ if RST then
+ cnt := 0;
+ elsif rising_edge(CLK) then
+ cnt := cnt + 1 when cnt<g_NumberOfChannels-1 else 0;
+ end if;
+ end process;
+
+end architecture;
diff --git a/testsuite/synth/issue2042/testsuite.sh b/testsuite/synth/issue2042/testsuite.sh
new file mode 100755
index 000000000..c06b922b8
--- /dev/null
+++ b/testsuite/synth/issue2042/testsuite.sh
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+GHDL_STD_FLAGS=--std=08
+synth_only ent3
+
+echo "Test successful"