Tests: Reindent some tests. No functional change.

This commit is contained in:
Wilson Snyder 2025-11-12 19:40:59 -05:00
parent 59bc4cf66b
commit 03e5c3b2ff
16 changed files with 320 additions and 327 deletions

View File

@ -14,7 +14,7 @@
`define stop $stop `define stop $stop
`define checkd(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got=%0d exp=%0d\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0); `define checkd(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got=%0d exp=%0d\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0);
module t (); module t;
timeunit 10ns; timeunit 10ns;
timeprecision 1ns; timeprecision 1ns;

View File

@ -4,23 +4,25 @@
// any use, without warranty, 2025 by Wilson Snyder. // any use, without warranty, 2025 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0 // SPDX-License-Identifier: CC0-1.0
`timescale 1ns/1ps `timescale 1ns / 1ps
module vip_snitch_cluster module vip_snitch_cluster #(
#(parameter realtime ClkPeriod = 10ns) parameter realtime ClkPeriod = 10ns
(output logic clk_o); ) (
output logic clk_o
);
initial begin initial begin
forever begin forever begin
clk_o = 1; clk_o = 1;
#(ClkPeriod/2); #(ClkPeriod / 2);
clk_o = 0; clk_o = 0;
#(ClkPeriod/2); #(ClkPeriod / 2);
end end
end end
initial begin initial begin
#(ClkPeriod*100); #(ClkPeriod * 100);
$write("*-* All Finished *-*\n"); $write("*-* All Finished *-*\n");
$finish; $finish;
end end
@ -30,10 +32,6 @@ endmodule
module t; module t;
logic clk; logic clk;
vip_snitch_cluster #( vip_snitch_cluster #(.ClkPeriod(1ns)) vip (.clk_o(clk));
.ClkPeriod(1ns)
) vip (
.clk_o(clk)
);
endmodule endmodule

View File

@ -4,8 +4,8 @@
// any use, without warranty, 2020 by Wilson Snyder. // any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0 // SPDX-License-Identifier: CC0-1.0
`timescale 1ns/1ps `timescale 1ns / 1ps
module t (/*AUTOARG*/ module t ( /*AUTOARG*/
// Inputs // Inputs
clk clk
); );
@ -24,7 +24,7 @@ module t (/*AUTOARG*/
ps ps (.*); ps ps (.*);
ns ns (.*); ns ns (.*);
always @ (posedge clk) begin always @(posedge clk) begin
cyc <= cyc + 1; cyc <= cyc + 1;
if (cyc == 60) begin if (cyc == 60) begin
$write("*-* All Finished *-*\n"); $write("*-* All Finished *-*\n");
@ -33,14 +33,15 @@ module t (/*AUTOARG*/
end end
endmodule endmodule
`timescale 1ps/1ps `timescale 1ps / 1ps
module ps module ps (
(input clk, input clk,
input integer cyc, input integer cyc,
input time in); input time in
);
always @ (posedge clk) begin always @(posedge clk) begin
if (cyc == 10) begin if (cyc == 10) begin
$timeformat(-9, 6, "ns", 16); $timeformat(-9, 6, "ns", 16);
$write("%m: Input time %t %d\n", in, in); $write("%m: Input time %t %d\n", in, in);
@ -48,14 +49,15 @@ module ps
end end
endmodule endmodule
`timescale 1ns/1ps `timescale 1ns / 1ps
module ns module ns (
(input clk, input clk,
input integer cyc, input integer cyc,
input time in); input time in
);
always @ (posedge clk) begin always @(posedge clk) begin
if (cyc == 20) begin if (cyc == 20) begin
$timeformat(-9, 6, "ns", 16); $timeformat(-9, 6, "ns", 16);
$write("%m: Input time %t %d\n", in, in); $write("%m: Input time %t %d\n", in, in);

View File

@ -6,8 +6,7 @@
module t; module t;
timeunit 1ns; timeunit 1ns; timeprecision 1ps;
timeprecision 1ps;
time t; time t;

View File

@ -4,17 +4,15 @@
// any use, without warranty, 2020 by Wilson Snyder. // any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0 // SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/ module t (
// Inputs input clk
clk );
);
input clk;
integer cyc = 0; integer cyc = 0;
time texpect = `TEST_EXPECT; time texpect = `TEST_EXPECT;
always @ (posedge clk) begin always @(posedge clk) begin
cyc <= cyc + 1; cyc <= cyc + 1;
if (cyc == 1) begin if (cyc == 1) begin
$printtimescale; $printtimescale;

