-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support to evaluate PSL endpoints in VHDL code #45
Comments
Here is my test case: library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library std;
use std.env.all;
entity psl_test_endpoint is
end entity psl_test_endpoint;
architecture test of psl_test_endpoint is
signal s_rst_n : std_logic := '0';
signal s_clk : std_logic := '0';
signal s_write : std_logic;
signal s_read : std_logic;
begin
s_rst_n <= '1' after 100 ns;
s_clk <= not s_clk after 10 ns;
TestP : process is
begin
report "RUNNING psl_test_endpoint test case";
report "==========================================";
s_write <= '0';
s_read <= '0';
wait until s_rst_n = '1' and rising_edge(s_clk);
s_write <= '1';
wait until rising_edge(s_clk); -- endpoint is be active
s_read <= '1';
wait until rising_edge(s_clk);
s_write <= '0';
s_read <= '0';
wait until rising_edge(s_clk);
stop(0);
end process TestP;
-- psl default clock is rising_edge(s_clk);
-- sequence & endpoint definition
-- psl endpoint E_TEST is {not(s_write); s_write};
-- It's not possible to use endpoints in VHDL code
EndpointP: process is
begin
wait until E_TEST;
report "TEST";
wait;
end process EndpointP;
|
Being able to reference endpoints in VHDL is indeed a powerful feature. Do you need support for PSL functions ? |
PSL functions would be a nice addition to GHDL, but they aren't a blocker at the moment. If you consider to implement PSL functions, the ended() function would be the standard way when evaluating PSL events in VHDL. Regarding PSL 2010: the main addition I know is local variables in properties. The syntax is crude imho, but they make possible to write more readable properties where you needed property replication before. Modelsim/Questa don't supports this, my support case was answered as "we don't plan to support PSL 2010 standard", which is annoying. They don't support standards which were codefined by their own Chief Verification Scientist :( Another question: is there a data structure in GHDL which accumulates how often PSL assertion and cover directives when triggered? I've looked into the code regarding PSL, but I don't really understand it works without knowledge of the internal structure of GHDL ;) |
On 10/03/16 10:52, T. Meissner wrote:
My understanding is that ended() is only available within PSL expressions.
Yes, but that's not easy to implement :-(
No, but that's much easier to implement. Tristan. |
Maybe this isn't described in the PSL standard. It is also not mentioned in the book "Practical Introduction to PSL". They only claim, that ended() is a boolean which is true in the last cycle of a triggered sequence. Modelsim/Questa supports evaluating ended() in HDL. The syntax is similar to evaluating endpoints in VHDL like this: -- psl sequence s_test is {req; not(grant); grant}@rising_edge(clk);
process is
begin
wait until ended(s_test);
report "s_test hit";
wait;
end process; I've tried a similar example with Riviera 2015.01 on edaplayground (http://www.edaplayground.com/x/3sjM), but it don't work. So, is it a Mentor extension? I don't believe that, but I'm not sure. There are some articles on the web, that describe that behaviour, most with endpoints, but the behaviour should be the same. Regarding the PSL data structure: It's content could be similar to other simulators. They store the assertion/cover name, counts of passes and failures, the type of assertion/cover (psl/vhdl) and in which design unit they are. Something like this (I use strings for fields which would printed as strings in a report): type CoverageLog is record
Name : string;
Passes : natural;
Fails : natural;
Type : string;
Unit : string;
end record; This could be used to export a coverage report in plain text and xml (which would be good for further processing by tools). |
On 10/03/16 10:52, T. Meissner wrote:
This latter is now implemented. I have posted this message to this enhancement is now implemented. A new option, Feedback is welcome. Now I will investigate endpoints. Tristan. |
Oh, cool. I'm at the linux days in Chemnitz this weekend, i think I will have time to test it between the lectures. Thanks 👍 Regarding endpoints/ended() in VHDL: I think now, they are valid in the modeling layer of PSL. So, in a PSL vunit, they should be valid in the selected HDL flavor. The evaluation of endpoints/ended() in normal VHDL architectures is a Mentor extension maybe. |
On 18/03/16 20:12, T. Meissner wrote:
Have fun!
Possibly. But this is unambiguous and powerful. |
Mhm, I get no report file. What I'm doing wrong?
The simulation worked, but no psl_report.json file was written. |
Mhm, testcase for ticket24 works as expected. But it uses
I always use
If I use the same commands for my test design, I don' get the psl export file. strange :o |
My testcase for the psl-report, which doesn't produce psl-export file: library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library std;
use std.env.all;
entity psl_test_endpoint is
end entity psl_test_endpoint;
architecture test of psl_test_endpoint is
signal s_rst_n : std_logic := '0';
signal s_clk : std_logic := '0';
signal s_write : std_logic;
signal s_read : std_logic;
begin
s_rst_n <= '1' after 100 ns;
s_clk <= not s_clk after 10 ns;
TestP : process is
begin
report "RUNNING psl_test_endpoint test case";
report "==========================================";
s_write <= '0'; -- named assertion should hit
s_read <= '0';
wait until s_rst_n = '1' and rising_edge(s_clk);
s_write <= '1';
wait until rising_edge(s_clk);
s_read <= '1'; -- assertion should hit
wait until rising_edge(s_clk);
s_write <= '0';
s_read <= '0';
wait until rising_edge(s_clk);
stop(0);
end process TestP;
-- psl default clock is rising_edge(s_clk);
-- psl endpoint E_TEST is {not(s_write); s_write};
-- psl sequence abc_seq is {not(s_write); s_write};
-- psl ENDPOINT_ASSERT : assert always {E_TEST; s_read} report "ENDPOINT ASSERT";
-- psl COVERAGE0 : cover {not(s_write); s_write} report "COVERED0";
-- psl COVERAGE1 : cover {abc_seq} report "COVERED1";
-- psl COVERAGE2 : cover {E_TEST} report "COVERED2";
end architecture test; |
On 18/03/16 21:31, T. Meissner wrote:
Nothing, but you are stopping simulation with std.env.stop Tristan. |
On 18/03/16 23:28, T. Meissner wrote:
Thanks. It now works on my setup, I will commit the fix soon. Tristan. |
Yep, after I removed the { "details" : [
{ "directive": "assertion",
"name": ".psl_test_endpoint(test).endpoint_assert",
"file": "psl_test_endpoint.vhd",
"line": 52,
"count": 1,
"status": "failed"},
{ "directive": "cover",
"name": ".psl_test_endpoint(test).coverage0",
"file": "psl_test_endpoint.vhd",
"line": 53,
"count": 1,
"status": "covered"},
{ "directive": "cover",
"name": ".psl_test_endpoint(test).coverage1",
"file": "psl_test_endpoint.vhd",
"line": 54,
"count": 1,
"status": "covered"},
{ "directive": "cover",
"name": ".psl_test_endpoint(test).coverage2",
"file": "psl_test_endpoint.vhd",
"line": 55,
"count": 1,
"status": "covered"}],
"summary" : {
"assert": 1,
"assert-failure": 1,
"assert-pass": 0,
"cover": 3,
"cover-failure": 0,
"cover-pass": 3}
} What I would like to add is pass counts not only for the summary, but also for each assert detail. So I can see if a assert was passed, when not, I have a coverage hole in my test case. It could look like this: { "details" : [
{ "directive": "assertion",
"name": ".psl_test_endpoint(test).endpoint_assert",
"file": "psl_test_endpoint.vhd",
"line": 52,
"count-pass": 0,
"count-failure": 1,
"status": "failed"}, |
On 19/03/16 11:27, T. Meissner wrote:
Thanks! [...]
Unfortunately, the state machine only detects failure, not success. |
On 18/03/16 23:28, T. Meissner wrote:
This is now fixed. Thanks! |
It works. Thanks. BTW: I have a new repository where I collect all my test cases: https://github.com/tmeissner/vhdl_verification |
On 22/03/16 14:34, T. Meissner wrote:
Ok, I will bookmark it. I have just pushed the enhancement for endpoints: it is now possible Tristan. |
Thanks 👍 For my test test extended by a VHDL process reading the endpoint:
|
On 22/03/16 22:03, T. Meissner wrote:
I am fixing the crash, but your code should be: wait until E_TEST0; Tristan. |
Yep, my fault. It works now, thanks :) |
Hi Guys, with the last version of GHDL 0.34Dev, i have this error when compiling some code of @tmeissner : https://github.com/tmeissner/vhdl_verification/tree/master/osvvm_fsm_coverage ghdl:warning: library std does not exists for v08 according to @tmeissner there is no error in his side, here is also the PKGBUILD Used to build ghdl: https://aur.archlinux.org/packages/ghdl-gcc-git/ @tgingold Do you have some idea tohow to debug this issue? |
On 26/09/16 20:17, Massine wrote:
Looks like the archlinux package is not complete: vhdl 2008 libraries You can try to use the latest beta from github. Tristan. |
OK @tgingold I will try this and keep you informed. Can you tell me if possible when you will release the new version with PSL support? it would be good if you can Tag this version. |
GHDL already supports the PSL
endpoint
statement, which triggers at the last cycle of a sequence which was hit. However, you only can evaluate theendpoint
in PSL code. In other simulators it is possible to read the value of theendpoint
in VHDL code like this:You can find an other example here: http://www.cvcblr.com/blog/?p=810
I don't know, if evaluating PSL endpoints in VHDL is defined in the PSL standard, but the tools that I now (Modelsim/Questa) support that. I will try on edaplayground, if Riviera also supports that, but I think it does. In the IEEE PSL standard
endpoint
was replaced by theended()
function, which is similar. But GHDL don't supports any PSL functions, so it would be a more easy way to enhance the already supportedendpoint
statement.The text was updated successfully, but these errors were encountered: