Issue #1321
indentation of coverpoint is incorrect if coverpoint expression is a concatenation
Status:
Confirmed
Priority:
Normal
Assignee:

Category:
Indents
% Done:
0%
Description
Coverpoints on curlybrace concatenations indent incorrectly, and accumulate indent level.
module m; bit a, b, c; covergroup g; cp_ab: coverpoint {a,b} { bins one = {1}; bins two = {2}; } cp_bc: coverpoint {b,c} { bins one = {1}; bins two = {2}; } endgroup endmoduleDesired/correct indenting is seen if an iff clause is added to the coverpoints:
module m; bit a, b, c; covergroup g; cp_ab: coverpoint {a,b} iff (1) { bins one = {1}; bins two = {2}; } cp_bc: coverpoint {b,c} iff (1) { bins one = {1}; bins two = {2}; } endgroup endmoduleVerilogmode version is 20180526be4eda3vpo.
History
#1 Updated by Wilson Snyder over 1 year ago
 Category set to Indents
 Status changed from New to Confirmed
Yes, looks wrong. The indentation code is presently without a major maintainer, so it might be a while before this is fixed unless you can provide a patch.
#2 Updated by Robert Swan over 1 year ago
The following is working for me:
verilogmode version 20180526be4eda3vpo:
module m; bit[0:0] a, b, c; covergroup g; cp_ab: coverpoint {a,b} { bins one = {1}; bins two = {2}; } cp_ab_if_c: coverpoint {a,b} iff c { bins one = {1}; bins two = {2}; } cp_ab_if_c_slice: coverpoint {a,b} iff c[0] { bins one = {1}; bins two = {2}; } cp_a_if_bc: coverpoint {a,b} iff {b,c} { bins one = {1}; bins two = {2}; } cp_a_slice : coverpoint a[0] { bins one = {1}; bins two = {2}; } cp_a_slice_if_b : coverpoint a[0] iff b { bins one = {1}; bins two = {2}; } cp_a_if_b_slice : coverpoint a iff b[0] { bins one = {1}; bins two = {2}; } cp_a_slice_if_b_slice : coverpoint a[0] iff b[0] { bins one = {1}; bins two = {2}; } endgroup endmodule
Patch:
diff git a/verilogmode.el20180526be4eda3vpo b/verilogmode.elindentfix index f7f757f..a5a3617 100644  a/verilogmode.el20180526be4eda3vpo +++ b/verilogmode.elindentfix @@ 6450,6 +6450,34 @@ Return >0 for nested struct." "\\(?:\\w+\\s*:\\s*\\)?\\(coverpoint\\cross\\)" "\\with\\)\\>\\" veriloginconstraintre))) (setq pass 1))))) + + ;; step backwards over coverpoint/iff on concatenation/slice + (catch 'coverpointoriff + (dotimes (testcoverpointoriff 4) + (if (lookingat "coverpoint") + (progn + (verilogbegofstatement) + (setq pass 1) + (throw 'coverpointoriff nil))) + (if (equal (charafter) ?\}) + (progn + (forwardchar 1) + (backwardlist) + (verilogbackwardsexp)) + (if (equal (charafter) ?\[) + (progn + (verilogbackwardtoken) + (verilogbackwardsexp) + ) + (if (or (lookingat "iff")) + (progn + (verilogbackwardws&directives) + (verilogbackwardtoken)) + (if (eq pass 0) + (progn + (verilogbackwardws&directives) + (verilogbackwardsexp)))))))) + (if (eq pass 0) (progn (gotochar pt) nil) 1))) ;; notPatched:
module m; bit[0:0] a, b, c; covergroup g; cp_ab: coverpoint {a,b} { bins one = {1}; bins two = {2}; } cp_ab_if_c: coverpoint {a,b} iff c { bins one = {1}; bins two = {2}; } cp_ab_if_c_slice: coverpoint {a,b} iff c[0] { bins one = {1}; bins two = {2}; } cp_a_if_bc: coverpoint {a,b} iff {b,c} { bins one = {1}; bins two = {2}; } cp_a_slice : coverpoint a[0] { bins one = {1}; bins two = {2}; } cp_a_slice_if_b : coverpoint a[0] iff b { bins one = {1}; bins two = {2}; } cp_a_if_b_slice : coverpoint a iff b[0] { bins one = {1}; bins two = {2}; } cp_a_slice_if_b_slice : coverpoint a[0] iff b[0] { bins one = {1}; bins two = {2}; } endgroup endmodule
#3 Updated by Wilson Snyder over 1 year ago
 Status changed from Confirmed to Assigned
 Assignee set to Robert Swan
Great work this passes on your new test, but if you could please download the git tree and try the self tests this fails with an error "wrong type argument: consp"
Also a nit, in Lisp rather than this
(if (a)
(foo)
(if (b)
(bar)
(if (c)
(baz))))
do this
(cond
((a)
(foo))
((b)
(bar))
((c)
(baz)))
If not clear I'll clean it up for you.
#4 Updated by Wilson Snyder about 1 month ago
 Status changed from Assigned to Confirmed
 Assignee deleted (
Robert Swan)
Still awaiting a patch+test.
Also available in: Atom