Skip to content

Instantly share code, notes, and snippets.

View raytroop's full-sized avatar
🎯
Focusing

raytroop

🎯
Focusing
View GitHub Profile
@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++)
@raytroop
raytroop / virtualInheritanceDemo.cpp
Created November 6, 2019 09:40
c++ virtual inheritance
#include<iostream>
using namespace std;
//大小为4
class A
{
public:
int a;
};
@raytroop
raytroop / mov.cpp
Created November 1, 2019 12:56
copy-and-move-assignment-operators-for-a-class
#include <iostream>
using std::cout;
using std::endl;
class A {
public:
A(int x): mem_(x){}
A& operator=(const A& other) {
cout << "copy assignment operator" << endl;
mem_ = other.mem_;
@raytroop
raytroop / Singleton.cpp
Last active December 3, 2019 01:44
Singleton design pattern
class Singleton{
private:
Singleton();
Singleton(const Singleton& other);
public:
static Singleton* getInstance();
static Singleton* m_instance;
};
Singleton::Singleton() {}