Skip to content

Instantly share code, notes, and snippets.

View kpmcc's full-sized avatar

Kyle McCornack kpmcc

View GitHub Profile
#!/usr/bin/env python3
#
import argparse
class Game(object):
def __init__(self):
self.board = [0 for _ in range(9)]
self.value_dict = {1: "X", 2: "O"}
self.turn_taker = 1
@kpmcc
kpmcc / index.html
Last active March 2, 2022 18:21
A Space Invaders Clone
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta name="viewport" content=
"width=device-width, initial-scale=1.0">
<style type="text/css">
canvas {
border: 1px solid #d3d3d3;
background-color: black;
@kpmcc
kpmcc / rcplacebot.py
Last active March 30, 2022 02:52
A simple bot to interact with https://rc-place.fly.dev/.
#!/usr/bin/env python3
# Using this currently requires a file called 'token.txt'
# with one's Personal Access Token to be able to interact
# with the canvas.
import requests
import os
import time

FPGA Resources

HDLs

These are the languages in which one writes code to describe hardware. I say this instead of calling them programming languages to try and emphasize the distinction between describing hardware and writing code that executes on hardware.

Oftentimes these languages have functionality both for describing hardware, and for simulating or verifying designs. At early stages of learning it is important to understand the intended uses for particular language features. It can be easy to do things that would make sense in software, and are viable for verification, but that do not translate to hardware.

Standard HDLs

package main
import (
"bufio"
"errors"
"fmt"
"math/rand"
"os"
"strings"
)
@kpmcc
kpmcc / tree.c
Created May 23, 2022 19:21
Simple tree example
// preprocessor macro - basically copies tree.h and puts
// the contents where the include goes
#include <stdio.h>
#include <stdlib.h>
#include "tree.h"
int print_tree_hello() {
@kpmcc
kpmcc / envelopes.scd
Created June 7, 2022 01:21
Supercollider Demo files
s.boot;
x = {(PinkNoise.ar * 0.3)!2}.play
x.free;
( // These synths pile up and stay active (persistent lifetimes)
x = {
var sig, env;
env = Line.kr(1, 0, 1);
@kpmcc
kpmcc / Makefile
Last active December 4, 2022 21:21
Advent of Code 2022 - Day 04 - SystemVerilog + Python + Cocotb
# Makefile
# defaults
SIM ?= icarus
TOPLEVEL_LANG ?= verilog
VERILOG_SOURCES += $(PWD)/../rtl/complete_day_04.v
# TOPLEVEL is the name of the toplevel module in your Verilog or VHDL files
TOPLEVEL = day_04