Skip to content

Instantly share code, notes, and snippets.

View mcandre's full-sized avatar

Andrew mcandre

  • Milwaukee, WI
View GitHub Profile
@mcandre
mcandre / shrink-wsl.md
Created November 18, 2021 17:19
Shrink WSL
  1. Backup any critical data.
  2. Launch an administrative PowerShell session.
  3. Change directory like cd "C:\Users\andrew\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState"
  4. Run optimize-vhd -Path ext4.vhdx -Mode full
  5. Wait a few minutes for the process to complete.
  6. Relaunch WSL.
@mcandre
mcandre / fulladder_chain.sv
Created October 11, 2021 15:39
full adder chain
`include "fulladder.sv"
module fulladder_chain #(parameter WIDTH)(input carry_in, [WIDTH-1:0] a, [WIDTH-1:0] b, output carry_out, [WIDTH-1:0] sum);
const int sizes[] = {WIDTH-2, 0};
const int CARRY_WIDTH = sizes.max;
wire [CARRY_WIDTH:0] carries;
@mcandre
mcandre / verilator-build-error.log
Last active October 9, 2021 20:06
verilator build error
$ make
------------------------------------------------------------
making verilator in src
make -C src
make[1]: Entering directory '/home/ubuntu/go/src/github.com/verilator/verilator/src'
mkdir -p obj_dbg
make -C obj_dbg -j 1 TGT=../../bin/verilator_bin_dbg VL_DEBUG=1 -f ../Makefile_obj serial
make[2]: Entering directory '/home/ubuntu/go/src/github.com/verilator/verilator/src/obj_dbg'
@mcandre
mcandre / half_adder.v
Created September 28, 2021 02:14
bad adder
module half_adder(
input clk,
a,
b,
output reg [0:0] sum,
carry
);
always @(posedge clk)
begin
sum <= a ^ b;
@mcandre
mcandre / half_adder.sv
Created September 28, 2021 01:43
half_adder SystemVerilog
module half_adder(
input clk,
a,
b,
output reg sum,
carry
);
always @(posedge clk)
begin
sum <= a ^ b;
@mcandre
mcandre / cmake.log
Last active September 24, 2021 18:41
cmake build error log
$ conan install -s compiler.cppstd=17 -s compiler=clang -s compiler.version=7.0 --build missing .
Configuration:
[settings]
arch=armv7
arch_build=armv7
build_type=Release
compiler=clang
compiler.cppstd=17
@mcandre
mcandre / show-binary-dependencies.md
Last active April 26, 2021 02:50
Show Dependencies

General UNIX/Linux

$ ldd <binary>

macOS

$ otool -L 
@mcandre
mcandre / windows-install-msvc-and-clang.md
Last active May 1, 2021 02:22
Windows Install MSVC and clang

Windows Install MSVC and clang

  1. Install Chocolatey.
  2. Launch a PowerShell terminal in administrator mode.
  3. Install visualstudio2019community.
  4. Install the Visual Studio 2019 native C++ Desktop workload with the optional MSVC and clang components included:
PS C:\> choco install --force visualstudio2019-workload-nativedesktop --package-parameters "--includeOptional"
@mcandre
mcandre / mac-enable-libfuzzer.md
Created March 19, 2021 18:17
macOS Enable libFuzzer
  1. Run brew install llvm --HEAD.
  2. Update certain shell variables:
# Prefer newer LLVM with fuzzing enabled
# shellcheck source=/dev/null
export CC='clang'
export CXX='clang++'
export LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
PATH="$(brew --prefix)/opt/llvm/bin:$PATH"
@mcandre
mcandre / build.log
Created December 8, 2020 23:28
zig build log
$ cat src/zag/main.zig
const std = @import("std");
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
//
// The OK triples from:
// https://github.com/ziglang/zig-bootstrap#supported-triples
//