Skip to content

Instantly share code, notes, and snippets.

View thoughtpolice's full-sized avatar
👊
omae wa mou shindeiru

Austin Seipp thoughtpolice

👊
omae wa mou shindeiru
View GitHub Profile
#include <stddef.h>
char get_first_cap(const char *in, int size) {
const char *first_cap = NULL;
if (size == 0)
return ' ';
for (int i = 0 ; i++ < size && *in != 0; in++) {
if (*in >= 'A' && *in <= 'Z') {
first_cap = in;
with Ada.Command_Line;
with Ada.Text_IO;
procedure Hello_World is
You : constant String :=
-- Change to strict inequality below to prove
(if Ada.Command_Line.Argument_Count >= 0 then
Ada.Command_Line.Argument (1)
else "世界");
begin
//! this program exists only to launch RPCS3, pointed to the Tekken Tag
//! Tournament 2 ROM on my hard drive, with Steam Remote Play. there are a very
//! weird set of circumstances leading to this:
//!
//! as a prerequisite: modern Steam supports a full userspace gamepad input
//! device stack, called "Steam Input". games launched by steam have the Steam
//! Overlay injected into them, which also handles Steam Input. in effect, Steam
//! Input allows arbitrary gamepads, such as PS4 DualShocks or Nintendo Joycons,
//! or even exotic devices like Hitbox/PS4 Hori Fightpads, to be registered and
//! control mapped on the system, entirely through Steam and without any other
@thoughtpolice
thoughtpolice / questa-example.do
Created February 10, 2022 23:55
intel questa simulation example
# Setup compilation
set QSYS_SIMDIR ../prj
source $QSYS_SIMDIR/mentor/msim_setup.tcl
dev_com
com
# add sources, but skip the top level BSP since its unused
foreach f [glob -type f path/to/sources/*.sv] {
vlog -sv -work work "$f"
}
@thoughtpolice
thoughtpolice / mmult.c
Created December 28, 2021 02:48
matrix multiply with clang extended vector types
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#ifndef __wasm__
#define LLVM_MCA_BEGIN(l) __asm__ __volatile__("# LLVM-MCA-BEGIN " l);
#define LLVM_MCA_END(l) __asm__ __volatile__("# LLVM-MCA-END " l);
#else
#define LLVM_MCA_BEGIN(_)
#define LLVM_MCA_END(_)
#! /usr/bin/env bluetcl
# bsc-libdir: a tcl script that looks up Verilog primitives for
# the bluespec compiler, and emits them to stdout. this tool
# is more useful when combined with `bsc-rpc`, but might be
# of use on its own.
#
# usage:
#
# $ bluetcl bsc-libdir RegUN > RegUN.v
sim.exe: top.v sim.cpp
verilator --cc --coverage --exe -Wno-lint -trace --top-module top \
--Mdir bench_dir $^
$(MAKE) -C bench_dir -f Vtop.mk
cp bench_dir/Vtop $@
clean:
rm -f bench_dir sim.exe
.PHONY: clean
@thoughtpolice
thoughtpolice / ecp5pll.py
Last active March 18, 2024 12:31
Yosys script to generate ECP5 PLLs on the fly
# ecp5pll.py: yosys RPC frontend for generating ECP5 PLL modules on the fly
#
# Copyright (C) 2020 Austin Seipp
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
@thoughtpolice
thoughtpolice / symbiflow.nix
Created September 26, 2019 00:30
SymbiFlow for Nixpkgs
with import <nixpkgs> {};
let
nextpnr-gui = pkgs.nextpnr; # gui by default on upstream
nextpnr-nogui = pkgs.nextpnr.override { enableGui = false; };
common-pkgs = with pkgs; [
symbiyosys yosys verilog verilator
icestorm trellis
z3 yices boolector
@thoughtpolice
thoughtpolice / fastly-cache-debug.sh
Created August 1, 2019 12:56
Grab Fastly debugging info from cache.nixos.org
#!/usr/bin/env bash
[ -z "$1" ] && echo "ERROR: must provide arg" && exit 1
CACHE_URL=${CACHE_URL:-"https://cache.nixos.org"}
curl -v \
-HFastly-Debug:1 \
-o /dev/null 2>&1 \
"$CACHE_URL/$1" \