diff options
author | Tristan Gingold <tgingold@free.fr> | 2016-07-30 09:50:10 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2016-07-30 09:50:10 +0200 |
commit | b404134363a4f097378aacb879220fd831bdb09f (patch) | |
tree | 95d3d7c945b666d452383adc133a0a1b4bd6b1fd /testsuite/gna/bug049/rng1.vhdl | |
parent | f48a3b933ed0e9e66002b3b14486a281ac541114 (diff) | |
download | ghdl-b404134363a4f097378aacb879220fd831bdb09f.tar.gz ghdl-b404134363a4f097378aacb879220fd831bdb09f.tar.bz2 ghdl-b404134363a4f097378aacb879220fd831bdb09f.zip |
Add testcase for previous patch.
Diffstat (limited to 'testsuite/gna/bug049/rng1.vhdl')
-rw-r--r-- | testsuite/gna/bug049/rng1.vhdl | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/testsuite/gna/bug049/rng1.vhdl b/testsuite/gna/bug049/rng1.vhdl new file mode 100644 index 000000000..0eab6ee24 --- /dev/null +++ b/testsuite/gna/bug049/rng1.vhdl @@ -0,0 +1,45 @@ +use std.textio.all; + +entity sliding_index is +end entity; + +architecture foo of sliding_index is + type integer_vector is array (natural range <>) of integer; + + function to_string(inp: integer_vector) return string is + variable retn: line; + begin + for i in inp'range loop + if i = inp'RIGHT then + write (retn, integer'image(inp(i))); + else + write (retn, integer'image(inp(i)) & ','); + end if; + end loop; + return retn(1 to retn'length); -- the string value of the line + end function; + + constant ivec: integer_vector := (1,2,3,4,5,6,7); + signal sum: integer_vector (ivec'range); + -- signal sum: integer_vector (0 to 6); + +begin + + sum <= ( + 0 => ( ivec(0) + ivec(1)), + 1 => (ivec(0) + ivec(1) + ivec(2)), + 2 => (ivec(1) + ivec(2) + ivec(3)), + 3 => (ivec(2) + ivec(3) + ivec(4)), + 4 => (ivec(3) + ivec(4) + ivec(5)), + 5 => (ivec(4) + ivec(5) + ivec(6)), + 6 => (ivec(5) + ivec(6) ) + ); + + process + begin + wait for 0 ns; + report "ivec = " & to_string(ivec); + report "sum = " & to_string(sum); + wait; + end process; +end architecture; |