-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IPC-based verification framework (#45)
* test: Add IPC verification framework * test: Remove broken inline asm * docker: Deploy containers per branch for testing
- Loading branch information
Showing
40 changed files
with
642 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ pyyaml | |
pytablewriter | ||
termcolor | ||
pandas | ||
pyelftools | ||
|
||
-r docs/requirements.txt | ||
-r sw/dnn/requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright 2023 ETH Zurich and University of Bologna. | ||
# Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Luca Colagrande <[email protected]> | ||
|
||
import sys | ||
from pathlib import Path | ||
import numpy as np | ||
from data.datagen import golden_model | ||
|
||
sys.path.append(str(Path(__file__).parent / '../../../util/sim/')) | ||
import verification # noqa: E402 | ||
from elf import Elf # noqa: E402 | ||
from data_utils import bytes_to_doubles # noqa: E402 | ||
|
||
|
||
ERR_THRESHOLD = 1E-10 | ||
|
||
|
||
def main(): | ||
# Run simulation and get outputs | ||
args = verification.parse_args() | ||
raw_results = verification.simulate(sim_bin=args.sim_bin, | ||
snitch_bin=args.snitch_bin, | ||
log=args.log, | ||
output_uids=['z']) | ||
z_actual = np.array(bytes_to_doubles(raw_results['z'])) | ||
|
||
# Extract input operands from ELF file | ||
elf = Elf(args.snitch_bin) | ||
a = np.array(bytes_to_doubles(elf.get_symbol_contents('a'))) | ||
x = np.array(bytes_to_doubles(elf.get_symbol_contents('x'))) | ||
y = np.array(bytes_to_doubles(elf.get_symbol_contents('y'))) | ||
|
||
# Verify results | ||
z_golden = golden_model(a, x, y) | ||
relative_err = np.absolute((z_golden - z_actual) / z_golden) | ||
fail = np.any(relative_err > ERR_THRESHOLD) | ||
|
||
return int(fail) | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
// Copyright 2023 ETH Zurich and University of Bologna. | ||
// Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Simply returns a return code different from 0. | ||
// | ||
// Luca Colagrande <[email protected]> | ||
// | ||
// Simply returns an exit code different from 0. | ||
// Should be used as a test to check that the simulator or whoever | ||
// is running the program actually captures an error when it occurs. | ||
|
||
int main() { return 1; } | ||
int main() { return 14; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,15 +152,15 @@ define QUESTASIM | |
@echo 'echo $$binary > $(LOGS_DIR)/.rtlbinary' >> $@ | ||
@echo '${VSIM} +permissive ${VSIM_FLAGS} -work ${MKFILE_DIR}/${VSIM_BUILDDIR} -c \ | ||
-ldflags "-Wl,-rpath,${FESVR}/lib -L${FESVR}/lib -lfesvr -lutil" \ | ||
$1 +permissive-off ++$$binary' >> $@ | ||
$1 +permissive-off ++$$binary ++$$2' >> $@ | ||
@chmod +x $@ | ||
@echo "#!/bin/bash" > [email protected] | ||
@echo 'binary=$$(pwd)/$$1' >> $@.gui | ||
@echo 'cd ${MKFILE_DIR}' >> $@.gui | ||
@echo 'echo $$binary > $(LOGS_DIR)/.rtlbinary' >> $@.gui | ||
@echo '${VSIM} +permissive ${VSIM_FLAGS} -work ${MKFILE_DIR}/${VSIM_BUILDDIR} \ | ||
-ldflags "-Wl,-rpath,${FESVR}/lib -L${FESVR}/lib -lfesvr -lutil" \ | ||
$1 +permissive-off ++$$binary' >> $@.gui | ||
$1 +permissive-off ++$$binary ++$$2' >> $@.gui | ||
@chmod +x $@.gui | ||
endef | ||
|
||
|
Oops, something went wrong.