Skip to content

Commit

Permalink
Merge pull request #3899 from Apotell/dupsrcs
Browse files Browse the repository at this point in the history
Prevent duplicating sources
  • Loading branch information
alaindargelas authored Oct 9, 2023
2 parents 37cf83f + 62c1ee8 commit 6f499b0
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 202 deletions.
1 change: 1 addition & 0 deletions include/Surelog/CommandLine/CommandLineParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ class CommandLineParser final {
PathIdVector m_workingDirs;
PathIdVector m_libraryPaths; // -y
PathIdVector m_sourceFiles; // .v .sv
PathIdSet m_sourceFileSet;
PathIdSet m_svSourceFiles; // user forced sv files
PathIdVector m_libraryFiles; // -v
PathIdVector m_includePaths; // +incdir+
Expand Down
28 changes: 17 additions & 11 deletions src/CommandLine/CommandLineParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1385,12 +1385,15 @@ bool CommandLineParser::parseCommandLine(int32_t argc, const char** argv) {
if (filepath.is_relative()) filepath = cd / filepath;
const PathId fileId =
fileSystem->toPathId(filepath.string(), m_symbolTable);
m_sourceFiles.emplace_back(fileId);
m_svSourceFiles.emplace(fileId);
PathId dirId = fileSystem->getParent(fileId, m_symbolTable);
if (m_includePathSet.find(dirId) == m_includePathSet.end()) {
m_includePathSet.emplace(dirId);
m_includePaths.emplace_back(dirId);
if (m_sourceFileSet.find(fileId) == m_sourceFileSet.end()) {
m_sourceFiles.emplace_back(fileId);
m_sourceFileSet.emplace(fileId);
m_svSourceFiles.emplace(fileId);
PathId dirId = fileSystem->getParent(fileId, m_symbolTable);
if (m_includePathSet.find(dirId) == m_includePathSet.end()) {
m_includePathSet.emplace(dirId);
m_includePaths.emplace_back(dirId);
}
}
} else {
m_sverilog = true;
Expand Down Expand Up @@ -1425,11 +1428,14 @@ bool CommandLineParser::parseCommandLine(int32_t argc, const char** argv) {
if (filepath.is_relative()) filepath = cd / filepath;
const PathId fileId =
fileSystem->toPathId(filepath.string(), m_symbolTable);
m_sourceFiles.emplace_back(fileId);
PathId dirId = fileSystem->getParent(fileId, m_symbolTable);
if (m_includePathSet.find(dirId) == m_includePathSet.end()) {
m_includePathSet.emplace(dirId);
m_includePaths.emplace_back(dirId);
if (m_sourceFileSet.find(fileId) == m_sourceFileSet.end()) {
m_sourceFiles.emplace_back(fileId);
m_sourceFileSet.emplace(fileId);
PathId dirId = fileSystem->getParent(fileId, m_symbolTable);
if (m_includePathSet.find(dirId) == m_includePathSet.end()) {
m_includePathSet.emplace(dirId);
m_includePaths.emplace_back(dirId);
}
}
}
}
Expand Down
28 changes: 12 additions & 16 deletions third_party/tests/IncompTitan/IncompTitan.log
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
[INF:PP0122] Preprocessing source file "${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_systems_top_earlgrey_0.1/rtl/autogen/top_earlgrey_rnd_cnst_pkg.sv".
[INF:PP0122] Preprocessing source file "${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_systems_top_earlgrey_pkg_0.1/rtl/autogen/top_earlgrey_pkg.sv".
[INF:PP0122] Preprocessing source file "${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_ip_usbdev_0.1/rtl/usbdev_reg_pkg.sv".
[INF:PP0122] Preprocessing source file "${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_top_earlgrey_xbar_main_0.1/rtl/autogen/tl_main_pkg.sv".
[INF:PP0122] Preprocessing source file "${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_top_earlgrey_xbar_peri_0.1/rtl/autogen/tl_peri_pkg.sv".
[INF:PP0122] Preprocessing source file "${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_ip_rv_core_ibex_pkg_0.1/rtl/rv_core_ibex_pkg.sv".
[INF:PP0122] Preprocessing source file "${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_prim_generic_flop_0/rtl/prim_generic_flop.sv".
Expand Down Expand Up @@ -175,8 +174,6 @@
[INF:PA0201] Parsing source file "${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_systems_top_earlgrey_0.1/rtl/autogen/top_earlgrey_rnd_cnst_pkg.sv".
[INF:PA0201] Parsing source file "${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_systems_top_earlgrey_pkg_0.1/rtl/autogen/top_earlgrey_pkg.sv".
[INF:PA0201] Parsing source file "${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_ip_usbdev_0.1/rtl/usbdev_reg_pkg.sv".
[INF:PA0201] Parsing source file "${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_top_earlgrey_xbar_main_0.1/rtl/autogen/tl_main_pkg.sv".
PARSER CACHE USED FOR: ${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_top_earlgrey_xbar_main_0.1/rtl/autogen/tl_main_pkg.sv
[INF:PA0201] Parsing source file "${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_top_earlgrey_xbar_peri_0.1/rtl/autogen/tl_peri_pkg.sv".
[INF:PA0201] Parsing source file "${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_ip_rv_core_ibex_pkg_0.1/rtl/rv_core_ibex_pkg.sv".
[INF:PA0201] Parsing source file "${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_prim_generic_flop_0/rtl/prim_generic_flop.sv".
Expand Down Expand Up @@ -488,7 +485,6 @@ PARSER CACHE USED FOR: ${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_
[INF:CP0301] ${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_systems_top_earlgrey_0.1/rtl/autogen/top_earlgrey_rnd_cnst_pkg.sv:14:1: Compile package "top_earlgrey_rnd_cnst_pkg".
[INF:CP0301] ${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_systems_top_earlgrey_pkg_0.1/rtl/autogen/top_earlgrey_pkg.sv:13:1: Compile package "top_earlgrey_pkg".
[INF:CP0301] ${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_ip_usbdev_0.1/rtl/usbdev_reg_pkg.sv:7:1: Compile package "usbdev_reg_pkg".
[INF:CP0301] ${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_top_earlgrey_xbar_main_0.1/rtl/autogen/tl_main_pkg.sv:7:1: Compile package "tl_main_pkg".
[INF:CP0301] ${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_top_earlgrey_xbar_peri_0.1/rtl/autogen/tl_peri_pkg.sv:7:1: Compile package "tl_peri_pkg".
[INF:CP0301] ${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_ip_rv_core_ibex_pkg_0.1/rtl/rv_core_ibex_pkg.sv:6:1: Compile package "rv_core_ibex_pkg".
[INF:CP0301] ${SURELOG_DIR}/third_party/tests/IncompTitan/src/lowrisc_ibex_ibex_pkg_0.1/rtl/ibex_pkg.sv:9:1: Compile package "ibex_pkg".
Expand Down Expand Up @@ -5341,12 +5337,12 @@ case_stmt 117
class_defn 8
class_typespec 4
class_var 3
constant 403795
constant 403123
cont_assign 18019
cover 20
design 1
enum_const 5693
enum_typespec 1478
enum_const 5649
enum_typespec 1474
enum_var 133
event_control 223
final_stmt 513
Expand All @@ -5366,33 +5362,33 @@ import_typespec 92
include_file_info 70
indexed_part_select 830
initial 64
int_typespec 16913
int_typespec 16901
int_var 587
integer_typespec 226
integer_var 8
io_decl 273
logic_net 35503
logic_typespec 99642
logic_typespec 99490
logic_var 12596
module_inst 10360
module_inst 10358
named_begin 395
operation 103325
package 94
operation 103313
package 92
packed_array_net 8
packed_array_typespec 241
packed_array_var 12
param_assign 32179
parameter 36666
param_assign 32019
parameter 36506
part_select 2009
port 54477
prop_formal_decl 3
property_decl 1
property_inst 4
property_spec 479
range 75392
range 75232
ref_module 2376
ref_obj 166321
ref_typespec 168170
ref_typespec 167850
ref_var 74
return_stmt 137
sequence_decl 36
Expand Down
Loading

0 comments on commit 6f499b0

Please sign in to comment.