2021年3月10日 星期三

Icarus Verilog (iVerilog) setup

 ref.[iverilog]
https://bleyer.org/icarus/
ref. [bash] 
https://www.baeldung.com/linux/use-command-line-arguments-in-bash-script
https://daniel-sc.github.io/bash-shell-to-bat-converter/

[Win10]
01. https://bleyer.org/icarus/iverilog-v11-20210204-x64_setup.exe
02. set PATH, "控制台\系統及安全性\系統" -> 進階系統設定 -> 環境變數 -> 變數 Path -> Edit -> 新增 "C:\iverilog\bin" "C:\iverilog\gtkwave\bin"
03. open a text editor -> copy the following content and save as "v2w.sh"

#!/bin/bash
# define parameters
wavext=".vcd"
outfolder="output"
currentdir=$PWD

# main program
# info 
  #filename=$1    
  read filename
# fetch basename
  basename=$(echo "$filename" | cut -f 1 -d '.')
  outname="$basename$wavext"
  echo "veriolog(*.v) to waveform(*.vcd): $filename to $outname"
# create sim folder if not exist
  mkdir -p $outfolder
# iverilog commands
  iverilog -o wave -y $PWD $filename
  vvp -n wave -lxt2
  rm wave
  mv wave.vcd $PWD/output/$outname
  gtkwave $PWD/output/$outname &

PS1. in your verilog file, the content should be included
/*iverilog */
initial begin
    $dumpfile("wave.vcd");        //生成的vcd文件名称
    $dumpvars(0, LED_demo_tb);    //tb模块名称
end
/*iverilog */

PS2. if you don't like the bash method, the website converts bash script to bat file
https://daniel-sc.github.io/bash-shell-to-bat-converter/
Here is the result:
@echo off
SET wavext=%CD%vcd
SET outfolder=output
SET currentdir=%PWD%
read filename
SET basename=%undefined%
SET outname="%basename%%wavext%"
echo "veriolog(*%CD%v) to waveform(*%CD%vcd): %filename% to %outname%"
mkdir -p %outfolder%
iverilog -o wave -y %PWD% %filename%
vvp -n wave -lxt2
DEL  wave
mv wave.vcd %PWD%\output\%outname%
gtkwave %PWD%\output\%outname%


04. place "*.v" & v2w.sh in the same folder and double-click on "v2w.sh". Then, fill in the main test bench *.v

[linux] Raspberry pi OS
01. >> apt-get install iverilog gtkwave shc
02. >> vi v2w.sh

#!/bin/bash
# define parameters
wavext=".vcd"
outfolder="output"
currentdir=$PWD

# main program
# info 
  #filename=$1    
  read filename
# fetch basename
  basename=$(echo "$filename" | cut -f 1 -d '.')
  outname="$basename$wavext"
  echo "veriolog(*.v) to waveform(*.vcd): $filename to $outname"
# create sim folder if not exist
  mkdir -p $outfolder
# iverilog commands
  iverilog -o wave -y $PWD $filename
  vvp -n wave -lxt2
  rm wave
  mv wave.vcd $PWD/output/$outname
  gtkwave $PWD/output/$outname &

03.
>> shc -f v2w.sh 
>> mv v2w.sh.x ~/bin/v2w
>> vi ~/.bashrc
PATH=$PATH:~/bin

04. in the folder of all the *.v
>> v2w testbench.v


2021年1月6日 星期三

templates

 [甘特圖] [Gantt Chart]

ref. https://seanwulab.com/index.php/2020/08/11/excel-gantt-chart/

2020年12月14日 星期一

uniqueness of physical unclonable function (PUF)

[ref] https://www.iacr.org/archive/ches2011/69170391/69170391.pdf

 Example: we designed a PUF function in someway.
The function generate 50 responses, saying '1011101' and '1001001' are two of the responses.
The hamming distance is 2 and the normalized hamming distance is 2/7 = 0.285. Keep on calculating all the responses and construct a histogram like Fig. 1.


The mean value of this histogram is the uniqueness of this PUF, i.e. about 46% with std of 3.8%.

2020年11月16日 星期一

jobs note


Define: TSMC@PTT N4bachelor: 2.8K;  N4Master=4.5K 
[ref] https://www.ptt.cc/bbs/Tech_Job/M.1278533064.A.547.html
by 20201117


2020年11月4日 星期三

Multi Skype 雙開 in windows 10

[ref] https://answers.microsoft.com/zh-hant/skype/forum/skype_win10-skype_startms-skype_signms/%E6%9B%B4%E6%96%B0skype-828041%E5%BE%8C/a6d68231-74cb-478e-91c5-2f35f5b5011d?auth=1

 add another link and modified the link: "*.exe" to "*.exe" --secondary

2020年8月3日 星期一

linux: rename subdirectoris

rename all sub-directories named layout to layout_1234
>> find . -type d | grep layout | xargs -I {}layout  mv {}layout {}layout_1234

2020年6月1日 星期一

youtube download

1. jdownloader
cons: can't download live stream

2. 4K video downloader
Pros: can download live stream
https://www.4kdownload.com/
https://www.azofreeware.com/2019/12/4k-video-downloader.html

3. python script youtube-dl
[ref] http://icekuo.blogspot.com/2019/09/python-youtube-dl-youtube.html
[ref] https://askubuntu.com/questions/486297/how-to-select-video-quality-from-youtube-dl
[ref] https://yogapan.github.io/2017/08/16/Youtube-dl%E6%BF%83%E7%B8%AE%E6%95%99%E5%AD%B8%E7%AD%86%E8%A8%98/
[ref] https://github.com/MrS0m30n3/youtube-dl-gui
Pros: can download live stream
CMD:>> pip install youtube-dl
CMD:>> pip install ffmpeg
CMD:>> youtube-dl -f best https://www.youtube.com/watch?v=19g6IHsfsyY

PS. GUI version: