mirror of
https://github.com/verilator/verilator.git
synced 2025-04-16 01:26:54 +00:00
Support --trace-fst for SystemC with CMake (#2927)
This commit is contained in:
parent
5e56f4d11b
commit
37d68d39c8
@ -169,11 +169,6 @@ class CMakeEmitter final {
|
||||
global.emplace_back("${VERILATOR_ROOT}/include/" + v3Global.opt.traceSourceBase()
|
||||
+ "_c.cpp");
|
||||
if (v3Global.opt.systemC()) {
|
||||
if (v3Global.opt.traceFormat() != TraceFormat::VCD) {
|
||||
v3warn(E_UNSUPPORTED,
|
||||
"Unsupported: This trace format is not supported in SystemC, "
|
||||
"use VCD format.");
|
||||
}
|
||||
global.emplace_back("${VERILATOR_ROOT}/include/" + v3Global.opt.traceSourceLang()
|
||||
+ ".cpp");
|
||||
}
|
||||
|
1824
test_regress/t/t_trace_fst_sc_cmake.out
Normal file
1824
test_regress/t/t_trace_fst_sc_cmake.out
Normal file
File diff suppressed because it is too large
Load Diff
31
test_regress/t/t_trace_fst_sc_cmake.pl
Executable file
31
test_regress/t/t_trace_fst_sc_cmake.pl
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env perl
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2020 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
|
||||
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
|
||||
scenarios(vlt_all => 1);
|
||||
|
||||
if (!$Self->have_sc) {
|
||||
skip("No SystemC installed");
|
||||
}
|
||||
else {
|
||||
compile(
|
||||
verilator_flags2 => ["--trace-fst --sc"],
|
||||
verilator_make_gmake => 0,
|
||||
verilator_make_cmake => 1,
|
||||
);
|
||||
|
||||
execute(
|
||||
check_finished => 1,
|
||||
);
|
||||
|
||||
fst_identical($Self->trace_filename, $Self->{golden_filename});
|
||||
}
|
||||
ok(1);
|
||||
1;
|
98
test_regress/t/t_trace_fst_sc_cmake.v
Normal file
98
test_regress/t/t_trace_fst_sc_cmake.v
Normal file
@ -0,0 +1,98 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// Author: Yu-Sheng Lin johnjohnlys@media.ee.ntu.edu.tw
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
module t (/*AUTOARG*/
|
||||
// Inputs
|
||||
clk
|
||||
);
|
||||
|
||||
input clk;
|
||||
|
||||
int cyc;
|
||||
reg rstn;
|
||||
|
||||
parameter real fst_gparam_real = 1.23;
|
||||
localparam real fst_lparam_real = 4.56;
|
||||
real fst_real = 1.23;
|
||||
integer fst_integer;
|
||||
bit fst_bit;
|
||||
logic fst_logic;
|
||||
int fst_int;
|
||||
shortint fst_shortint;
|
||||
longint fst_longint;
|
||||
byte fst_byte;
|
||||
|
||||
parameter fst_parameter = 123;
|
||||
localparam fst_lparam = 456;
|
||||
supply0 fst_supply0;
|
||||
supply1 fst_supply1;
|
||||
tri0 fst_tri0;
|
||||
tri1 fst_tri1;
|
||||
tri fst_tri;
|
||||
wire fst_wire;
|
||||
|
||||
logic [4:0] state;
|
||||
|
||||
Test test (/*AUTOINST*/
|
||||
// Outputs
|
||||
.state (state[4:0]),
|
||||
// Inputs
|
||||
.clk (clk),
|
||||
.rstn (rstn));
|
||||
|
||||
// Test loop
|
||||
always @ (posedge clk) begin
|
||||
cyc <= cyc + 1;
|
||||
if (cyc==0) begin
|
||||
// Setup
|
||||
rstn <= ~'1;
|
||||
end
|
||||
else if (cyc<10) begin
|
||||
rstn <= ~'1;
|
||||
end
|
||||
else if (cyc<90) begin
|
||||
rstn <= ~'0;
|
||||
end
|
||||
else if (cyc==99) begin
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
|
||||
module Test (
|
||||
input clk,
|
||||
input rstn,
|
||||
output logic [4:0] state
|
||||
);
|
||||
|
||||
logic [4:0] state_w;
|
||||
logic [4:0] state_array [3];
|
||||
assign state = state_array[0];
|
||||
|
||||
always_comb begin
|
||||
state_w[4] = state_array[2][0];
|
||||
state_w[3] = state_array[2][4];
|
||||
state_w[2] = state_array[2][3] ^ state_array[2][0];
|
||||
state_w[1] = state_array[2][2];
|
||||
state_w[0] = state_array[2][1];
|
||||
end
|
||||
|
||||
always_ff @(posedge clk or negedge rstn) begin
|
||||
if (!rstn) begin
|
||||
for (int i = 0; i < 3; i++)
|
||||
state_array[i] <= 'b1;
|
||||
end
|
||||
else begin
|
||||
for (int i = 0; i < 2; i++)
|
||||
state_array[i] <= state_array[i+1];
|
||||
state_array[2] <= state_w;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
Loading…
Reference in New Issue
Block a user