Skip to content

Instantly share code, notes, and snippets.

View raytroop's full-sized avatar
🎯
Focusing

raytroop

🎯
Focusing
View GitHub Profile
@raytroop
raytroop / run.sh
Created October 8, 2021 15:31
questasim sim flow
vlib work
vlog -f filelist tb1.sv
# "-c": command line mode
vsim -voptargs=+acc -c -do "run 100ns; exit" work.tb1_ref
@raytroop
raytroop / install.sh
Last active February 7, 2022 15:45
compile vim from source with GUI support
# gtk3 in Rocky Linux 8.5
./configure --with-features=huge --enable-gui=gtk3 --enable-python3interp --prefix=/usr
make -j`nproc`
sudo make install
import uvm_pkg :: *;
class my_seq_item extends uvm_sequence_item;
rand logic [7:0] addr;
rand logic [7:0] data;
constraint addr_range_cn {
addr inside {[10:20]};
}
constraint data_range_cn {
@raytroop
raytroop / README.txt
Last active September 15, 2021 16:54
vcs with customized UVM
# uvm 1.1 customized
export VCS_UVM_HOME="path/to/uvm-1.1d/src"
vcs -full64 -debug_access+all -kdb -sverilog -ntb_opts uvm -timescale=1ns/1ps -f filelist.f
./simv -gui=verdi
@raytroop
raytroop / tb_seq_1011.v
Created September 6, 2021 15:44
fsdb verdi
initial begin
$fsdbDumpfile("seq_1011.fsdb");
$fsdbDumpvars(0);
end
@raytroop
raytroop / CMakeLists.txt
Last active August 24, 2021 15:01
glog with gflags
cmake_minimum_required(VERSION 3.10)
# set the project name
project(useGlog)
find_package(gflags REQUIRED)
find_package(glog REQUIRED)
INCLUDE_DIRECTORIES(${GLOG_INCLUDE_DIR})
@raytroop
raytroop / CMakeLists.txt
Created August 23, 2021 17:40
Google Test (GTest) with CMake
cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 11)
project(gtestTest)
find_package(Threads REQUIRED)
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})
add_executable(hello_test hello_test.cc)
#!/bin/sh
tree -if | grep 'cdslck' > txt
var=`cat txt`
for i in $var; do
rm -i $i
done
rm -i txt
function [ENOB, SNDR, SFDR, SNR] = prettyFFT(wave,f_S,maxh,no_annotation,no_plot,baseline);
% Programmed by: Skyler Weaver, Ph.D.
% Date: December 7, 2010
% Version: 1.0
%
% This function plots a very pretty FFT plot and annotates all of the
% relevant data. This is intended to be used by Nyquist guys and expects
% coherently sampled data. Maybe in the future I will modify it to
% automatically detect windowed data for Delta-Sigma or allow two input
% tones. As for now, it is just for single sine-wave test, coherent data.
// image convolution (3x3 conv)
int WIDTH = 1024;
int HEIGHT = 1024;
float input[(WIDTH + 2) * (HEIGHT + 2)];
float output[WIDTH * HEIGHT];
float weights[] = {1.0 / 9, 1.0 / 9, 1.0 / 9,
1.0 / 9, 1.0 / 9, 1.0 / 9,
1.0 / 9, 1.0 / 9, 1.0 / 9};
for (int j = 0; j < HEIGHT; j++)