package test_pkg is
type vector_of_vectors is array(natural range <>) of bit_vector ;
end package ;
use work.test_pkg.vector_of_vectors ;
entity test is
port (
in_a : in vector_of_vectors ;
in_b : in vector_of_vectors ;
outs : out vector_of_vectors
) ;
end entity ;
architecture arch of test is
-- Comment these next lines to cause a segfault
constant A : natural := in_a'length ;
constant B : natural := in_a'element'length ;
begin
process
begin
report "A: " & integer'image(A) ;
report "B: " & integer'image(B) ;
wait ;
end process ;
process(all)
begin
for idx in in_a'range loop
for x in in_a(idx)'range loop
outs(idx)(x) <= in_a(idx)(x) xor in_b(idx)(x) ;
end loop ;
end loop ;
end process ;
end architecture ;
use work.test_pkg.vector_of_vectors ;
entity test_tb is
end entity ;
architecture arch of test_tb is
signal a : vector_of_vectors(1 downto 0)(20 downto 0) ;
signal b : vector_of_vectors(1 downto 0)(20 downto 0) ;
signal c : vector_of_vectors(1 downto 0)(20 downto 0) ;
begin
U_test_a : entity work.test
port map (
in_a => a,
in_b => b,
outs => c
) ;
tb : process
begin
wait for 100 ns ;
report "Done" ;
std.env.stop ;
end process ;
end architecture ;
As it is, produces:
$ nvc --std=2008 -a test.vhdl -e test_tb -r
Name WORK.TEST_TB.U_TEST_A
Kind instance
Context WORK.TEST_TB
Blocks 1
Registers 28
Types 18
Variables 5
IN_A // $<0..1>, signal
IN_B // $<0..1>, signal
OUTS // $<0..1>, signal
A // -2^31..2^31-1 => 0..2^31-1, constant
B // -2^31..2^31-1 => 0..2^31-1, constant
Begin
0: r0 := package init WORK.TEST_PKG // P<WORK.TEST_PKG>
r1 := package init STD.STANDARD // P<STD.STANDARD>
r2 := var upref 1, A // @<$<0..1>> => 0..1
r3 := load indirect r2 // $<0..1> => 0..1
r4 := debug locus WORK.TEST_TB.elab-295 // D<>
r5 := const 2 // # => 2
r6 := debug locus WORK.TEST_TB.elab-291 // D<>
alias signal r3 locus r6
IN_A := store r3
r7 := var upref 1, B // @<$<0..1>> => 0..1
r8 := load indirect r7 // $<0..1> => 0..1
r9 := debug locus WORK.TEST_TB.elab-302 // D<>
r10 := debug locus WORK.TEST_TB.elab-298 // D<>
alias signal r8 locus r10
IN_B := store r8
r11 := var upref 1, C // @<$<0..1>> => 0..1
r12 := load indirect r11 // $<0..1> => 0..1
r13 := debug locus WORK.TEST_TB.elab-309 // D<>
r14 := debug locus WORK.TEST_TB.elab-305 // D<>
alias signal r12 locus r14
OUTS := store r12
r15 := const 0 // 0..1 => 0
r16 := const [r15]*42 // [42] : 0..1 => 0..1
r17 := address of r16 // @<0..1> => 0..1
r18 := const 1 // # => 1
r19 := const 21 // # => 21
r20 := const 20 // -2^31..2^31-1 => 20
r21 := const 0 // -2^31..2^31-1 => 0
r22 := const 1 // 0..1 => 1
r23 := const 42 // # => 42
r24 := debug locus WORK.TEST_TB.elab-305 // D<>
map const r17 to r12 count r23
r25 := const 2 // -2^31..2^31-1 => 2
r26 := const 2147483647 // -2^31..2^31-1 => 2^31-1
A := store r25
r27 := null // @<0..1>
invalid := uarray left r3 dim 1 <----
** Fatal: cannot use uarray left with non-uarray type
[0x561556729763] ../src/diag.c:1015 diag_femit
[0x561556664a12] ../src/util.c:585 fatal_trace
[0x56155670fe13] ../src/vcode.c:4488 emit_uarray_op.lto_priv.0
[0x56155678980b] ../src/vcode.c:4502 lower_wrap_element.constprop.0
[0x5615566ef4c3] ../src/lower.c:5298 lower_expr.lto_priv.0
[0x561556706c81] ../src/lower.c:12265 lower_rvalue
[0x5615566f1dda] ../src/lower.c:4804 lower_attr_ref
[0x5615566ef4c3] ../src/lower.c:5298 lower_expr.lto_priv.0
[0x561556706c81] ../src/lower.c:12265 lower_rvalue
[0x5615566fdf7f] ../src/lower.c:7585 lower_decls.lto_priv.0
[0x5615566c1698] ../src/lower.c:12468 lower_instance
[0x5615566c1698] ../src/lower.c:1250 elab_lower.lto_priv.0
[0x5615566c4d75] ../src/elab.c:1475 elab_instance.lto_priv.0
[0x5615566c845c] ../src/elab.c:1791 elab_stmts.lto_priv.0
[0x5615566ca2d7] ../src/elab.c:1963 elab_top_level
[0x5615566cca3f] ../src/elab.c:2032 elab
[0x56155666e1ff] ../src/nvc.c:456 elaborate
[0x56155666b57f] ../src/nvc.c:1878 process_command
[0x56155666b9dc] ../src/nvc.c:1521 gui_cmd
[0x56155666b9dc] ../src/nvc.c:1909 process_command
[0x561556662370] ../src/nvc.c:2015 main
When I comment out the A and B constants, it SEFGAULT's at lower.c line 800. ndims is set to 1 and ncons is set to 16777218.
Playing with the following code:
As it is, produces:
When I comment out the A and B constants, it SEFGAULT's at lower.c line 800. ndims is set to 1 and ncons is set to 16777218.