Skip to content

Instantly share code, notes, and snippets.

View bit-hack's full-sized avatar

Aidan Dodds bit-hack

View GitHub Profile
@bit-hack
bit-hack / power_on_reset.v
Created January 5, 2020 14:34
verilog power on reset
`timescale 1 ns / 1 ps
module power_on_reset(input in_clk, output out_rst);
reg [5:0] reset_cnt = 0;
wire resetn = &reset_cnt;
assign out_rst = !resetn;
always @(posedge in_clk) begin
@bit-hack
bit-hack / YAC512_decode.v
Created December 6, 2019 10:18
YAC512 real time decoder
//
//
//
module UDA1334(
input iCLK,
input [15:0] iLeft,
input [15:0] iRight,
output oSEL,
output oCLK,
output oDAT);
@bit-hack
bit-hack / sn76489_vgm.v
Last active December 3, 2019 16:31
IceStick SN76489 I2S VGM player
`default_nettype none
`timescale 1ns / 1ps
module i2s_master(input CLK,
input [15:0] LIN,
input [15:0] RIN,
output LRCLK,
output DATA,
output BCLK);
@bit-hack
bit-hack / serial.c
Created December 1, 2019 23:59
Simple win32 binary serial library
/* .__ .__
* ______ ___________|__|____ | |
* / ___// __ \_ __ \ \__ \ | |
* \___ \\ ___/| | \/ |/ __ \| |__
* /____ >\___ >__| |__(____ /____/
* \/ \/ \/
*/
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
@bit-hack
bit-hack / RS232.v
Last active December 9, 2019 00:28
RS232 Transceiver
`default_nettype none
`timescale 1ns / 1ps
module uart_tx(
input clk, // Master clock
input rst, // Synchronous reset
input [7:0] tx_byte, // Byte to transmit
input start, // Start
output tx // transmit pin
@bit-hack
bit-hack / PLL_Blink.v
Created November 28, 2019 22:52
ICEStick ICE40 PhaseLockedLoop example
@bit-hack
bit-hack / vhd.h
Created June 17, 2019 14:09
virtual hard drive footer format
// http://download.microsoft.com/download/f/f/e/ffef50a5-07dd-4cf8-aaa3-442c0673a029/Virtual%20Hard%20Disk%20Format%20Spec_10_18_06.doc
// footer lives at end of the file - 512/511 bytes
struct vhd_footer_t {
// "conectix"
uint64_t cookie;
// 0 - No features enabled
@bit-hack
bit-hack / bios_join.c
Created June 6, 2019 08:57
Join even and odd roms into one binary image.
#include <stdio.h>
int main(const int argc, const char **args) {
if (argc < 4) {
printf("usage: %s even.bin odd.bin out.bin", args[0]);
return 1;
}
FILE *odd = NULL;
extern "C" void test();
#pragma comment(linker, "/alternatename:_test=??0CppLibraryClass@@QAE@XZ")
test(); // will call mangled name