Skip to content

Instantly share code, notes, and snippets.

@shtaxxx
shtaxxx / 0_how_to_rebuild_boot_files.md
Last active September 8, 2020 15:27
Boot files for PYNQ on Ultra96-V2

How to rebuild boot files for PYNQ on Ultra96-V2

Attached the two pre-rebuilt files here.

  • BOOT.BIN
  • image.ub

Install Petalinux and Vivado SDK.

@shtaxxx
shtaxxx / run.sh
Created April 23, 2019 09:03
Run test with logging file via tee
make test | tee log-`date +"%Y-%m-%d-%H-%M-%S"`
@shtaxxx
shtaxxx / quantize_kl.py
Last active April 21, 2019 14:10
KL divergence comparison between different quantized distributions generated from an individual distribution.
from __future__ import absolute_import
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
N = 1000 * 1000
loc = 0
scale = 2
epsilon = 0.00001
for f in `find . -type f |grep '.py' |grep 'lib_fsm'`
do
git mv $f `echo $f | sed -E 's/lib_fsm/fsm/'`
done
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
import re
pairs = {
# main
'axi_datawidth=32, silent=False):':
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
try:
repname = os.path.dirname(os.path.abspath(sys.argv[1])) + '/tmp.v'
rep = open(repname, 'r')
f = open(sys.argv[1], 'r')
find . -name '*9.txt' | xargs -I {} sh -c 'mv {} `echo {} | sed -E 's/txt/md/'`'
@shtaxxx
shtaxxx / read_verilog_code.py
Created June 7, 2016 08:27
Get I/O port by veriloggen
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
import collections
## modified version of veriloggen/examples/read_verilog_code/read_verilog_code.py
# the next line can be removed after installation
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from myhdl import *
coram_obj_count = 0
def MyhdlCoramMemory1P(CLK, ADDR, D, WE, Q,
CORAM_THREAD_NAME="undefined",
CORAM_THREAD_ID=0,
CORAM_ID=0,
CORAM_SUB_ID=0,
CORAM_ADDR_LEN=10,
@shtaxxx
shtaxxx / test_inspect_currentframe.py
Last active February 14, 2016 15:24
Test using inspect.currentframe()
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
import inspect
import ast
import types
import textwrap