diff options
Diffstat (limited to 'testsuite/gna')
-rw-r--r-- | testsuite/gna/issue713/dma_controller_tb.vhd | 45 | ||||
-rw-r--r-- | testsuite/gna/issue713/e.vhdl | 22 | ||||
-rw-r--r-- | testsuite/gna/issue713/repro2.vhdl | 49 | ||||
-rw-r--r-- | testsuite/gna/issue713/sim_types_pkg.vhd | 18 | ||||
-rwxr-xr-x | testsuite/gna/issue713/testsuite.sh | 19 |
5 files changed, 153 insertions, 0 deletions
diff --git a/testsuite/gna/issue713/dma_controller_tb.vhd b/testsuite/gna/issue713/dma_controller_tb.vhd new file mode 100644 index 000000000..d67c94061 --- /dev/null +++ b/testsuite/gna/issue713/dma_controller_tb.vhd @@ -0,0 +1,45 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +use work.sim_types_pkg.all; + +entity dma_controller_tb is +generic ( + runner_cfg : string := "" +); +end entity; + +architecture bench of dma_controller_tb is + + constant num_desc : positive := 4; + subtype num_desc_range is natural range 0 to num_desc-1; + + constant MEM_BYTES : positive := 512; + constant MEM_DWORDS : positive := MEM_BYTES/4; + + + function byte_range (desc : descriptor_t) return bit_vector is + -- Works if 0 to 1 + -- variable v : bit_vector(0 to 1); + variable v : bit_vector(desc.address to desc.address + desc.length); + begin + return v; + end function; + +begin + + mm2s_buffer_destroy: process + variable desc : descriptor_t := (8, 8); + begin + wait for 50 ns; + for i in byte_range(desc)'range loop + call_report(i); + assert i >= 8 and i <= 16 severity failure; + -- Works for below + --for i in 0 to 1 loop +-- set_permissions(mm2s_memory, i, no_access); + end loop; + wait; + end process; +end architecture; diff --git a/testsuite/gna/issue713/e.vhdl b/testsuite/gna/issue713/e.vhdl new file mode 100644 index 000000000..090e959d5 --- /dev/null +++ b/testsuite/gna/issue713/e.vhdl @@ -0,0 +1,22 @@ +entity e is +end entity; + +architecture a of e is + function foo(n : positive) return bit_vector is + begin + return (n downto 0 => '0'); + end function; +begin + process + begin + for i in foo(3)'range loop + report integer'image(i); + end loop; + + for i in foo(2)'reverse_range loop + report integer'image(i + foo(4)'length); + end loop; + + wait; --forever + end process; +end architecture; diff --git a/testsuite/gna/issue713/repro2.vhdl b/testsuite/gna/issue713/repro2.vhdl new file mode 100644 index 000000000..58ab8c91b --- /dev/null +++ b/testsuite/gna/issue713/repro2.vhdl @@ -0,0 +1,49 @@ +entity repro2 is + generic (str : string := "1234"); +end; + +use std.textio.all; +architecture behav of repro2 is + type line_array is array (1 to 10) of line; +begin + p: process + function f return natural is + begin + return 8; + end f; + + subtype st is natural range str'range; -- natural range 1 to f; + variable v : line_array; + + procedure fill (l : natural) is + begin + for i in v'range loop + deallocate (v(i)); + v(i) := new string'(1 to l * i => 'a'); + end loop; + end fill; + + procedure doloop (variable l : line) + is + constant num : natural := l'length; + variable count : natural := 0; + begin + for i in l'range loop + count := count + 1; + assert i = count + report "count=" & natural'image (count) & ", i=" & natural'image(i) + severity failure; + fill (i); + end loop; + end doloop; + + begin + fill (7); + doloop (v(3)); + doloop (v(8)); + for k in p.st loop + wait for 1 ns; + end loop; + wait; + end process; +end behav; diff --git a/testsuite/gna/issue713/sim_types_pkg.vhd b/testsuite/gna/issue713/sim_types_pkg.vhd new file mode 100644 index 000000000..ad1aed8dc --- /dev/null +++ b/testsuite/gna/issue713/sim_types_pkg.vhd @@ -0,0 +1,18 @@ +package sim_types_pkg is + type descriptor_t is record + --address : std_ulogic_vector(dma_addr_range); + --length : std_ulogic_vector(dma_len_range); + address : natural; + length : positive; + end record; + + procedure call_report (v : natural); +end package; + +package body sim_types_pkg is + procedure call_report (v : natural) is + begin + report "call_report " & natural'image(v) severity note; + end call_report; +end sim_types_pkg; + diff --git a/testsuite/gna/issue713/testsuite.sh b/testsuite/gna/issue713/testsuite.sh new file mode 100755 index 000000000..cd935e435 --- /dev/null +++ b/testsuite/gna/issue713/testsuite.sh @@ -0,0 +1,19 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze repro2.vhdl +elab_simulate repro2 + +analyze e.vhdl +elab_simulate e + +clean + +#export GHDL_STD_FLAGS=--std=08 +analyze sim_types_pkg.vhd dma_controller_tb.vhd +elab_simulate dma_controller_tb + +clean + +echo "Test successful" |