Skip to content

Issue with 'last_event / 'delayed attributes on nested records #1164

@ciwn

Description

@ciwn

Hi,
I have problems when elaboration designs using attributes like 'last_event or 'delayed on nested records. The code works with GHDL 4.1.0.
Following code snippet repoduces the problem:

library ieee;
use ieee.std_logic_1164.all;

entity tb_issue is
end entity;

architecture arch of tb_issue is
  type rec_part is record
    a : std_logic;
  end record;

  type t_rec is record    
    rec_part_a : rec_part;    
    b : std_logic;
  end record t_rec;

  signal rec_sig : t_rec;
begin


  detect : process (all)
    variable var_time : time;
  begin
    -- var_time := rec_sig.b'last_event; -- okay
    var_time := rec_sig.rec_part_a'last_event; -- not okay
    -- var_time := rec_sig.rec_part_a'delayed(0 ns)'last_event; -- not okay
  end process;

end architecture arch;

Output of analysis+elaboration (nvc --std=08 -a nvc_test.vhd -e tb_issue)

Name       WORK.TB_ISSUE.DETECT
Kind       process
Context    WORK.TB_ISSUE
Blocks     2
Registers  6
Types      5
Variables  1
  VAR_TIME                              // -2^63..2^63-1
Begin
   0: r0 := const -9223372036854775808  // -2^63..2^63-1 => -2^63
      VAR_TIME := store r0
      return 
   1: r1 := var upref 1, REC_SIG        // @<WORK.TB_ISSUE-ARCH.T_REC${}>
      r2 := record ref r1 field 1       // @<$<0..8>> => $<0..8>
      r3 := load indirect r2            // $<0..8>
      r4 := last event r3               // -2^63..2^63-1
      VAR_TIME := store r4
      r5 := record ref r1 field 0       // @<WORK.TB_ISSUE-ARCH.REC_PART${}> => WORK.TB_ISSUE-ARCH.REC_PART${}
      invalid := last event r5   <----

** Fatal: signal argument to last event must have signal type
[0x5653f29c7fe6] 
[0x5653f28e2173] 
[0x5653f2992c38] 
[0x5653f2994fe3] 
[0x5653f29b2137] 
[0x5653f2996f8c] 
[0x5653f299857d] 
[0x5653f296ac35] 
[0x5653f2963f97] 
[0x5653f2a4fce6] 
[0x5653f2902a73] 
[0x5653f28ffe7f] 
[0x5653f290157f] 
[0x5653f28fa31c] 
[0x7fc5287e8d8f] (/usr/lib/x86_64-linux-gnu/libc.so.6) 
[0x7fc5287e8e3f] (/usr/lib/x86_64-linux-gnu/libc.so.6) __libc_start_main
[0x5653f28fb794] 

nvc 1.15.1 (db31b1a) (Using LLVM 14.0.0) [x86_64-pc-linux-gnu]

Please report this bug at https://github.com/nickg/nvc/issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions