Skip to content

Instantly share code, notes, and snippets.

View denwarenjii's full-sized avatar

Christian Miranda denwarenjii

View GitHub Profile
@denwarenjii
denwarenjii / print_bin.c
Created July 10, 2025 21:14
Print bytes in binary C
#include <stdio.h>
#include <inttypes.h>
/* Credit to https://stackoverflow.com/questions/111928/is-there-a-printf-converter-to-print-in-binary-format */
#define BYTE_TO_BIN_FORMAT "%c%c%c%c%c%c%c%c"
#define BYTE_TO_BIN(byte) \
((byte) & 0x80 ? '1' : '0'), \
((byte) & 0x40 ? '1' : '0'), \
((byte) & 0x20 ? '1' : '0'), \
@denwarenjii
denwarenjii / Makefile
Created January 21, 2025 02:19
Makefile
# GHDL simulation makefile
# This requires the top level entity to have "_tb" as a suffix.
# VHDL compiler
VHDLC = ghdl
# Our waveform viewer
WAVEVIEWER = gtkwave
WORKDIR = work