[#72179] wip: adding tests similar to those for FST

This commit is contained in:
Mateusz Gancarz 2025-02-12 08:41:54 +01:00
parent 431a6de442
commit 767ee6b2e5
48 changed files with 1111 additions and 11 deletions

View File

@ -2368,6 +2368,10 @@ class VlTest:
self.fst2vcd(fn1, tmp)
self.vcd_identical(tmp, fn2)
def saif_identical(self, fn1: str, fn2: str) -> None:
"""Test if two SAIF files have logically-identical contents"""
#TODO: implement checking if two SAIF file are logically-identical
def _vcd_read(self, filename: str) -> str:
data = {}
with open(filename, 'r', encoding='latin-1') as fh:

View File

@ -0,0 +1,39 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt_all')
test.top_filename = "t/t_hier_block.v"
# stats will be deleted but generation will be skipped if libs of hierarchical blocks exist.
test.clean_objs()
# CI environment offers 2 VCPUs, 2 thread setting causes the following warning.
# %Warning-UNOPTTHREADS: Thread scheduler is unable to provide requested parallelism; consider asking for fewer threads.
# So use 6 threads here though it's not optimal in performance, but ok.
test.compile(v_flags2=['t/t_hier_block.cpp'],
verilator_flags2=[
'--sc', '--stats', '--hierarchical', '--CFLAGS', '"-pipe -DCPP_MACRO=cplusplus"',
"--CFLAGS", '"-O0 -ggdb"', "--trace-saif"
],
threads=(6 if test.vltmt else 1))
test.execute()
test.file_grep(test.obj_dir + "/Vsub0/sub0.sv", r'^module\s+(\S+)\s+', "sub0")
test.file_grep(test.obj_dir + "/Vsub1/sub1.sv", r'^module\s+(\S+)\s+', "sub1")
test.file_grep(test.obj_dir + "/Vsub2/sub2.sv", r'^module\s+(\S+)\s+', "sub2")
test.file_grep(test.stats, r'HierBlock,\s+Hierarchical blocks\s+(\d+)', 14)
test.file_grep(test.run_log_filename, r'MACRO:(\S+) is defined', "cplusplus")
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,33 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt_all')
test.top_filename = "t/t_hier_block.v"
# CI environment offers 2 VCPUs, 2 thread setting causes the following warning.
# %Warning-UNOPTTHREADS: Thread scheduler is unable to provide requested parallelism; consider asking for fewer threads.
# So use 6 threads here though it's not optimal in performance, but ok.
test.compile(
v_flags2=['t/t_hier_block.cpp'],
verilator_flags2=[
'--hierarchical',
'--Wno-TIMESCALEMOD',
'--trace-saif',
'--no-trace-underscore', # To avoid handle mismatches
],
threads=(6 if test.vltmt else 1))
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_interface_ref_trace.v"
test.compile(verilator_flags2=['--trace-structs --trace-saif'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,23 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_interface_ref_trace.v"
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(verilator_flags2=['--trace-structs --trace-saif --sc'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_timing_trace.v"
test.compile(verilator_flags2=["--exe --main --timing --trace-saif -Wno-MINTYPMAXDLY"])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt_all')
test.top_filename = "t/t_trace_abort.v"
test.compile(verilator_flags2=['--cc --trace-saif'])
test.execute(fails=True)
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt_all')
test.top_filename = "t/t_trace_abort.v"
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(verilator_flags2=['--sc --trace-saif'])
test.execute(fails=True)
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test module
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2025 by Antmicro. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
@ -12,11 +12,10 @@ import vltest_bootstrap
test.scenarios('vlt')
test.top_filename = "t/t_trace_array.v"
test.compile(verilator_flags2=['--trace-saif --trace-structs'])
test.compile(verilator_flags2=['--cc --trace-saif --trace-structs'])
test.execute()
#TODO: add checking if two SAIF files are identical
#test.saif_identical(test.trace_filename, test.golden_filename)
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt')
test.top_filename = "t/t_trace_array.v"
test.golden_filename = "t/t_trace_array_fst.out"
test.compile(verilator_flags2=['--cc --trace-saif --trace-structs', '-CFLAGS -DVL_PORTABLE_ONLY'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,25 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt')
test.top_filename = "t/t_trace_array.v"
test.golden_filename = "t/t_trace_array_fst_sc.out"
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(verilator_flags2=['--sc --trace-saif --trace-structs', '-CFLAGS -DVL_PORTABLE_ONLY'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt')
test.top_filename = "t/t_trace_array.v"
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(verilator_flags2=['--sc --trace-saif --trace-structs'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt')
test.top_filename = "t/t_trace_array.v"
test.golden_filename = "t/t_trace_array_fst.out"
test.compile(verilator_flags2=['--cc --trace-saif --trace-threads 1 --trace-structs'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,25 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt')
test.top_filename = "t/t_trace_array.v"
test.golden_filename = "t/t_trace_array_fst_sc.out"
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(verilator_flags2=['--sc --trace-saif --trace-threads 1 --trace-structs'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt')
test.top_filename = "t/t_trace_array.v"
test.golden_filename = "t/t_trace_array_fst.out"
test.compile(verilator_flags2=['--cc --trace-saif --trace-threads 2 --trace-structs'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,25 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt')
test.top_filename = "t/t_trace_array.v"
test.golden_filename = "t/t_trace_array_fst_sc.out"
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(verilator_flags2=['--sc --trace-saif --trace-threads 2 --trace-structs'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,25 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_ascendingrange.v"
# CI environment offers 2 VCPUs, 2 thread setting causes the following warning.
# %Warning-UNOPTTHREADS: Thread scheduler is unable to provide requested parallelism; consider asking for fewer threads.
# Strangely, asking for more threads makes it go away.
test.compile(verilator_flags2=['--cc --trace-saif --trace-params -Wno-ASCRANGE'],
threads=(6 if test.vltmt else 1))
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,28 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_ascendingrange.v"
if not test.have_sc:
test.skip("No SystemC installed")
# CI environment offers 2 VCPUs, 2 thread setting causes the following warning.
# %Warning-UNOPTTHREADS: Thread scheduler is unable to provide requested parallelism; consider asking for fewer threads.
# Strangely, asking for more threads makes it go away.
test.compile(verilator_flags2=['--sc --trace-saif --trace-params -Wno-ASCRANGE'],
threads=(6 if test.vltmt else 1))
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,23 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt_all')
test.compile(make_top_shell=False,
make_main=False,
v_flags2=["--trace-saif --exe", test.pli_filename])
test.execute()
test.saif_identical(test.obj_dir + "/simpart_0000.fst", "t/" + test.name + "_0000.out")
test.saif_identical(test.obj_dir + "/simpart_0100.fst", "t/" + test.name + "_0100.out")
test.passes()

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_complex.v"
test.compile(verilator_flags2=['--cc --trace-saif --no-trace-structs --trace-params'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_complex.v"
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(verilator_flags2=['--sc --trace-saif --no-trace-structs --trace-params'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_complex.v"
test.compile(verilator_flags2=['--cc --trace-saif'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_complex.v"
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(verilator_flags2=['--sc --trace-saif'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_complex.v"
test.golden_filename = "t/t_trace_complex_fst.out"
test.compile(verilator_flags2=['--cc --trace-saif --trace-threads 1'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,25 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_complex.v"
test.golden_filename = "t/t_trace_complex_fst_sc.out"
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(verilator_flags2=['--sc --trace-saif --trace-threads 1'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_complex.v"
test.golden_filename = "t/t_trace_complex_fst.out"
test.compile(verilator_flags2=['--cc --trace-saif --trace-threads 2'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,25 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_complex.v"
test.golden_filename = "t/t_trace_complex_fst_sc.out"
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(verilator_flags2=['--sc --trace-saif --trace-threads 2'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_complex.v"
test.compile(verilator_flags2=['--cc --trace-saif --trace-structs --no-trace-params'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_complex.v"
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(verilator_flags2=['--sc --trace-saif --trace-structs --no-trace-params'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt_all')
test.pli_filename = "t/t_trace_dumpvars_dyn.cpp"
test.top_filename = "t/t_trace_dumpvars_dyn.v"
test.compile(make_main=False, verilator_flags2=["--trace-saif --exe", test.pli_filename])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt_all')
test.pli_filename = "t/t_trace_dumpvars_dyn.cpp"
test.top_filename = "t/t_trace_dumpvars_dyn.v"
test.compile(make_main=False, verilator_flags2=["--trace-saif --exe", test.pli_filename])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,29 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_enum.v"
test.compile(verilator_flags2=['--cc --trace-saif --output-split-ctrace 1'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
# Five $attrbegin expected:
# - state_t declaration
# - t.v_enumed
# - t.sink.state
# - other_state_t declaration
# - t.v_other_enumed
test.file_grep_count(test.golden_filename, r'attrbegin', 5)
test.passes()

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt')
test.top_filename = "t/t_trace_event.v"
test.compile(verilator_flags2=['--trace-saif --binary'])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt')
test.pli_filename = "t/t_trace_no_top_name2.cpp"
test.top_filename = "t/t_trace_no_top_name2.v"
test.compile(make_main=False, verilator_flags2=["--trace-saif --exe", test.pli_filename])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_packed_struct.v"
test.compile(v_flags2=["--trace-saif"])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_packed_struct.v"
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(v_flags2=["--sc --trace-saif"])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,19 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt_all')
test.top_filename = "t/t_trace_param.v"
test.compile(v_flags2=["--trace-saif"])
test.execute()
test.passes()

View File

@ -0,0 +1,19 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_primitive.v"
test.compile(v_flags2=["--trace-saif"])
test.execute()
test.passes()

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_primitive.v"
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(v_flags2=["--sc --trace-saif"])
test.execute()
test.passes()

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test module
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2025 by Antmicro. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
@ -15,7 +15,6 @@ test.compile(v_flags2=["--trace-saif"])
test.execute()
#TODO: add checking if two SAIF files are identical
#test.saif_identical(test.trace_filename, test.golden_filename)
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,20 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt_all')
test.compile(v_flags2=["--trace-saif"], verilator_make_gmake=False, verilator_make_cmake=1)
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,23 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt_all')
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(verilator_flags2=["--trace-saif --sc"])
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,25 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('vlt_all')
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(verilator_flags2=["--trace-saif --sc"],
verilator_make_gmake=False,
verilator_make_cmake=1)
test.execute()
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,19 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_string.v"
test.compile(verilator_flags2=['--cc --trace'])
test.execute()
test.passes()

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_trace_string.v"
if not test.have_sc:
test.skip("No SystemC installed")
test.compile(verilator_flags2=['--sc --trace'])
test.execute()
test.passes()

View File

@ -0,0 +1,38 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# Test tracing with two models instanced
import vltest_bootstrap
test.scenarios('vlt_all')
test.top_filename = "t_trace_two_a.v"
test.compile(make_main=False,
verilator_make_gmake=False,
top_filename='t_trace_two_b.v',
vm_prefix='Vt_trace_two_b',
verilator_flags2=['--trace-saif --trace-threads 1 -DTEST_FST'])
test.run(logfile=test.obj_dir + "/make_first_ALL.log",
cmd=["make", "-C", test.obj_dir, "-f", "Vt_trace_two_b.mk", "Vt_trace_two_b__ALL.cpp"])
test.compile(make_main=False,
top_filename='t_trace_two_a.v',
verilator_flags2=[
'-exe', '--trace-saif --trace-threads 1', '-DTEST_FST',
test.t_dir + "/t_trace_two_cc.cpp"
],
v_flags2=['+define+TEST_DUMP'])
test.execute()
if test.vlt_all:
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,39 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# Test tracing with two models instanced
import vltest_bootstrap
test.scenarios('vlt_all')
test.top_filename = "t_trace_two_a.v"
test.compile(make_main=False,
verilator_make_gmake=False,
top_filename='t_trace_two_b.v',
vm_prefix='Vt_trace_two_b',
verilator_flags2=['--trace-saif --trace-threads 1'])
test.run(
logfile=test.obj_dir + "/make_first_ALL.log",
cmd=["make", "-C", "" + test.obj_dir, "-f", "Vt_trace_two_b.mk", "Vt_trace_two_b__ALL.cpp"])
test.compile(make_main=False,
top_filename='t_trace_two_a.v',
make_flags=['CPPFLAGS_ADD="-DTEST_HDR_TRACE=1 -DTEST_FST=1"'],
verilator_flags2=[
'-exe', '--trace-saif --trace-threads 1', '-DTEST_FST',
test.t_dir + "/t_trace_two_cc.cpp"
])
test.execute()
if test.vlt_all:
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()

View File

@ -0,0 +1,39 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# Test tracing with two models instanced
import vltest_bootstrap
test.scenarios('vlt_all')
test.top_filename = "t_trace_two_a.v"
test.compile(make_main=False,
verilator_make_gmake=False,
top_filename='t_trace_two_b.v',
vm_prefix='Vt_trace_two_b',
verilator_flags2=['--trace-saif --trace-threads 1'])
test.run(
logfile=test.obj_dir + "/make_first_ALL.log",
cmd=["make", "-C", "" + test.obj_dir, "-f", "Vt_trace_two_b.mk", "Vt_trace_two_b__ALL.cpp"])
test.compile(make_main=False,
top_filename='t_trace_two_a.v',
verilator_flags2=[
'-exe', '--trace-saif --trace-threads 1', '-DTEST_FST',
test.t_dir + "/t_trace_two_cc.cpp"
],
v_flags2=['+define+TEST_DUMPPORTS'])
test.execute()
if test.vlt_all:
test.saif_identical(test.trace_filename, test.golden_filename)
test.passes()