-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
65 additions
and
446 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/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 argparse | ||
from pathlib import Path | ||
import sys | ||
|
||
sys.path.append(str(Path(__file__).parent / '../../../../../../deps/snitch_cluster/util/sim/')) | ||
from simulate import run_simulation # noqa: E402 | ||
|
||
UART_LOG = str(Path(__file__).parent / '../../../../uart0.log') | ||
EXPECTED_OUTPUT = "Hello world!\r\n" | ||
|
||
|
||
def parse_args(): | ||
# Argument parsing | ||
parser = argparse.ArgumentParser(allow_abbrev=True) | ||
parser.add_argument( | ||
'simulator', | ||
help='The simulator to be used', | ||
) | ||
parser.add_argument( | ||
'sim_bin', | ||
help='The simulator binary to be used to start the simulation', | ||
) | ||
parser.add_argument( | ||
'snitch_bin', | ||
help='The Snitch binary to be executed by the simulated Snitch hardware') | ||
return parser.parse_args() | ||
|
||
|
||
def main(): | ||
args = parse_args() | ||
cmd = f"{args.sim_bin} {args.snitch_bin}" | ||
result = run_simulation(cmd, args.simulator, {}) | ||
actual_output = '' | ||
with open(UART_LOG, 'rb') as file: | ||
actual_output = file.read().decode('ascii') | ||
if result == 0: | ||
if actual_output == EXPECTED_OUTPUT: | ||
print(f"[{Path(__file__).name}] UART output matches expected output \"{ascii(EXPECTED_OUTPUT)}\"") | ||
return 0 | ||
else: | ||
print(f"[{Path(__file__).name}] UART output \"{ascii(actual_output)}\" does not match expected output \"{ascii(EXPECTED_OUTPUT)}\"") | ||
return 1 | ||
else: | ||
return result | ||
|
||
|
||
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
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 @@ | ||
testharness.sv |
Oops, something went wrong.