Skip to content

Instantly share code, notes, and snippets.

View erincandescent's full-sized avatar
pondering the existence of this feature

Erin erincandescent

pondering the existence of this feature
View GitHub Profile


This document was originally written several years ago. At the time I was working as an execution core verification engineer at Arm. The following points are coloured heavily by working in and around the execution cores of various processors. Apply a pinch of salt; points contain varying degrees of opinion.

It is still my opinion that RISC-V could be much better designed; though I will also say that if I was building a 32 or 64-bit CPU today I'd likely implement the architecture to benefit from the existing tooling.

Mostly based upon the RISC-V ISA spec v2.0. Some updates have been made for v2.2

Original Foreword: Some Opinion

The RISC-V ISA has pursued minimalism to a fault. There is a large emphasis on minimizing instruction count, normalizing encoding, etc. This pursuit of minimalism has resulted in false orthogonalities (such as reusing the same instruction for branches, calls and returns) and a requirement for superfluous instructions which impacts code density both in terms of size and

erincandescent / NibblerCPU.vhd
Created May 20, 2014 00:59
Nibbler 4-bit CPU in VHDL
View NibblerCPU.vhd
library IEEE;
entity NibblerCPU is Port(
clk : in STD_LOGIC;
rst : in STD_LOGIC;
prog_addr : out std_logic_vector(11 downto 0);
prog_data : in std_logic_vector(7 downto 0);
erincandescent / netboot.nix
Created January 6, 2020 01:06
netbooting a raspberry pi running alpine with nix
View netboot.nix
# dhcp server settings:
# dhcp-mac=set:rpi,b8:27:eb:*:*:*
# dhcp-boot=tag:rpi,boot,
{ lib, stdenv, config, pkgs, ... }:
alpineRelease = "3.11";
alpineRevision = "2";
alpineVersion = "${alpineRelease}.${alpineRevision}";
mkdir modloop-rpi
unsquashfs -d modloop-rpi/lib ${alpinePiArmhf}/boot/modloop-rpi 'modules/*/modules.*' 'modules/*/kernel/net/packet/af_packet.ko'
(cd modloop-rpi && find . | cpio -H newc -ov | gzip) > initramfs-ext-rpi
cat ${alpinePiArmhf}/boot/initramfs-rpi initramfs-ext-rpi > $out/initramfs-rpi
View gist:6ea4d3f890f14a34371d90ccf659ff4a
{1:F01AAAAGRA0AXXX0057000289}{2:O1030919010321BBBBGRA0AXXX00570001710103210920N}{3:{108:MT103 003 OF 045}{121:c8b66b47-2bd9-48fe-be90-93c2096f27d2}}{4:

Keybase proof

I hereby claim:

  • I am erincandescent on github.
  • I am erincandescent ( on keybase.
  • I have a public key ASDv23fqVwaH5NvQBQp0Y6Itt4lUspg2jfTc257yO_QGWAo

To claim this, I am signing this object:

View gist:adceb50931c2554934b81be8298aa53b
>>> for x in socket.getaddrinfo("rei.local", None, socket.AF_INET6):
... print(x)
(10, 1, 6, '', ('fe80::152:821e:3b05:9293', 0, 0, 0))
(10, 2, 17, '', ('fe80::152:821e:3b05:9293', 0, 0, 0))
(10, 3, 0, '', ('fe80::152:821e:3b05:9293', 0, 0, 0))
>>> for x in socket.getaddrinfo("rei.local", None, socket.AF_UNSPEC):
... print(x)
(10, 1, 6, '', ('fe80::152:821e:3b05:9293%eth0', 0, 0, 2))
#![feature(custom_derive, plugin)]
extern crate serde;
extern crate serde_json;
#[derive(Serialize, Deserialize)]
struct S1 {
a: Test,
b: Test
erincandescent / gist:8376705
Last active January 2, 2016 23:29
Quick and dirty trap on overflow overhead check
View gist:8376705
#include <stdio.h>
#include <time.h>
#include <stdint.h>
".align 16\n"
"mov 4(%esp), %eax\n"
"mov $25, %ecx\n"
"1: dec %ecx\n"
View gist:6650957
echo *** Preparing for remote debug ***\n
target remote localhost:3333
set arm fallback-mode auto
define ifsr
monitor arm mrc 15 0 5 0 1
define ifar
monitor arm mrc 15 0 6 0 2