aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue1190/hdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-04-13 17:03:34 +0200
committerTristan Gingold <tgingold@free.fr>2020-04-13 17:03:34 +0200
commit547d31b8d955325cbad13e47211d4e4049bf03d0 (patch)
treeb7a2ae61f48021dc024fa41338fd35c0b50eb715 /testsuite/synth/issue1190/hdl
parent0aac4efd094b6b7ec0254f2bc4c2b994ed35c417 (diff)
downloadghdl-547d31b8d955325cbad13e47211d4e4049bf03d0.tar.gz
ghdl-547d31b8d955325cbad13e47211d4e4049bf03d0.tar.bz2
ghdl-547d31b8d955325cbad13e47211d4e4049bf03d0.zip
testsuite/synth: add test for #1190
Diffstat (limited to 'testsuite/synth/issue1190/hdl')
-rw-r--r--testsuite/synth/issue1190/hdl/data/memory.dat64
-rw-r--r--testsuite/synth/issue1190/hdl/ram.vhdl45
2 files changed, 109 insertions, 0 deletions
diff --git a/testsuite/synth/issue1190/hdl/data/memory.dat b/testsuite/synth/issue1190/hdl/data/memory.dat
new file mode 100644
index 000000000..cf730bcf4
--- /dev/null
+++ b/testsuite/synth/issue1190/hdl/data/memory.dat
@@ -0,0 +1,64 @@
+10000000000000000000000000000000
+01000000000000000000000000000000
+00100000000000000000000000000000
+00010000000000000000000000000000
+00001000000000000000000000000000
+00000100000000000000000000000000
+00000010000000000000000000000000
+00000001000000000000000000000000
+00000000100000000000000000000000
+00000000010000000000000000000000
+00000000001000000000000000000000
+00000000000100000000000000000000
+00000000000010000000000000000000
+00000000000001000000000000000000
+00000000000000100000000000000000
+00000000000000010000000000000000
+00000000000000001000000000000000
+00000000000000000100000000000000
+00000000000000000010000000000000
+00000000000000000001000000000000
+00000000000000000000100000000000
+00000000000000000000010000000000
+00000000000000000000001000000000
+00000000000000000000000100000000
+00000000000000000000000010000000
+00000000000000000000000001000000
+00000000000000000000000000100000
+00000000000000000000000000010000
+00000000000000000000000000001000
+00000000000000000000000000000100
+00000000000000000000000000000010
+00000000000000000000000000000001
+00000000000000000000000000000010
+00000000000000000000000000000100
+00000000000000000000000000001000
+00000000000000000000000000010000
+00000000000000000000000000100000
+00000000000000000000000001000000
+00000000000000000000000010000000
+00000000000000000000000100000000
+00000000000000000000001000000000
+00000000000000000000010000000000
+00000000000000000000100000000000
+00000000000000000001000000000000
+00000000000000000010000000000000
+00000000000000000100000000000000
+00000000000000001000000000000000
+00000000000000010000000000000000
+00000000000000100000000000000000
+00000000000001000000000000000000
+00000000000010000000000000000000
+00000000000100000000000000000000
+00000000001000000000000000000000
+00000000010000000000000000000000
+00000000100000000000000000000000
+00000001000000000000000000000000
+00000010000000000000000000000000
+00000100000000000000000000000000
+00001000000000000000000000000000
+00010000000000000000000000000000
+00100000000000000000000000000000
+01000000000000000000000000000000
+10000000000000000000000000000000
+00000000000000000000000000000000
diff --git a/testsuite/synth/issue1190/hdl/ram.vhdl b/testsuite/synth/issue1190/hdl/ram.vhdl
new file mode 100644
index 000000000..8ec8e0807
--- /dev/null
+++ b/testsuite/synth/issue1190/hdl/ram.vhdl
@@ -0,0 +1,45 @@
+-- A RAM initialized with an external file
+
+library IEEE;
+use IEEE.std_logic_1164.all;
+use IEEE.numeric_std.all;
+use STD.textio.all;
+
+entity ram is
+ port(
+ clk_i : in std_logic;
+ we_i : in std_logic;
+ addr_i : in std_logic_vector(5 downto 0);
+ data_i : in std_logic_vector(31 downto 0);
+ data_o : out std_logic_vector(31 downto 0)
+ );
+end ram;
+
+architecture RTL of ram is
+ type mem_t is array (0 to 63) of bit_vector(31 downto 0);
+
+ impure function init(filename : in string) return mem_t is
+ file fh : text is in filename;
+ variable l : line;
+ variable mem : mem_t;
+ begin
+ for i in mem_t'range loop
+ readline(fh, l);
+ read(l, mem(i));
+ end loop;
+ return mem;
+ end function;
+
+ signal ram : mem_t := init("data/memory.dat");
+begin
+ memory:
+ process(clk_i)
+ begin
+ if rising_edge(clk_i) then
+ if we_i = '1' then
+ ram(to_integer(unsigned(addr_i))) <= to_bitvector(data_i);
+ end if;
+ data_o <= to_stdlogicvector(ram(to_integer(unsigned(addr_i))));
+ end if;
+ end process;
+end architecture RTL;