2017年6月1日 星期四

Python Notes

[install]
https://www.continuum.io/downloads
http://darren1231.pixnet.net/blog/post/328443678-python-%E6%96%B0%E6%89%8B%E7%9A%84%E6%95%91%E6%98%9F--anaconda%E4%BB%8B%E7%B4%B9%E8%88%87%E5%AE%89%E8%A3%9D
http://ithelp.ithome.com.tw/users/20091404/ironman/797

[Anaconda Environment]
http://yehnan.blogspot.tw/2016/07/anaconda.html
http://www.astro.ncu.edu.tw/~yhsu/yhsu/%E5%BB%BA%E7%AB%8B%E7%94%A8%E6%96%BC%E7%A7%91%E5%AD%B8%E8%A8%88%E7%AE%97%E7%9A%84python%E9%96%8B%E7%99%BC%E7%92%B0%E5%A2%83/
http://darren1231.pixnet.net/blog/post/328443678-python-%E6%96%B0%E6%89%8B%E7%9A%84%E6%95%91%E6%98%9F--anaconda%E4%BB%8B%E7%B4%B9%E8%88%87%E5%AE%89%E8%A3%9D

[matlab to python]
https://docs.scipy.org/doc/numpy-dev/user/numpy-for-matlab-users.html
http://ifcuriousthenlearn.com/blog/2015/05/05/matlab-to-python-conversion/

[labview with python]
http://iammic.pixnet.net/blog/post/27292280-labview%EF%BC%9Alabpython-%E5%AE%89%E8%A3%9D

[Syntax]
http://djangogirlstaipei.herokuapp.com/tutorials/python/?os=windows
http://wiki.python.org.tw/Python/%E7%AC%AC%E4%B8%80%E6%AC%A1%E7%94%A8%E5%B0%B1%E4%B8%8A%E6%89%8B

2016年7月6日 星期三

well proximity effect

Well Proximity Effect
[intro]
implanting N-Well causes Vt increasing near N-Well edges.
The implanting particles above the N-Well edges are clustered at the N-Well edges, i.e. the concentration near N-Well edges are higher than that in the center of the N-Well.

[Environment]
BSIM 4.5 or above
in 90nm/65nm or above CMOS process

[Solution]
Pre-sim:
Cadence: Enable 'Well Proximity Accurate' option for every MOS
HSpice: set SC variable,
    e.g.: M1 VD  VG VS VB NMOS L=0.5U W=2U SC=2u

Layout:
increase the space between N-Well edges and MOSes according to DRC rules or above 3um.
inserting dummy source/drain for sensitive MOSes.

[Ref] http://www.bubuchen.com/2008/09/well-proximity-effect_5006.html

2016年6月15日 星期三

waveview notes

Tools: waveview

hotkey:
'd' --> show marker ON/OFF

Open parameter simulation results
open -> runObFile

2016年1月11日 星期一

Matlab multicore setup

I found a good material/manual
[www] http://mirlab.org/jang/books/matlabProgramming4guru/02-2_Optimization4codeNmem.asp?title=2-2%20%A5%AD%A6%E6%B3B%B2z

Here is the content:

2-2 平行處理

此外,我們也可以借用多核電腦的平行處理,來加速程式碼的執行。欲達到此功能,你的電腦必須具備多核心,而且你的系統也必須先安裝平行處理工具箱(Parallel Processing Toolbox,簡稱 PCT)。若兩者兼備,加速計算的方法如下:
  1. 在使用平行處理指令之前,下達「matlabpool local n」指令,其中 n 代表核心數目,例如 4(四核心電腦)或 8(八核心電腦)。
  2. 使用 parfor 指令來取代原來的 for 迴圈,其指令格式如下:
    parfor loopvar = initval:endval, statements, end
  3. 最後下達「matlabpool close」來關閉平行處理的功能。
