A macro invocation that ends its line is a complete item whatever opens the next line; new <expr> shallow-copy constructor; a based number whose digits come from a macro (32'h`BOOT_ADDR) lexes as a base-only number joined with the macro in the parser. verify.rs untouched, attack tests added. Coverage loop round 2: 796 -> 800 / 820 (97.1% -> 97.6%). Feature README: docs/features/mop-up-2/README.md Co-Authored-By: Claude Fable 5 <[email protected]>
354 lines
7.1 KiB
Plaintext
354 lines
7.1 KiB
Plaintext
# casts with a parenthesized base
|
|
module m;
|
|
assign a = (NumLevels)'(unsigned'(j));
|
|
assign b = (DepthW+3)'(1'b1);
|
|
endmodule
|
|
----
|
|
module m;
|
|
assign a = (NumLevels)'(unsigned'(j));
|
|
assign b = (DepthW + 3)'(1'b1);
|
|
endmodule
|
|
====
|
|
# casts with a package-scoped base
|
|
module m;
|
|
assign c = lc_ctrl_pkg::TxWidth'(lc_en_i);
|
|
assign d = prim_mubi_pkg::mubi4_t'(de ? d : q);
|
|
assign e = cfg.width'(x);
|
|
endmodule
|
|
----
|
|
module m;
|
|
assign c = lc_ctrl_pkg::TxWidth'(lc_en_i);
|
|
assign d = prim_mubi_pkg::mubi4_t'(de ? d : q);
|
|
assign e = cfg.width'(x);
|
|
endmodule
|
|
====
|
|
# the simple cast bases still print tight
|
|
module m;
|
|
assign e = 4'(x);
|
|
assign f = W'(x);
|
|
assign g = signed'(x) + int'(y) + string'(z);
|
|
endmodule
|
|
----
|
|
module m;
|
|
assign e = 4'(x);
|
|
assign f = W'(x);
|
|
assign g = signed'(x) + int'(y) + string'(z);
|
|
endmodule
|
|
====
|
|
# streaming concatenations
|
|
module m;
|
|
function automatic int f(input logic v);
|
|
logic [31:0] a, b, x;
|
|
a = {<<8{v}};
|
|
b = { << LfsrIdxDw { col } };
|
|
x = {>>{a, b}};
|
|
x = {<<{x}};
|
|
x = {<< byte {x}};
|
|
endfunction
|
|
endmodule
|
|
----
|
|
module m;
|
|
function automatic int f(input logic v);
|
|
logic [31:0] a, b, x;
|
|
a = {<<8{v}};
|
|
b = {<<LfsrIdxDw{col}};
|
|
x = {>>{a, b}};
|
|
x = {<<{x}};
|
|
x = {<<byte{x}};
|
|
endfunction
|
|
endmodule
|
|
====
|
|
# a streaming concatenation as an assignment target
|
|
module m;
|
|
initial begin
|
|
{>>{a, b}} = x;
|
|
{ << 8 { c } } <= y;
|
|
end
|
|
endmodule
|
|
----
|
|
module m;
|
|
initial begin
|
|
{>>{a, b}} = x;
|
|
{<<8{c}} <= y;
|
|
end
|
|
endmodule
|
|
====
|
|
# the implication operators
|
|
module m;
|
|
assign y = (a -> b);
|
|
assign z = a->b->c;
|
|
assign w = a <-> b;
|
|
assign v = a ? b : c -> d;
|
|
assign u = p || q -> r && s;
|
|
endmodule
|
|
----
|
|
module m;
|
|
assign y = (a -> b);
|
|
assign z = a -> b -> c;
|
|
assign w = a <-> b;
|
|
assign v = a ? b : c -> d;
|
|
assign u = p || q -> r && s;
|
|
endmodule
|
|
====
|
|
# `-> ev;` at statement position is still an event trigger
|
|
module m;
|
|
event ev;
|
|
initial begin
|
|
-> ev;
|
|
x = `IS_CSR -> ex_is_checkable_csr;
|
|
-> done;
|
|
end
|
|
endmodule
|
|
----
|
|
module m;
|
|
event ev;
|
|
initial begin
|
|
-> ev;
|
|
x = `IS_CSR -> ex_is_checkable_csr;
|
|
-> done;
|
|
end
|
|
endmodule
|
|
====
|
|
# a comment on an implication keeps the side it was written on
|
|
module m;
|
|
assign e = f -> // why
|
|
g;
|
|
endmodule
|
|
----
|
|
module m;
|
|
assign e = f -> // why
|
|
g;
|
|
endmodule
|
|
====
|
|
# drive strengths on a continuous assignment
|
|
module m;
|
|
assign (weak0, pull1) a = b;
|
|
assign (pull1,weak0) c = d;
|
|
assign (supply0,supply1) e = f;
|
|
assign (highz0, strong1) g = h;
|
|
endmodule
|
|
----
|
|
module m;
|
|
assign (weak0, pull1) a = b;
|
|
assign (pull1, weak0) c = d;
|
|
assign (supply0, supply1) e = f;
|
|
assign (highz0, strong1) g = h;
|
|
endmodule
|
|
====
|
|
# a drive strength may be followed by a delay, and neither is required
|
|
module m;
|
|
assign (weak0, weak1) #2 i = j;
|
|
assign #1 k = l;
|
|
assign {a, b} = c;
|
|
endmodule
|
|
----
|
|
module m;
|
|
assign (weak0, weak1) #2 i = j;
|
|
assign #1 k = l;
|
|
assign {a, b} = c;
|
|
endmodule
|
|
====
|
|
# an attribute in front of a named port connection
|
|
module m;
|
|
sub u (
|
|
.aaa ( x ),
|
|
.b ( y ),
|
|
(* async *) .c ( z )
|
|
);
|
|
endmodule
|
|
----
|
|
module m;
|
|
sub u (
|
|
.aaa (x),
|
|
.b (y),
|
|
(* async *) .c(z)
|
|
);
|
|
endmodule
|
|
====
|
|
# an attributed connection may come first, and ends the alignment group
|
|
module m;
|
|
sub u (
|
|
(* async *) .a ( x ),
|
|
.bbbbbb ( y ),
|
|
.c ( z )
|
|
);
|
|
endmodule
|
|
----
|
|
module m;
|
|
sub u (
|
|
(* async *) .a(x),
|
|
.bbbbbb (y),
|
|
.c (z)
|
|
);
|
|
endmodule
|
|
====
|
|
# the replication form of an assignment pattern
|
|
module m #(
|
|
parameter sel_t V [NumRegs] = '{NumRegs{0}},
|
|
parameter sel_t W [N] = '{uart_reg_pkg::NumRegs{0}},
|
|
parameter sel_t R = '{(N+1){2}}
|
|
) ();
|
|
endmodule
|
|
----
|
|
module m #(
|
|
parameter sel_t V [NumRegs] = '{NumRegs{0}},
|
|
parameter sel_t W [N] = '{uart_reg_pkg::NumRegs{0}},
|
|
parameter sel_t R = '{(N + 1){2}}
|
|
) ();
|
|
endmodule
|
|
====
|
|
# the keyed and positional pattern forms are unchanged
|
|
module m #(
|
|
parameter sel_t X = '{a: 0, b: 1},
|
|
parameter sel_t Y = '{x, y},
|
|
parameter sel_t Z = '{{a, b}},
|
|
parameter sel_t Q = '{default: 0}
|
|
) ();
|
|
endmodule
|
|
----
|
|
module m #(
|
|
parameter sel_t X = '{a: 0, b: 1},
|
|
parameter sel_t Y = '{x, y},
|
|
parameter sel_t Z = '{{a, b}},
|
|
parameter sel_t Q = '{default: 0}
|
|
) ();
|
|
endmodule
|
|
====
|
|
# `inside` with a macro standing in for the set
|
|
package p;
|
|
function bit g(int x);
|
|
return x inside `TX_IGNORED_PERIOD;
|
|
endfunction
|
|
function bit h(int x);
|
|
return x inside `RANGE(1, 2);
|
|
endfunction
|
|
function bit i(int x);
|
|
return x inside {[0:3], 7};
|
|
endfunction
|
|
endpackage
|
|
----
|
|
package p;
|
|
function bit g(int x);
|
|
return x inside `TX_IGNORED_PERIOD;
|
|
endfunction
|
|
function bit h(int x);
|
|
return x inside `RANGE(1, 2);
|
|
endfunction
|
|
function bit i(int x);
|
|
return x inside {[0:3], 7};
|
|
endfunction
|
|
endpackage
|
|
====
|
|
# a `const ref` task/function argument
|
|
package p;
|
|
function automatic int max(const ref int int_q[$]);
|
|
max = int_q[0];
|
|
endfunction
|
|
function automatic void f(ref int a, const ref int b, input int c);
|
|
endfunction
|
|
endpackage
|
|
----
|
|
package p;
|
|
function automatic int max(const ref int int_q [$]);
|
|
max = int_q[0];
|
|
endfunction
|
|
function automatic void f(ref int a, const ref int b, input int c);
|
|
endfunction
|
|
endpackage
|
|
====
|
|
# every new shape is left alone inside a format fence
|
|
module m;
|
|
// verilog_format: off
|
|
assign (weak0,pull1) a = {<<8{v}} ;
|
|
assign b = '{N{0}} ;
|
|
assign c = d ->e;
|
|
// verilog_format: on
|
|
assign e = f;
|
|
endmodule
|
|
----
|
|
module m;
|
|
// verilog_format: off
|
|
assign (weak0,pull1) a = {<<8{v}} ;
|
|
assign b = '{N{0}} ;
|
|
assign c = d ->e;
|
|
// verilog_format: on
|
|
assign e = f;
|
|
endmodule
|
|
====
|
|
# comments written inside the new constructs stay inside them
|
|
module m;
|
|
assign h = {<<8{ /* c */ v}};
|
|
assign i = /* pre */ (W)'(x);
|
|
sub u (
|
|
// leading
|
|
(* async *) .a ( x )
|
|
);
|
|
endmodule
|
|
----
|
|
module m;
|
|
assign h = {<<8{
|
|
/* c */
|
|
v
|
|
}};
|
|
assign i = /* pre */ (W)'(x);
|
|
sub u (
|
|
// leading
|
|
(* async *) .a(x)
|
|
);
|
|
endmodule
|
|
====
|
|
# a cast and a stream at the line-length boundary
|
|
module m;
|
|
assign long_target_signal_name = (SomeWidthParam)'(some_function_call(aaa, bbb));
|
|
assign other_target_name_here = {<<8{some_quite_long_source_signal_name_x}};
|
|
endmodule
|
|
----
|
|
module m;
|
|
assign long_target_signal_name = (SomeWidthParam)'(some_function_call(aaa, bbb));
|
|
assign other_target_name_here = {<<8{some_quite_long_source_signal_name_x}};
|
|
endmodule
|
|
====
|
|
====
|
|
# a based number whose digits are a macro: the two stay adjacent
|
|
module m;
|
|
parameter int unsigned DmBaseAddr = 32'h`DM_ADDR;
|
|
localparam int Z = 'h`UNSIZED;
|
|
localparam int W = 32'sh`SIGNED;
|
|
localparam int V = 8'b`BITS;
|
|
endmodule
|
|
----
|
|
module m;
|
|
parameter int unsigned DmBaseAddr = 32'h`DM_ADDR;
|
|
localparam int Z = 'h`UNSIZED;
|
|
localparam int W = 32'sh`SIGNED;
|
|
localparam int V = 8'b`BITS;
|
|
endmodule
|
|
====
|
|
# a macro-digit number inside a parenthesized `&`/`|` expression
|
|
module m;
|
|
initial begin
|
|
cosim_cfg.start_pc = ((32'h`BOOT_ADDR & ~(32'h0000_00FF)) | 8'h80);
|
|
end
|
|
endmodule
|
|
----
|
|
module m;
|
|
initial begin
|
|
cosim_cfg.start_pc = ((32'h`BOOT_ADDR & ~(32'h0000_00FF)) | 8'h80);
|
|
end
|
|
endmodule
|
|
====
|
|
# a macro-digit number inside a format fence comes out byte-exact
|
|
module m;
|
|
// verilog_format: off
|
|
localparam int X = 32'h`RAW;
|
|
// verilog_format: on
|
|
localparam int Y = 32'h`RAW;
|
|
endmodule
|
|
----
|
|
module m;
|
|
// verilog_format: off
|
|
localparam int X = 32'h`RAW;
|
|
// verilog_format: on
|
|
localparam int Y = 32'h`RAW;
|
|
endmodule
|