Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test
on:
push:

jobs:
build_and_test:
name: "Build and Test"
strategy:
fail-fast: false
matrix:
runner: [ubuntu-24.04, macos-15]
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
# No need to install dependencies — only Ninja and CMake are needed,
# slang CMakeLists.txt fetch the rest.
#
# https://github.com/actions/runner-images
- name: Build
run: |
rm -rf ./build
mkdir -p ./build
cd ./build
cmake -G Ninja ..
ninja
- name: Test
run: |
cd ./build
ctest
31 changes: 14 additions & 17 deletions src/driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -429,28 +429,25 @@ void prunefl::Driver::write_output_flags() const {

// defines
for (auto &define : options.defines) {
output_flags.insert(std::string("+define+") + define);
output_flags.insert(fmt::format("+define+{}", define));
}

// include search directories
for (auto &file : result_includes) {
output_flags.insert(
std::string("+incdir+") + file.parent_path().string()
fmt::format("+incdir+{}", file.parent_path().string())
);
}

// module search directories
for (auto &dir : sourceLoader.getSearchDirectories()) {
output_flags.insert(std::string("-y ") + dir.string());
output_flags.insert(fmt::format("-y {}", dir.string()));
}

// module search extensions
if (verific_compat_mode) {
output_flags.insert(std::string("+libext+"));
} else {
for (auto &ext : sourceLoader.getSearchExtensions()) {
output_flags.insert(std::string("-Y ") + ext.string());
}
std::string_view libext_pfx = verific_compat_mode ? "+libext+" : "-Y ";
for (auto &ext : sourceLoader.getSearchExtensions()) {
output_flags.insert(fmt::format("{}{}", libext_pfx, ext.string()));
Comment thread
donn marked this conversation as resolved.
}

// library files
Expand All @@ -465,14 +462,14 @@ void prunefl::Driver::write_output_flags() const {
}

// input command file
if (verific_compat_mode) {
// verific is single-unit by default, so -C doesn't matter
output_flags.insert(fmt::format("-f {}", fs::absolute(*output).c_str())
);
} else {
output_flags.insert(fmt::format("-C {}", fs::absolute(*output).c_str())
);
}
std::string_view cmdfile_pfx =
verific_compat_mode
? "-f " // verific is single-unit by default, so -C doesn't matter
: "-C ";

output_flags.insert(
fmt::format("{}{}", cmdfile_pfx, fs::absolute(*output).c_str())
);

std::string out_string;
for (auto &flag : output_flags) {
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(ALL_TESTS
test_cli_define
test_libmap
test_timescales
test_no_list
)

foreach(test_name ${ALL_TESTS})
Expand Down
26 changes: 23 additions & 3 deletions test/run_test
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,30 @@ assert len(unused & result) == 0
HERE
}

$prunefl -f list.f --top top_module \
rm -f $bindir/$test.cache.json

input_file="-f list.f"
if ! test -f list.f; then
input_file=test.v
fi

$prunefl $input_file --top top_module \
--verific-compat --ignore-unknown-modules\
--output-flags-to $bindir/$test.flags.f \
--output $bindir/$test.f
--output $bindir/$test.f \
--cache-to $bindir/$test.cache.json

verify_unused ./unused.txt $bindir/$test.flags.f

$slang_hier -F $bindir/$test.flags.f --top top_module --compat all --timescale=1ns/1ns
$slang_hier --single-unit -F $bindir/$test.flags.f --top top_module --compat all --timescale=1ns/1ns

# test loading from cache
$prunefl $input_file --top top_module \
--verific-compat --ignore-unknown-modules\
--output-flags-to $bindir/$test.flags.cached.f \
--output $bindir/$test.cached.f \
--cache-to $bindir/$test.cache.json

# only difference should be that it points to .cached.f instead of .f
cat $bindir/$test.flags.cached.f | sed 's/.cached.f/.f/' | cmp $bindir/$test.flags.f -
cmp $bindir/$test.f $bindir/$test.cached.f
11 changes: 11 additions & 0 deletions test/test_no_list/test.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module top_module
#(
parameter DEC_WIDTH = 8,
parameter ENC_WIDTH = 3
)
(
input wire [ENC_WIDTH-1:0] in_enc_nnn,
output wire [DEC_WIDTH-1:0] out_dec_nnn
);
assign out_dec_nnn = DEC_WIDTH'(1'b1 << in_enc_nnn);
endmodule