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
#!/usr/bin/env bash | |
set -euo pipefail | |
CC="/home/gkalsi/code/sandbox/rv-hello-world/clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang" | |
QEMU= | |
$CC --target=riscv64-linux -march=rv64gczve64d -static playground.c -o playground | |
./qemu-8.0.0-rc4/build/qemu-riscv64 -cpu rv64,v=true,zba=true,zbb=true,vlen=512,vext_spec=v1.0 ./playground |
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
#!/usr/bin/env bash | |
set -euo pipefail | |
# Fetch source code and toolchains and whatnot. | |
FLAC_REPO="https://github.com/xiph/flac.git" | |
OGG_REPO="https://github.com/xiph/ogg.git" | |
CROSS_COMPILER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/riscv64-lp64d/tarballs/riscv64-lp64d--glibc--stable-2022.08-1.tar.bz2" | |
CROSS_COMPILER_DIR="rv64-glibc" | |
CROSS_COMPILER_ZIP="${CROSS_COMPILER_DIR}.tar.bz2" |
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
// | |
// Some notes: | |
// (1) To build and run invoke the following: | |
// `g++ main.cc -o main && ./main` | |
// This program builds with GCC but not Clang. I think it's because the SIMD syntax for Clang and GCC is different | |
// but I haven't confirmed this. Clang complains that `qN` is not a valid register. This would probably work fine | |
// if I used the `arm_neon.h` intrinsics header. | |
// | |
// (2) The codegen for Clang and GCC using the arm_neon header is somewhat different. It would be cool to see if one | |
// version is significantly faster than the other. |
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
def collatz(start : int): | |
iterations : int = 1 | |
while start != 1: | |
if start % 2 == 0: | |
start = start / 2 | |
else: | |
start = start * 3 + 1 | |
iterations += 1 | |
return iterations |
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
name: upspin # you probably want to 'snapcraft register <name>' | |
version: '0.0.1' # just for humans, typically '1.2+git' or '1.3.2' | |
summary: A framework for naming everyone's everything. # 79 char long summary | |
description: | | |
Upspin is an experimental project to build a framework for naming and sharing | |
files and other data securely, uniformly, and globally: a global name system | |
of sorts. | |
grade: stable # must be 'stable' to release into candidate/stable channels | |
confinement: classic # use 'strict' once you have the right plugs and slots |
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
### Keybase proof | |
I hereby claim: | |
* I am gkalsi on github. | |
* I am gsk (https://keybase.io/gsk) on keybase. | |
* I have a public key whose fingerprint is 4FEB A71D 9676 BF2D 8C8B EA80 B1D3 B798 890F 1031 | |
To claim this, I am signing this object: |