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
/* | |
Conway's Game of Life modeled in Verilog by Adam Thomas / devdsp | |
*/ | |
/* | |
* ---------------------------------------------------------------------------- | |
* "THE BEER-WARE LICENSE" (Revision 42): | |
* <github.com/devdsp> wrote this file. As long as you retain this notice you | |
* can do whatever you want with this stuff. If we meet some day, and you think | |
* this stuff is worth it, you can buy me a beer in return. - Adam |
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
/* Quick and dirty NES to DMG button driver (originally by Mr.Blinky) | |
* | |
* Using digital pins so it can be easily run on any Arduino | |
* Because DigitalRead and DigitalWrite are pretty slow, no delays are | |
* required when changing controller pin states and reading in data | |
*/ | |
//NES button state masks | |
#define BS_A _BV(7) | |
#define BS_B _BV(6) |
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
using LinearAlgebra | |
@enum Element Resistor Voltage Current | |
netlist = [ | |
(0, 1, Resistor, 4), | |
(0, 1, Current, 6), | |
(0, 2, Resistor, 6), | |
(0, 3, Resistor, 8), | |
(1, 2, Resistor, 3), |
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/python3 | |
import os | |
import re | |
import subprocess | |
import mmap | |
def patch(filename : str, bytes): | |
subprocess.run(["cp",filename, filename + '_patched']) | |
with open(filename + "_patched", "r+b") as f: |
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
#example from https://pramode.in/2016/10/05/random-bitstream-using-lfsr/ | |
from migen import * | |
MAX_PERIOD = 50000 | |
def new_val(lfsr): | |
bit = ((lfsr >> 0) ^ \ | |
(lfsr >> 2) ^ \ | |
(lfsr >> 3) ^ \ | |
(lfsr >> 5)) & 1 |