TODO §54 (docs/features/coverage-gaps-l); closes docs/coverage_gaps.md L3, L6 and L10. The first dev stalled under machine load; a second finished from the tree. 54.1 `->>` with optional delay or event control (`StmtKind::EventTrigger`), stream `with [range]` (`ExprKind::StreamWith`), the LRM's other `casting_type`s, drive strength on a net declaration (`DataDecl::strength`, whose comment slots also fix a pre-existing refusal on an `assign` with a comment before its strength), `let` at statement position (`StmtKind::Let`), and `#(min:typ:max)` clocking skews — `ClockingSkew` as the LRM's two alternatives, `edge [delay]` | `delay` (review rework of QA's HIGH). Comment slots added to `let`, stream concatenations and the clocking grammar; the RTL gap fuzzer at 505 gaps, zero failing. 54.2 `randsequence` (it was a parse error; the keyword is new): `RandSequence` → `Production` → `Alternative` → `ProdItem` (ref, block, if, repeat, case, rand join), code blocks by the statement grammar; one production per line, alternatives aligned; the LRM's examples as cases. 54.3 `[format] uvm-utils-indent` / `lucisv.format.uvmUtilsIndent`, default off, tracking nested `_begin`/`_end` pairs; 21 corpus files change with it on, all idempotent. A short comment-free enum body already one-lines, so no key was built — the behaviour is pinned. `[format]` table tests added (review rework). `->>`'s event control is bound through the shared `bind_timing` (review rework of QA's second HIGH). 0 of 820 corpus files differ from 0.48.x with the key off; the opentitan sweep is identical; no corpus or opentitan file writes any of the new shapes. Co-Authored-By: Claude Fable 5.1 <[email protected]>
258 lines
5.7 KiB
Plaintext
258 lines
5.7 KiB
Plaintext
# TODO §54.2 — `randsequence` (IEEE 1800 §18.17) as real nodes: a production
|
||
# list with weighted alternatives, not an opaque leaf. Zero occurrences in the
|
||
# corpus and in opentitan, so the LRM's own examples are the cases.
|
||
# docs/features/coverage-gaps-l/README.md
|
||
#
|
||
# §18.17's opening example: a start production and three plain ones.
|
||
module m;
|
||
initial begin
|
||
randsequence (main)
|
||
main : first second done;
|
||
first : add | dec;
|
||
second : pop | push;
|
||
done : {$display("done");};
|
||
add : {$display("add");};
|
||
dec : {$display("dec");};
|
||
pop : {$display("pop");};
|
||
push : {$display("push");};
|
||
endsequence
|
||
end
|
||
endmodule
|
||
----
|
||
module m;
|
||
initial begin
|
||
randsequence (main)
|
||
main : first second done;
|
||
first : add | dec;
|
||
second : pop | push;
|
||
done : {
|
||
$display("done");
|
||
};
|
||
add : {
|
||
$display("add");
|
||
};
|
||
dec : {
|
||
$display("dec");
|
||
};
|
||
pop : {
|
||
$display("pop");
|
||
};
|
||
push : {
|
||
$display("push");
|
||
};
|
||
endsequence
|
||
end
|
||
endmodule
|
||
====
|
||
# Weighted alternatives (§18.17.2): `:= weight`, with and without the code
|
||
# block that runs when the alternative is chosen. Alternatives that fit stay
|
||
# on the production's line; the case after this one is the same list too wide
|
||
# for one, broken one per line with each `|` under the `:`.
|
||
module m;
|
||
initial begin
|
||
randsequence (top)
|
||
top : a := 3 | b := 2 | c := 1;
|
||
a : add;
|
||
b : dec := 5 {$display("chosen");};
|
||
c : add;
|
||
add : {x = x + 1;};
|
||
dec : {x = x - 1;};
|
||
endsequence
|
||
end
|
||
endmodule
|
||
----
|
||
module m;
|
||
initial begin
|
||
randsequence (top)
|
||
top : a := 3 | b := 2 | c := 1;
|
||
a : add;
|
||
b : dec := 5 {
|
||
$display("chosen");
|
||
};
|
||
c : add;
|
||
add : {
|
||
x = x + 1;
|
||
};
|
||
dec : {
|
||
x = x - 1;
|
||
};
|
||
endsequence
|
||
end
|
||
endmodule
|
||
====
|
||
# The three control shapes an alternative's items may take (§18.17.3–4) and
|
||
# the interleaving `rand join` (§18.17.6).
|
||
module m;
|
||
initial begin
|
||
randsequence (main)
|
||
main : gen loop sel mix;
|
||
gen : if (cond) add else dec;
|
||
loop : repeat (3) add;
|
||
sel : case (mode) 0, 1 : add; 2 : dec; default : add; endcase;
|
||
mix : rand join add dec;
|
||
bias : rand join (0.5) add dec;
|
||
add : {x++;};
|
||
dec : {x--;};
|
||
endsequence
|
||
end
|
||
endmodule
|
||
----
|
||
module m;
|
||
initial begin
|
||
randsequence (main)
|
||
main : gen loop sel mix;
|
||
gen : if (cond) add else dec;
|
||
loop : repeat (3) add;
|
||
sel : case (mode)
|
||
0, 1: add;
|
||
2: dec;
|
||
default: add;
|
||
endcase;
|
||
mix : rand join add dec;
|
||
bias : rand join (0.5) add dec;
|
||
add : {
|
||
x++;
|
||
};
|
||
dec : {
|
||
x--;
|
||
};
|
||
endsequence
|
||
end
|
||
endmodule
|
||
====
|
||
# A production with a return type and formal arguments (§18.17.5), and a
|
||
# reference that passes arguments to one.
|
||
module m;
|
||
initial begin
|
||
randsequence (main)
|
||
main : bump(3) use_it;
|
||
void bump(int step) : {
|
||
total = total + step;
|
||
};
|
||
int use_it : {
|
||
return total;
|
||
};
|
||
endsequence
|
||
end
|
||
endmodule
|
||
----
|
||
module m;
|
||
initial begin
|
||
randsequence (main)
|
||
main : bump(3) use_it;
|
||
void bump(int step) : {
|
||
total = total + step;
|
||
};
|
||
int use_it : {
|
||
return total;
|
||
};
|
||
endsequence
|
||
end
|
||
endmodule
|
||
====
|
||
# `break` and `return` inside a production's code block are the ordinary
|
||
# statements they are, and `randsequence ()` may name no start production.
|
||
module m;
|
||
initial begin
|
||
randsequence ()
|
||
main : {
|
||
if (done) break;
|
||
return;
|
||
};
|
||
endsequence
|
||
end
|
||
endmodule
|
||
----
|
||
module m;
|
||
initial begin
|
||
randsequence ()
|
||
main : {
|
||
if (done) break;
|
||
return;
|
||
};
|
||
endsequence
|
||
end
|
||
endmodule
|
||
====
|
||
# Every gap of the grammar takes a comment and prints it back where it was
|
||
# written: around the `(main)`, around the `:`, the `|` and the `:=`, and
|
||
# inside a code block and a case arm.
|
||
module m;
|
||
initial begin
|
||
randsequence /*a*/ ( /*b*/ main /*c*/ )
|
||
// above the production
|
||
main /*d*/ : /*e*/ first /*f*/ | /*g*/ second /*h*/ := /*i*/ 3 /*j*/ ; // after it
|
||
first : {
|
||
/*k*/
|
||
x = 1; /*l*/
|
||
};
|
||
second : if /*m*/ (c) first /*n*/ else /*o*/ first;
|
||
third : case /*p*/ (x)
|
||
1 /*q*/: /*r*/ first /*s*/ ;
|
||
default first;
|
||
endcase;
|
||
fourth : rand /*t*/ join (2) first second;
|
||
// before endsequence
|
||
endsequence
|
||
end
|
||
endmodule
|
||
----
|
||
module m;
|
||
initial begin
|
||
randsequence /*a*/ ( /*b*/ main /*c*/ )
|
||
// above the production
|
||
main /*d*/ : /*e*/ first /*f*/ | /*g*/ second /*h*/ := /*i*/ 3 /*j*/ ; // after it
|
||
first : {
|
||
/*k*/
|
||
x = 1; /*l*/
|
||
};
|
||
second : if /*m*/ (c) first /*n*/ else /*o*/ first;
|
||
third : case /*p*/ (x)
|
||
1 /*q*/: /*r*/ first /*s*/ ;
|
||
default first;
|
||
endcase;
|
||
fourth : rand /*t*/ join (2) first second;
|
||
// before endsequence
|
||
endsequence
|
||
end
|
||
endmodule
|
||
====
|
||
# The same production with alternatives too wide for one line: one per line,
|
||
# each `|` starting its own, indented under the production's head.
|
||
module m;
|
||
initial begin
|
||
randsequence (top)
|
||
top : first_alternative_name := 3 | second_alternative_name := 2 | third_alternative_name := 1;
|
||
first_alternative_name : {
|
||
x = 1;
|
||
};
|
||
second_alternative_name : {
|
||
x = 2;
|
||
};
|
||
third_alternative_name : {
|
||
x = 3;
|
||
};
|
||
endsequence
|
||
end
|
||
endmodule
|
||
----
|
||
module m;
|
||
initial begin
|
||
randsequence (top)
|
||
top :
|
||
first_alternative_name := 3
|
||
| second_alternative_name := 2
|
||
| third_alternative_name := 1;
|
||
first_alternative_name : {
|
||
x = 1;
|
||
};
|
||
second_alternative_name : {
|
||
x = 2;
|
||
};
|
||
third_alternative_name : {
|
||
x = 3;
|
||
};
|
||
endsequence
|
||
end
|
||
endmodule
|