Thank you for taking the effort to make a proper MCVE. My build of ghdl-0.34dev does the same, so there is clearly a ghdl bug here.
If the behaviour is legal, this should work, and if it's illegal, ghdl should exit cleanly with a description of the error.
Instead, ghdl isn't crashing, it has identified a shortcoming, a case where it "cannot handle LAST_EVENT attribute" (applied to another attribute) and shutdown with diagnostics.
I'll leave open the question whether a fine reading of the LRM determines its actual legality or not...
Putting anything at all beyond generics and ports in the entity as opposed to the architecture is rare ... I can't say I've ever seen it in production code - so you are out in the tall grass, though it's a valid thing to do.
In any case, moving this assertion into the architecture yields the same error, so that isn't the problem.
So, I've reporting it on ghdl's development site as https://github.com/tgingold/ghdl/issues/256 and I'll update my answer with any developments.
EDIT : A fix for this issue is now tested, and will be pushed to github following a full regression test.
HOWEVER : due to a subtlety in concurrent asserts, the two forms are not equivalent.
ghdl -r testcase_testbench
testcase.vhd:7:9:@30ns:(assertion error): Assertion violation
ghdl -r testcase_testbench
testcase2.vhd:4:5:@10ns:(assertion error): Assertion violation
testcase2.vhd:4:5:@25ns:(assertion error): Assertion violation
testcase2.vhd:4:5:@30ns:(assertion error): Assertion violation
In the first case, the process triggers on clk
as requested. Delete the "wait" and put clk
in the sensitivity list, and it does the same.
However, in Testcase2, the concurrent Assert is equivalent to a sensitivity list process, but the sensitivity list is clk'delayed
.
As Tristan points out on the issue report (same link as above), clk'delayed
is active in more than one delta cycle at 10ns, and so fails the test (because last'event is 0 ns between them!) Put clk'delayed
in the sensitivity list for the Testcase process and see.
As "diogratia" points out there, a similar example in "The VHDL Designer's Guide" (Peter Ashenden) has a simple change to Testcase2 avoiding the issue : restrict the Assert to clk events...
entity testcase2 is
port(clk: in bit);
begin
check: assert (not clk'event) or clk'delayed'last_event >= 10 ns;
end entity testcase2;
architecture empty of testcase2 is
begin
end architecture empty;
EDIT 2 : As of commit b42069e this is fixed in ghdl-0.34dev. If your workaround using a process doesn't meet your needs, you can update to this version, but it means building ghdl from source.
Best Answer
One way is to simplify generating signals of the right range. For example:
mysignal <= "010" and (mysignal'range => '1');
This creates a new value for the second operand, the correct size, with all bits set to '1',