Using public accessor tasks/functions to read and write registers causes BLKANDNBLK error
I have a register for which we wish to provide a public accessor task and function, to allow it value to be written (via a task) and read (via a function) externally. I can do this either using
/* public verilator */ on the task and function or by marking them as DPI-C export functions.
- we must define both a write task and read function.
- both task and function must be exported
- the variable concerned must be the target of a non-blocking assignment.
It would be very convenient to be able to write both write and read accessors for registers which are the subject of non-blocking assignment. The fact that either one or the other can be done, suggests it should be possible.
I've attached two tests which demonstrate this problem (one for DPI export, the other for verilator public) as git patches against the current HEAD. I'll investigate further how this might be solved.
#1 Updated by Wilson Snyder over 7 years ago
- Status changed from New to Confirmed
Could you extend the test to check the read and write accessors? Due to the blocking assignment there's both the new value and the old value at play. It should correctly be sorting them out, but it's better to be sure and also verify it doesn't change down the road. Assuming the accessors do work correctly, then it's just a issue of automatically suppressing the warning.
#2 Updated by Jeremy Bennett over 7 years ago
Tests extended to include execution. Running with -Wno-BLKANDNBLK, these tests give correct results. The test harness matches for the exact output. Ideally I should like to use pattern matching to skip irrelevant lines with the "expect" argument, but I couldn't get this to work.
It looks safe to suppress the warning in this case.
Revised tests attached as git diff against current HEAD (commit 31b55d384479ca19704b094128f545b499aa6a73).
#3 Updated by Wilson Snyder over 7 years ago
- Category set to Lint
- Assignee set to Wilson Snyder
I'll suppress the warning.
Ideally I should like to use pattern matching to skip irrelevant lines with the "expect" argument, but I couldn't get this to work.
expect takes either an exact match, or a pattern. For example if you add a .* then you'll need to also quote other magic characters such as the parenthesis in your output, the easiest way is to see how "quotemeta" is used in test_regress/t/*.pl.
Also available in: Atom