Skip to content

Instantly share code, notes, and snippets.

View urish's full-sized avatar

Uri Shaked urish

View GitHub Profile
@urish
urish / gds_compare.py
Created October 18, 2023 08:51
Compare two GDS files using klayout scripting
# Usage:
# klayout -b -r compare.py -rd gds1=file1.gds -rd gds2=file2.gds
import sys
import pya
def compare_gds(file1, file2):
diff = pya.LayoutDiff()
# Load the layouts
#!/usr/bin/env python3
# coding=utf8
#
# Simple script to scale a KiCad footprint
# Usage:
# python kicad-resize-footprint.py <input.kicad_mod> <output.kicad_mod> <scale>
#
# Where scale is how much to scale (1 = 100%)
#
# Copyright (C) 2020, Uri Shaked.
@urish
urish / espruino-waveshare-epaper.js
Last active June 26, 2023 02:57
Driver for Waveshare 2.9inch e-Paper Module
// Copyright (C) 2017, Uri Shaked
// Loosely based on code samples provided by waveshare
// License: MIT
const DIN_PIN = 11;
const CLK_PIN = 12;
const CS_PIN = 13;
const DC_PIN = 14;
const RST_PIN = 15;
const BUSY_PIN = 16;
@urish
urish / wokwi-custom-chips-c-api.md
Last active January 30, 2023 05:47
Wokwi Custom Chips C API
@urish
urish / scan_wrapper.v
Last active August 31, 2022 21:16
Parallel Scan Wrapper
`default_nettype none
/*
`ifdef COCOTB
`define UNIT_DELAY #1
`define FUNCTIONAL
`define USE_POWER_PINS
`include "libs.ref/sky130_fd_sc_hd/verilog/primitives.v"
`include "libs.ref/sky130_fd_sc_hd/verilog/sky130_fd_sc_hd.v"
`endif
*/
// Wokwi Custom Chip - For information and examples see:
// https://link.wokwi.com/custom-chips-alpha
//
// SPDX-License-Identifier: MIT
// Copyright (C) 2022 Uri Shaked / wokwi.com
#include "wokwi-api.h"
#include <stdio.h>
#include <stdlib.h>
function galoisMultiply1(x, y) {
const Zi = new Uint32Array(4);
const Vi = new Uint32Array(y);
for (let i = 0; i < 128; i++) {
const xi = (x[i >> 5] & (1 << (31 - (i % 32)))) !== 0;
if (xi) {
Zi[0] ^= Vi[0];
Zi[1] ^= Vi[1];
Zi[2] ^= Vi[2];
Zi[3] ^= Vi[3];
`default_nettype none
`timescale 1ns/1ns
module encoder (
input clk,
input reset,
input a,
input b,
output reg [7:0] value
);
`default_nettype none
`timescale 1ns/1ns
module encoder (
input clk,
input reset,
input a,
input b,
output reg [7:0] value
);
magic
tech sky130A
timestamp 1638034600
<< nwell >>
rect -40 -195 205 -55
<< nmos >>
rect 40 0 55 65
<< pmos >>
rect 40 -140 55 -75
<< ndiff >>