View File

@ -4,15 +4,13 @@
// any use, without warranty, 2020 by Wilson Snyder. // any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0 // SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/ module t (
// Inputs input clk
clk );
);
input clk;
integer cyc = 0; integer cyc = 0;
always @ (posedge clk) begin always @(posedge clk) begin
cyc <= cyc + 1; cyc <= cyc + 1;
if (cyc == 1) begin if (cyc == 1) begin
$write("[%0t] In %m: Hi\n", $time); $write("[%0t] In %m: Hi\n", $time);
@ -20,6 +18,6 @@ module t (/*AUTOARG*/
$write("*-* All Finished *-*\n"); $write("*-* All Finished *-*\n");
$finish; $finish;
end end
end end
endmodule endmodule

View File

@ -4,13 +4,14 @@
// any use, without warranty, 2022 by Wilson Snyder. // any use, without warranty, 2022 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0 // SPDX-License-Identifier: CC0-1.0
// verilog_format: off
`define stop $stop `define stop $stop
`define checkd(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got=%0d exp=%0d\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0); `define checkd(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got=%0d exp=%0d\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0);
// verilog_format: on
module t; module t;
timeunit 1ns; timeunit 1ns; timeprecision 1ps;
timeprecision 1ps;
initial begin initial begin
`checkd($timeunit, -9); `checkd($timeunit, -9);

View File

@ -8,11 +8,9 @@
import "DPI-C" function void dpii_check(); import "DPI-C" function void dpii_check();
module t (/*AUTOARG*/ module t (
// Inputs input clk
clk
); );
input clk;
integer cyc = 0; integer cyc = 0;
// verilator lint_off REALCVT // verilator lint_off REALCVT
@ -48,6 +46,6 @@ module t (/*AUTOARG*/
$write("*-* All Finished *-*\n"); $write("*-* All Finished *-*\n");
$finish; $finish;
end end
end end
endmodule endmodule

View File

@ -7,11 +7,11 @@
module pre_no_ts; module pre_no_ts;
endmodule endmodule
`timescale 1ns/1ns `timescale 1ns / 1ns
module t; module t;
pre_no_ts pre_no_ts(); pre_no_ts pre_no_ts ();
post_no_ts pst_no_ts(); post_no_ts pst_no_ts ();
endmodule endmodule
module post_no_ts; module post_no_ts;

View File

@ -17,10 +17,10 @@
%Error: t/t_timescale_parse_bad.v:15:1: `timescale syntax error: ' 1ns / 1ps /extra' %Error: t/t_timescale_parse_bad.v:15:1: `timescale syntax error: ' 1ns / 1ps /extra'
15 | `timescale 1ns / 1ps /extra 15 | `timescale 1ns / 1ps /extra
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
%Error: t/t_timescale_parse_bad.v:18:13: timeunit illegal value %Error: t/t_timescale_parse_bad.v:18:12: timeunit illegal value
18 | timeunit 2ps; 18 | timeunit 2ps;
| ^~~ | ^~~
%Error: t/t_timescale_parse_bad.v:19:18: timeprecision illegal value %Error: t/t_timescale_parse_bad.v:19:17: timeprecision illegal value
19 | timeprecision 2ps; 19 | timeprecision 2ps;
| ^~~ | ^~~
%Error: Exiting due to %Error: Exiting due to

View File

@ -4,8 +4,7 @@
// any use, without warranty, 2021 by Wilson Snyder. // any use, without warranty, 2021 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0 // SPDX-License-Identifier: CC0-1.0
timeunit 10ps; timeunit 10ps; timeprecision 10ps;
timeprecision 10ps;
task show; task show;
$printtimescale; $printtimescale;
@ -18,7 +17,7 @@ module from_unit;
endmodule endmodule
module t; module t;
from_unit from_unit(); from_unit from_unit ();
timeunit 100ps; timeunit 100ps;
initial begin initial begin
show(); show();