Giter VIP home page Giter VIP logo

rvv_example's Introduction

This is a fork of rvv_example by Bruce Holt. This fork adds the implementation of the vec_len function using RVV Intrinsics

Simple RISC-V Vector example

This is an example of writing the same vector processing function in C and in assembly language for RISC-V Vector extension v1.0, and comparing the results.

By default the generated program is run in qemu, but another emulator such as Spike could also be used, or run on real RVV-capable hardware if you have it.

Getting the toolchain

You can follow this guide to setup llvm+clang and the riscv-gnu-toolchain.

Compiling and running the example

Just type "make"

Expected output:

$ make
clang -O3 -march=rv64gcv_zba -g -c main.c -o main.o
clang -O3 -march=rv64gcv_zba -g -c vec.S -o vec.o
riscv64-unknown-elf-gcc main.o vec.o -o main -lm
qemu-riscv64 -cpu rv64,v=true,zba=true,vlen=128,vext_spec=v1.0 ./main
3.741657 3.741657 3.741657
8.774964 8.774964 8.774964
13.928389 13.928389 13.928389
19.104973 19.104973 19.104973
24.289915 24.289915 24.289915
29.478806 29.478806 29.478806

You can trace the qemu execution by adding "-singlestep -d nochain,cpu" to the qemu command line. Cross-reference instruction addresses with the output from "riscv64-unknown-elf-objdump -d main".

rvv_example's People

Contributors

brucehoult avatar vogma avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.