我們就可以來嘗試一個簡單的範例:
Example 1: 02-程式碼與記憶體之最佳化/parfor01.mver distcomp % 顯示 PCT 的版本 matlabpool local 4 n = 100; rowMedian1=zeros(1000, 1); rowMedian2=zeros(1000, 1); % === 第一種方法:common for-loop tic for i = 1:1000 rowMedian1(i) = max(eig(rand(n))); end time1 = toc; % === 第二種方法:parallep for-loop tic parfor i = 1:1000 rowMedian2(i) = max(eig(rand(n))); end time2 = toc; fprintf('time1 = %g, time2 = %g, speedup factor = %g\n', time1, time2, time1/time2); matlabpool close------------------------------------------------------------------------------------------------------- MATLAB Version: 8.1.0.604 (R2013a) MATLAB License Number: DEMO Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1) Java Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode ------------------------------------------------------------------------------------------------------- Parallel Computing Toolbox Version 6.2 (R2013a) Starting matlabpool using the 'local' profile ... connected to 4 workers. time1 = 4.94823, time2 = 1.62187, speedup factor = 3.05094 Sending a stop signal to all the workers ... stopped.

在這個範例中,我們產生了 1000 個 100x100 的亂數矩陣,然後計算每一個矩陣的特徵值(共有 100個)的最大值,若使用平行處理專用的 parfor 迴圈,計算速度是一般 for 迴圈的 3 倍左右。(我的電腦是四核心。) 如果你在執行 MATLAB 時,一邊還要還要修改論文,此時若 MATLAB 佔用了所有的多核 CPU,可能會導致電腦整個慢下來,讓你無法進行文書編輯。因此 parfor 提供另一個參數,可以指定所用到的工作者個數,指令格式如下:
parfor (loopvar = initval:endval, M), statements, end
其中 M 即是所用到的核心個數。例如在下例中,雖然我的電腦是四核心,但我只使用兩核來進行 parfor 的運算:
Example 2: 02-程式碼與記憶體之最佳化/parfor02.mfprintf('MATLAB version = %s\n', version); matlabpool local 4 n = 100; rowMedian1=zeros(1000, 1); rowMedian2=zeros(1000, 1); % === 第一種方法:common for-loop tic for i = 1:1000 rowMedian1(i) = max(eig(rand(n))); end time1 = toc; % === 第二種方法:parallel for-loop using 2 workers tic parfor (i = 1:1000, 2) % 只用兩個核心 rowMedian2(i) = max(eig(rand(n))); end time2 = toc; fprintf('time1 = %g, time2 = %g, speedup factor = %g\n', time1, time2, time1/time2); matlabpool closeMATLAB version = 8.1.0.604 (R2013a) Starting matlabpool using the 'local' profile ... connected to 4 workers. time1 = 4.91713, time2 = 2.58577, speedup factor = 1.90162 Sending a stop signal to all the workers ... stopped.

由於只用到兩核,所以加速倍數接近兩倍。 在使用 parfor 迴圈時,有幾點要特別注意:
  • 因為每個迴圈可能有不同的核心同時計算,因此迴圈之間不能有相依性,否則會造成錯誤的結果,這是特別需要注意之處。
  • 在 parfor 迴圈的迴圈變數必須是整數,而且每次變大幅度都是1,以下是幾個不符合規定的範例:
    不合格的 parfor 用法說明
    parfor i = 1:2:251, 3, 5,... 非連續整數。
    parfor i = -7.5:7.5-7.5, -6.5,... 非整數。
    A = [3 7 -2 6 4 -4 9 3 7];
    parfor i = find(A>0)
    結果是 1, 2, 4,...,非連續整數。
    parfor i = [5;6;7;8][5;6;7;8]是一個行向量,而非 parfor 所須要的列向量。
PCT 是一個功能強大的工具箱,目前也可以支援多台電腦的平行運算,並可以使用 GPU(Graphic Processing Unit,圖形處理器)來進行大量的平行運算,詳細功能請參考下一小節的介紹。

