File: t_lib_prot_clk_gated.py

package info (click to toggle)
verilator 5.038-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 162,552 kB
  • sloc: cpp: 139,204; python: 20,931; ansic: 10,222; yacc: 6,000; lex: 1,925; makefile: 1,260; sh: 494; perl: 282; fortran: 22
file content (58 lines) | stat: -rwxr-xr-x 1,981 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/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', 'xsim')
test.top_filename = "t/t_lib_prot.v"

if test.benchmark:
    test.sim_time = test.benchmark * 100

trace_opt = ""

secret_prefix = "secret"
secret_dir = test.obj_dir + "/" + secret_prefix
test.mkdir_ok(secret_dir)

# Always compile the secret file with Verilator no matter what simulator
#   we are testing with
test.run(
    logfile=secret_dir + "/vlt_compile.log",
    cmd=["perl", os.environ["VERILATOR_ROOT"] + "/bin/verilator",
         '--no-timing',
         trace_opt,
         "--prefix", "Vt_lib_prot_secret",
         "-cc",
         "-Mdir", secret_dir,
         "-GGATED_CLK=1",
         "--protect-lib", secret_prefix,
         "--protect-key", "secret-key",
         "t/t_lib_prot_secret.v"],
    verilator_run=True)  # yapf:disable

test.run(logfile=secret_dir + "/secret_gcc.log",
         cmd=[os.environ["MAKE"], "-C", secret_dir, "-f", "Vt_lib_prot_secret.mk"])

test.compile(verilator_flags2=['--no-timing',
                               trace_opt,
                               "-GGATED_CLK=1",
                               "-LDFLAGS", secret_prefix + "/libsecret.a",
                               secret_dir + "/secret.sv"],
             xsim_flags2=[secret_dir + "/secret.sv"])  # yapf:disable

test.execute(xsim_run_flags2=["--sv_lib", secret_dir + "/libsecret", "--dpi_absolute"])

if test.vlt and test.trace:
    # We can see the ports of the secret module
    test.file_grep(test.trace_filename, r'accum_in')
    # but we can't see what's inside
    test.file_grep_not(test.trace_filename, r'secret_')

test.passes()