Skip to content

Instantly share code, notes, and snippets.

View avesus's full-sized avatar
🎯
Focusing

Brian Cannard avesus

🎯
Focusing
View GitHub Profile
@avesus
avesus / levmarq.c
Created July 10, 2023 16:33 — forked from maasencioh/levmarq.c
A simple implementation of the Levenberg-Marquardt algorithm in plain C
/*
* levmarq.c
*
* This file contains an implementation of the Levenberg-Marquardt algorithm
* for solving least-squares problems, together with some supporting routines
* for Cholesky decomposition and inversion. No attempt has been made at
* optimization. In particular, memory use in the matrix routines could be
* cut in half with a little effort (and some loss of clarity).
*
* It is assumed that the compiler supports variable-length arrays as
@avesus
avesus / common.glsl
Last active October 29, 2023 02:54
Cartilage Shader
# ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
precision highp int;
precision highp sampler2D;
# else
precision mediump float;
precision lowp int;
precision lowp sampler2D;
# endif
@avesus
avesus / fold.ml
Created October 15, 2020 16:31 — forked from keleshev/fold.ml
let (=>) left right = print_char (if left = right then '.' else 'F')
open Printf
let id x = x
let const x = fun _ -> x
let sum = List.fold_left (+) 0
let (>>) f g x = g (f x)
let () =
@avesus
avesus / old-testbench.v
Last active May 10, 2021 22:52
Working reprogrammer
`timescale 1ns / 1ps
module testbench ();
endmodule
/*
module testbench2 ();
reg GCLK100 = 1'b0;
wire ETH_MDC;
@avesus
avesus / ROMA.md
Created March 13, 2020 16:25
IO classification over Read, Overwrite, Move, Append

All external world facilities should have wrappers to support unit-testable and simply clean code.

These external world facilities:

a) might return different data when reads are requested because the data can be changed either by external "actors" or by a concurrent thread of the same client (this lambda); Examples: SQL SELECT, HTTP GET

b) do provide write APIs. We classify writes according if they destroy old data or make it unavailable at old locations

@avesus
avesus / clocked-fsm-in-fpga.circ
Created February 25, 2020 16:02
Logisim circuit clocked FSM in FPGA
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project source="2.7.1" version="1.0">
This file is intended to be loaded by Logisim (http://www.cburch.com/logisim/).
<lib desc="#Wiring" name="0"/>
<lib desc="#Gates" name="1"/>
<lib desc="#Plexers" name="2"/>
<lib desc="#Arithmetic" name="3"/>
<lib desc="#Memory" name="4">
<tool name="ROM">
@avesus
avesus / icestick.pcf
Last active November 2, 2023 05:39
Lattice iCEstick + ILI9225 display
# full iCEstick pinout:
# http://www.pighixxx.com/test/portfolio-items/icestick/
set_io CLK_pad 21
set_io FT2232H_GPIOL2_pad 1
set_io FT2232H_GPIOL1_pad 2
set_io FT2232H_GPIOL0_pad 3
set_io FT2232H_TMS_CS_pad 4
set_io FT2232H_TDO_DI_pad 7
@avesus
avesus / icestick.pcf
Last active February 10, 2020 16:04
icestick
# full iCEstick pinout:
# http://www.pighixxx.com/test/portfolio-items/icestick/
set_io CLK_pad 21
set_io FT2232H_GPIOL2_pad 1
set_io FT2232H_GPIOL1_pad 2
set_io FT2232H_GPIOL0_pad 3
set_io FT2232H_TMS_CS_pad 4
set_io FT2232H_TDO_DI_pad 7
{"nodes":[{"x":462,"y":465,"text":"reset_btn_pressed","isAcceptState":false},{"x":462,"y":743,"text":"reset_btn_released","isAcceptState":false},{"x":1537,"y":112,"text":"powered_on","isAcceptState":false},{"x":1555,"y":325,"text":"resetting","isAcceptState":false},{"x":1738,"y":582,"text":"clearing_registers","isAcceptState":false},{"x":2210,"y":590,"text":"select_random","isAcceptState":false},{"x":1231,"y":582,"text":"not_resetting","isAcceptState":false},{"x":2286,"y":325,"text":"\"playing\"","isAcceptState":false},{"x":3171,"y":248,"text":"lcd_rdy_scrn","isAcceptState":false},{"x":3217,"y":1314,"text":"led_green_on","isAcceptState":false},{"x":3502,"y":1530,"text":"LED_strip","isAcceptState":false},{"x":3243,"y":1897,"text":"bad_sound","isAcceptState":false},{"x":3381,"y":94,"text":"lcd_off","isAcceptState":false},{"x":3217,"y":1517,"text":"led_green_off","isAcceptState":false},{"x":3489,"y":1819,"text":"no_sound","isAcceptState":false},{"x":3429,"y":622,"text":"lcd_make_selections","isAcceptState":false
@avesus
avesus / arty.xdc
Last active November 2, 2023 05:39
Ethernet PHY and iCE40LP384 reprogrammer over UDP
#set_property DONT_TOUCH true [get_cells { evt1/mem1/srlatch_with_ands }]
#set_property DONT_TOUCH true [get_cells { evt1/pulse1/not1 }]
#set_property DONT_TOUCH true [get_cells { evt1/pulse1/xnor1 }]
#set_property DONT_TOUCH true [get_cells { evt1 }]
set_property SEVERITY {Warning} [get_drc_checks LUTLP-1]
#set_property ALLOW_COMBINATORIAL_LOOPS TRUE [get_nets evt1/feedback]
#set_property ALLOW_COMBINATORIAL_LOOPS TRUE [get_nets evt1/mem1/in0]
#set_property ALLOW_COMBINATORIAL_LOOPS TRUE [get_nets s1/evt1/mem1/OUTPUT_EDGE]