Skip to content

Instantly share code, notes, and snippets.

View hzeller's full-sized avatar
🏠
Working from home

Henner Zeller hzeller

🏠
Working from home
  • San Francisco
View GitHub Profile
@hzeller
hzeller / clzt.lisp
Created April 19, 2024 04:36
A recursive count leading zeroes algorithm for bitvectors in Lisp.
(defun b2int (bitvector)
"Convert a binary string into an integer."
(reduce #'(lambda (first second)
(+ (* 2 first) second))
bitvector))
(defun concat-bits (b1 b2)
"Convenience function to concatenate bit vectors."
(concatenate 'bit-vector b1 b2))

always-comb

Checks that there are no occurrences of always @*. Use always_comb instead. See [Style: combinational-logic].

Enabled by default: true

always-comb-blocking

Checks that there are no occurrences of non-blocking assignment in combinational logic.

Enabled by default: true

@hzeller
hzeller / beaglebone-pinmux.h
Created June 20, 2018 17:47
Discussion for config-pin C-API
/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- */
/* Pinmux setting working in conjuction with the universal cape */
/* [[
* Comments in here in [[ double square brackets ]] are meta comments useful
* while working on a review of this API.
*
* Note, this _only_ addresses pinmux configuration, not anything how to write
* or read bits on GPIOs etc. This is left up to the application (I usually just
* memory map the proper regions in code or PRU, but there are many different
%!PS-Adobe-3.0
%%BoundingBox: 0 0 400 300
/mm { 72 25.4 div mul } bind def
/radius 53 mm def
/height 5 mm def
/angle 120 def
/offset 20 mm def
// -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil; -*-
//
// Quick hack based on ffmpeg
// tutorial http://dranger.com/ffmpeg/tutorial01.html
// in turn based on a tutorial by
// Martin Bohme (boehme@inb.uni-luebeckREMOVETHIS.de)
// Build with
// g++ -Wall -O3 -g video-viewer.o -o video-viewer -L../lib -lrgbmatrix -lrt -lm -lpthread `pkg-config --cflags --libs libavcodec libavformat libswscale libavutil`
// Ancient AV versions forgot to set this.
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
Compile in rpi-rgb-led-matrix directory.
make # compile library
g++ -Wall -O3 -g -Iinclude simple-udp.cc -o simple-udp -Llib -lrgbmatrix -lrt -lm -lpthread
*/
#include "led-matrix.h"
#include <arpa/inet.h>
@hzeller
hzeller / format-test.cpp
Created December 7, 2015 01:29
Experiments with various wxString formatting options (background: investigating ThrowIOError formatting problems in pcbnew/*specctra* files)
/* simplification to narrow down the format problems */
/*
* Compiled and run (you might need to adapt include directories)
g++ -Wall -o format-test -isystem /usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -isystem /usr/include/wx-3.0 -D__WXGTK__ format-test.cpp -L/usr/lib/x86_64-linux-gnu/ -lwx_baseu-3.0 && ./format-test
*/
#include <stdio.h>
#include <wx/string.h>