-
Notifications
You must be signed in to change notification settings - Fork 18
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
1 parent
9769e78
commit 6f668d4
Showing
2 changed files
with
62 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright 2020 ETH Zurich and University of Bologna. | ||
# Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.13) | ||
|
||
# Allow spatzBenchmarks to be built as a standalone library. | ||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) | ||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) | ||
set(CMAKE_TOOLCHAIN_FILE toolchain-gcc CACHE STRING "Toolchain to use") | ||
|
||
project(Benchmarks LANGUAGES C ASM) | ||
include(SnitchUtilities) | ||
|
||
# Build the runtime. | ||
add_subdirectory(../snRuntime snRuntime) | ||
endif() | ||
|
||
add_compile_options(-O3 -g -ffunction-sections) | ||
add_compile_options(-DELEN=64) | ||
|
||
include_directories(include) | ||
include_directories(${SNRUNTIME_INCLUDE_DIRS}) | ||
include_directories(../riscvTests/isa/macros/vector) | ||
|
||
# Tests | ||
enable_testing() | ||
set(SNITCH_TEST_PREFIX chaining-) | ||
|
||
add_snitch_test(test1 test1.c) |
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,32 @@ | ||
// Copyright 2021 ETH Zurich and University of Bologna. | ||
// Solderpad Hardware License, Version 0.51, see LICENSE for details. | ||
// SPDX-License-Identifier: SHL-0.51 | ||
// | ||
// Author: Navaneeth Kunhi Purayil <[email protected]> | ||
// | ||
|
||
#include "vector_macros.h" | ||
|
||
void TEST32(void) { | ||
VSET(32, e64, m8); | ||
VLOAD_64(v0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); | ||
asm volatile("vadd.vi v8, v0, 1"); | ||
VCMP_U64(1, v8, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33); | ||
} | ||
|
||
void TEST64(void) { | ||
VSET(64, e64, m8); | ||
VLOAD_64(v0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); | ||
asm volatile("vadd.vi v8, v0, 1"); | ||
VCMP_U64(2, v8, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33); | ||
} | ||
|
||
int main(void) { | ||
INIT_CHECK(); | ||
enable_vec(); | ||
|
||
TEST32(); | ||
TEST64(); | ||
|
||
EXIT_CHECK(); | ||
} |