MATLAB程式設計:進階篇

performing FFT by WaveView



Main steps:
1. open the waveform file and click on ADC output signals
2. performing ADC function
3. performing DAC function
4. performing FFT function

Steps:
1. execute the waveview binary file
>> wv &


2. open the waveform file, arrange signals from MSB to LSB (top-to-down)
eg. ~/ADC/spectre/schematic/psf/tran.tran

 3. select all signals and then click on the ADC icon
 4. 


5. group the A2D signals as one signal





6. performing DAC function on the grouped signal


 7. select the reconstructed waveform and press the tools/FFT icon


































2015年11月13日 星期五

Centos 7 as my Desktop

x86_64 version
Softwares:

[chrome]
Recommended plugins:
line: for chattering

[dropbox]
download and install without any problems

[firefox]
Recommended plugins:
bbsfox: for telnet connection
adblocker: blocks some disturbing ads
downhelper: download youtube videos
torrent tornado: downlad files by torrent/magnetic links

[mplayer]
step 1: fedora sources
>> rpm -Uh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

step 2. ElRepo sources (http://elrepo.org/tiki/tiki-index.php)
Key:
>>rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
add sources
>>rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm (for RHEL-7, SL-7 or CentOS-7)

step 3:
.My RPM repositories for EL (RHEL, CentOS, ScientificLinux etc) (http://li.nux.ro/repos.html)
    EL7: yum -y install epel-release && rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
  [[ EL6: yum -y install epel-release && rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm  ]]
  

step 4: check epel,elrepo, nux-dextop
>> yum repolist

step 5: install required libraries
>> yum -y --enablerepo=nux-dextop install gstreamer-ffmpeg  vlc   gstreamer-plugins-ugly gstreamer-ffmpeg gstreamer-plugins-bad gstreamer-plugins-ugly ffmpeg libvdpau mpg123   mplayer mplayer-gui  gstreamer-plugins-bad-nonfree gstreamer1-libav gstreamer1-plugins-bad-freeworld gstreamer1-plugins-ugly

step 6: install
>> yum install mplayer

optional:
>> yum install vlc

step 7: done

step 8: bug and solutions
no sound for mp4 files when using mplaer

[Ref] http://junight.blog.51cto.com/10828785/1707807
[Ref] http://blog.csdn.net/sidely/article/details/44671257

[Skype]
http://tecadmin.net/install-skype-centos-rhel-fedora/

[XnViewMP]
>> yum install qt5-qtbase qt5-qtbase-common qt5-qtbase-gui qt5-qtscript xcb-util-renderutil xcb-util-wm qt5-qtmultimedia qt5-qtsensors qt5-qtsvg qt5-qtwebkit qt5-qtx11extras
>> wget http://download.xnview.com/XnViewMP-linux.x86_64.rpm
conflicts with filesystem:
>> yum install  rpmrebuild
>> rpmrebuild -ep XnViewMP-linux.x86_64.rpm
Your configured editor (probably vi) will pop up with an already loaded file.

Search for the lines containing / and /usr/bin (lines like %dir %attr(0755, root, root) "/"), and remove them. They are starting in about line 340.
(I removed the line with /usr as well.)

Save end exit.
Answer yes. It will then tell you the location of the fixed rpm.
 

>> rpm -ivh  XnViewMP-linux.x86_64.rpm
>> xnview &
done


[cadence/icfb&]
yum install glibc.i686
yum install libXt.{i686,x86_64}
yum install mesa-libGLw
yum install libXp libXp-devel
yum install xorg-x11-fonts-ISO8859-1-100dpi
yum install xorg-x11-fonts-ISO8859-1-75dpi
yum install liberation-mono-fonts liberation-fonts-common liberation-sans-fonts liberation-serif-fonts
yum install libXext.i686
yum install libXp
yum install xorg-x11-libs.i386
yum install glibc.i686 libX11.i686 libXext.i686 libstdc++.i686 pulseaudio-libs.i686
yum install libXext  libXrender  fontconfig  libfontconfig.so.1
yum install libXp.so.6
 
or 
 
yum install glibc.i686 libXt.{i686,x86_64} mesa-libGLw libXp libXp-devel xorg-x11-fonts-ISO8859-1-100dpi xorg-x11-fonts-ISO8859-1-75dpi liberation-mono-fonts liberation-fonts-common liberation-sans-fonts liberation-serif-fonts libXext.i686 libXp xorg-x11-libs.i386 glibc.i686 libX11.i686 libXext.i686 libstdc++.i686 pulseaudio-libs.i686 libXext  libXrender  fontconfig  libfontconfig.so.1 libXp.so.6 
 
reboot to load some fonts 
[ref] https://www.ptt.cc/bbs/Electronics/M.1437491329.A.8D4.html


[madedit-mod]

[Ultraedit]
>> mkdir ~/local
>> cd ~/local
>> rpm2cpio ultraedit.rpm | cpio -idmv
>> rm -rfd ~/.idm/uex
>> rm -rf ~/.idm/*.spl
>> rm -rf /tmp/*.spl
>> alias ue='rm -rfd ~/.idm/uex; rm -rf ~/.idm/*.spl; rm -rf /tmp/*.spl;  /usr/local/bin/uex &'



[vm tools share folder]
[ref] https://simukti.net/blog/2016/09/10/centos-7-vmware-tools-mount-shared-folder/
>> yum install open-vm-tools
>> yum -y install open-vm-tools open-vm-tools-devel
>> yum -y groupinstall "Development Tools"
insert vmtools cdrom to /run/media/VMtools/ & press enter all the way

>> ./vmware-install.pl
check for kernel module

>> lsmod | grep hgfs
Check service
>> systemctl status vmware-tools
Check shared folder
>> df -h
e.g. .host:/ 465G 221G 244G 48% /mnt/hgfs
enable on boot
>> systemctl enable vmware-tools


[python3.4]
>> yum install epel-release
>> yum search python3
>> yum install python34
>> yum install python34-setuptools
>> easy_install-3.4 pip
>> easy_install-3.4 requests
>> pip3 -V

[exFAT support]
>> yum -y install epel-release
>> yum localinstall -y --nogpgcheck http://download1.rpmfusion.org/free/el/updates/7/x86_64/f/fuse-exfat-1.2.7-1.el7.x86_64.rpm
>> yum install http://download1.rpmfusion.org/free/el/updates/7/x86_64/e/exfat-utils-1.2.7-1.el7.x86_64.rpm 

[suspend]
hold 'Alt' before press power button 

[NTFS support]
yum install epel-release
yum -y install ntfs-3g
yum install fuse
modprobe fuse

[bootloader scan]
yum install -y ntfs-3g 
grub2-mkconfig -o /boot/grub2/grub.cfg 



cat /boot/grub2/grub.cfg |grep menuentry
grub2-set-default "CentOS Linux (4.9.9-1.el7.elrepo.x86_64) 7 (Core)"
or  grub2-set-default 3
grub2-editenv list

[remove old kernels]
yum install yum-utils 
package-cleanup --oldkernels --count=2
 









2015年10月4日 星期日

Cadence IC5141 coexists with IC616



Results:

Key variable:
setenv CDS_VERSION IC616
setenv CDS_Netlisting_Mode Analog
setenv CDS_CONTROLLED_AMS_ULTRA_RELEASE_ENABLED
setenv CDS_ROOT ${cadpath}/cadence/IC/616
setenv CDSHOME ${CDS_ROOT}
setenv PSF_WRITE_CHUNKS_MODE_ON true
unsetenv OA_HOME
set path = (${CDSHOME}/tools/bin ${CDSHOME}/tools/dfII/bin ${path})

Ref:
1. http://bbs.eetop.cn/thread-318533-1-1.html