ppTests Add tests from LRM, but don't run them yet.

This commit is contained in:
damc 2022-07-21 10:52:43 +02:00
parent 9a254105c6
commit 93f305c448
12 changed files with 160 additions and 0 deletions

View File

@ -0,0 +1,10 @@
/* IEEE1800-2017 Clause 22.5.1 page 679
*/
`define max(a,b)((a) > (b) ? (a) : (b))
`define TOP(a,b) a + b
module m;
assign n = `max(p+q, r+s) ;
assign z = `TOP( `TOP(b,1), `TOP(42,a) );
endmodule

View File

@ -0,0 +1,7 @@
/* IEEE1800-2017 Clause 22.5.1 page 680
*/
`define append(f) f``_master
module `append(clock);
endmodule

View File

@ -0,0 +1,10 @@
/* IEEE1800-2017 Clause 22.5.1 page 680
*/
`define msg(x,y) `"x: `\`"y`\`"`"
module a;
initial begin
$display(`msg(left side,right side));
end
endmodule

View File

@ -0,0 +1,13 @@
/* IEEE1800-2017 Clause 22.5.1 page 679
*/
module main;
`define HI Hello
`define LO "`HI, world"
`define H(x) "Hello, x"
initial begin
$display("`HI, world");
$display(`LO);
$display(`H(world));
end
endmodule

View File

@ -0,0 +1,25 @@
/* IEEE1800-2017 Clause 22.5.1 page 678
* NOTE: Illegal cases are not included in this testcase.
* NOTE: Use of EMPTY is suggested on page 679
*/
`define MACRO1(a=5,b="B",c) $display(a,,b,,c);
`define MACRO2(a=5, b, c="C") $display(a,,b,,c);
`define MACRO3(a=5, b=0, c="C") $display(a,,b,,c);
`define EMPTY
module m;
initial begin
`MACRO1 ( , 2, 3 )
`MACRO1 ( 1 , , 3 )
`MACRO1 ( , 2, )
`MACRO2 (1, , 3)
`MACRO2 (, 2, )
`MACRO2 (, 2)
`MACRO3 ( 1 )
`MACRO3 ( )
`MACRO3 (`EMPTY,`EMPTY,`EMPTY)
end
endmodule

View File

@ -0,0 +1,15 @@
/* IEEE1800-2017 Clause 22.5.1 page 677
* NOTE: Illegal cases are not included in this testcase.
*/
`define D(x,y) initial $display("start", x , y, "end");
module m;
initial begin
`D( "msg1" , "msg2" )
`D( " msg1", )
`D(, "msg2 ")
`D(,)
`D( , )
end
endmodule

View File

@ -0,0 +1,10 @@
/* IEEE1800-2017 Clause 22.5.1 page 679
*/
`define max(a,b)((a) > (b) ? (a) : (b))
`define TOP(a,b) a + b
module m;
assign n = ((p+q) > (r+s) ? (p+q) : (r+s)) ;
assign z = b + 1 + 42 + a;
endmodule

View File

@ -0,0 +1,7 @@
/* IEEE1800-2017 Clause 22.5.1 page 680
*/
`define append(f) f``_master
module clock_master;
endmodule

View File

@ -0,0 +1,10 @@
/* IEEE1800-2017 Clause 22.5.1 page 680
*/
`define msg(x,y) `"x: `\`"y`\`"`"
module a;
initial begin
$display("left side: \"right side\"");
end
endmodule

View File

@ -0,0 +1,13 @@
/* IEEE1800-2017 Clause 22.5.1 page 679
*/
module main;
`define HI Hello
`define LO "`HI, world"
`define H(x) "Hello, x"
initial begin
$display("`HI, world");
$display("`HI, world");
$display("Hello, x");
end
endmodule

View File

@ -0,0 +1,25 @@
/* IEEE1800-2017 Clause 22.5.1 page 678
* NOTE: Illegal cases are not included in this testcase.
* NOTE: Use of EMPTY is suggested on page 679
*/
`define MACRO1(a=5,b="B",c) $display(a,,b,,c);
`define MACRO2(a=5, b, c="C") $display(a,,b,,c);
`define MACRO3(a=5, b=0, c="C") $display(a,,b,,c);
`define EMPTY
module m;
initial begin
$display(5,,2,,3);
$display(1,,"B",,3);
$display(5,,2,,);
$display(1,,,,3);
$display(5,,2,,"C");
$display(5,,2,,"C");
$display(1,,0,,"C");
$display(5,,0,,"C");
$display(,,,,);
end
endmodule

View File

@ -0,0 +1,15 @@
/* IEEE1800-2017 Clause 22.5.1 page 677
* NOTE: Illegal cases are not included in this testcase.
*/
`define D(x,y) initial $display("start", x , y, "end");
module m;
initial begin
$display("start", "msg1" , "msg2", "end");
$display("start", " msg1" , , "end");
$display("start", , "msg2 ", "end");
$display("start", , , "end");
$display("start", , , "end");
end
endmodule