2009年12月22日 星期二

SystemVerilog Interface 的 inout port

發現一個現象,
當使用 SystemVerilog Interface 時,
若 Interface 內有用到 inout,
則該訊號不能宣告成 logic,
必須要宣告成 wire,
不然如果與非 interface 寫法的 inout port 相連時,
NC 會回報錯誤:

ncelab: *E,CUVMIO (../tb/tb.sv,58|48): port connections to inout ports must be collapsible, that is, they must be nets of the same size.

SystemVerilog Interface 的 inout port

發現一個現象,
當使用 SystemVerilog Interface 時,
若 Interface 內有用到 inout,
則該訊號不能宣告成 logic,
必須要宣告成 wire,
不然如果與非 interface 寫法的 inout port 相連時,
NC 會回報錯誤:

ncelab: *E,CUVMIO (../tb/tb.sv,58|48): port connections to inout ports must be collapsible, that is, they must be nets of the same size.

2009年12月21日 星期一

讓 VI 也認得 SystemVerilog

Step.1 先到 這裡 下載 systemverilog.vim
Step.2 將 systemverilog.vim 移到 ~/.vim/syntax/ 的目錄下
Step.3 編輯 ~/.vim/filetype.vim 並加入

augroup filetypedetect
au BufNewFile,BufRead *.sv setf systemverilog
augroup END

2009年12月20日 星期日

讓 VI 也認得 SystemVerilog

Step.1 先到 這裡 下載 systemverilog.vim
Step.2 將 systemverilog.vim 移到 ~/.vim/syntax/ 的目錄下
Step.3 編輯 ~/.vim/filetype.vim 並加入

augroup filetypedetect
au BufNewFile,BufRead *.sv setf systemverilog
augroup END

2009年12月16日 星期三

原來 CUPS 是 Apple 的東西

在安裝 Linux Print Driver 的時後,
順手印了一張測試頁,
測試頁的標題是: "CUPS Printer Test Page",
這張測試頁,從以前到現在,印很多次也看過很多遍了;

不過剛剛無意間看了測試頁下方的小字:

"... CUPS and the CUPS logo are the trademark property of Apple Inc. ..."

原來 CUPS 是 Apple 的東西,
現在才發現,Apple 在 Opensource 也貢獻了不少東西。

不知道在 Linux 的世界裡,有沒有微軟貢獻的東西?

2009年12月15日 星期二

原來 CUPS 是 Apple 的東西

在安裝 Linux Print Driver 的時後,
順手印了一張測試頁,
測試頁的標題是: "CUPS Printer Test Page",
這張測試頁,從以前到現在,印很多次也看過很多遍了;

不過剛剛無意間看了測試頁下方的小字:

"... CUPS and the CUPS logo are the trademark property of Apple Inc. ..."

原來 CUPS 是 Apple 的東西,
現在才發現,Apple 在 Opensource 也貢獻了不少東西。

不知道在 Linux 的世界裡,有沒有微軟貢獻的東西?

2009年12月11日 星期五

Compile SystemC on OpenSuSE 11.3

Download systemc-2.2.0.tgz from
解開壓縮檔

$ tar zxvf ./system-2.2.0.tgz

因為 gcc 是 4.x.x 版,所以要做 patch,compile 才會過
修改 systemc-2.2.0b/src/sysc/utils/sc_utils_ids.cpp
加上:

#include "string.h"
#include "cstdlib"


Compile SystemC and Install


$ sudo mkdir /opt/systemc
$ cd system-2.2.0
$ mkdir objdir
$ cd objdir
$ ../configure --prefix=/opt/systemc
$ make
$ make check # if you want to check
$ sudo make install

OpenSuSE 11.2 x64 + Sun Grid Engine

Workstation:
    PC1 : NIS Server, NFS Server, SGE master
    PC2 : NIS Client, NFS Client, SGE Execution Hosts
    PC3 : NIS Client, NFS Client, SGE Execution Hosts
    PC4 : NIS Client, NFS Client, SGE Execution Hosts
    ----
    PC1, share /home
    PC2~4, mount PC1:/home on /home
OS:
    OpenSuSE 11.2 x64
Package Requirement:
    openmotif22-libs
---------------------------------------------------------------------------

Step.1 Configuration Password-less ssh Access for the root User
    === PC2~4 ===

      check /etc/ssh/sshd_config

        => "PermitRootLogin yes"

    === PC1 ===

    // Generate SSH Key
    # ssh-keygen -t rsa

    // Put SSH public key to slave PC2~4
    # rsync -av /root/.ssh/id_rsa.pub root@PC2:/root/.ssh/authorized_keys
    # rsync -av /root/.ssh/id_rsa.pub root@PC3:/root/.ssh/authorized_keys
    # rsync -av /root/.ssh/id_rsa.pub root@PC4:/root/.ssh/authorized_keys

    // Test Password-less ssh access for root user

    # ssh root@PC2
    # ssh root@PC3
    # ssh root@PC4

    Step.2 Download Sun Grid Engine

      Sun Grid Engine 6.2 Update 4, Linux x64 (required), tar.gz format

        sge62u4_linux24-x64_targz.zip ... 27.63 MB

      Sun Grid Engine 6.2 Update 4, Linux x86 (required), tar.gz format

        sge62u4_linux24-i586_targz.zip ... 27.56 MB

    Step.3 Setup SGE Master / Execute Node

      PC1 (SGE Master):


      # mkdir /home/srv/sge6-2
      # cd /home/srv/sge6-2
      # tar -zxvf $DOWNLOAD/sge6_2u4/sge-6_2-common.tar.gz
      # tar -zxvf $DOWNLOAD/sge6_2u4/sge-6_2u4-bin-linux24-x64.tar.gz
      # tar -zxvf $DOWNLOAD/sge6_2u4/sge-6_2u4-bin-linux24-i586.tar.gz
      # SGE_ROOT=/home/srv/sge6-2; export SGE_ROOT
      # util/setfileperm.sh $SGE_ROOT


      // GUI Install
      # ./start_gui_installer

        Admin User = root
        Qmaster Host = PC1
        Grid Engine root directory = /opt/sge6-2
        Cell Name = cell_test
Step.4 Test
    // Login in PC1~4 by normal user account
    # source /home/srv/sge6-2/cell_eda/common/settings.csh
    # qsub my_job.sh

Compile SystemC on OpenSuSE 11.3

Download systemc-2.2.0.tgz from
解開壓縮檔

$ tar zxvf ./system-2.2.0.tgz

因為 gcc 是 4.x.x 版,所以要做 patch,compile 才會過
修改 systemc-2.2.0b/src/sysc/utils/sc_utils_ids.cpp
加上:

#include "string.h"
#include "cstdlib"


Compile SystemC and Install


$ sudo mkdir /opt/systemc
$ cd system-2.2.0
$ mkdir objdir
$ cd objdir
$ ../configure --prefix=/opt/systemc
$ make
$ make check # if you want to check
$ sudo make install

在 Mac OS 下的 SystemC 開發環境

最近在學習 SystemC
發現 LogicPoet 在 MacOS 下提供了非常不錯的發展環境
SystemC Installer Suite for Mac OSX and Scansion



 



2009年12月10日 星期四

OpenSuSE 11.2 x64 + Sun Grid Engine

Workstation:
    PC1 : NIS Server, NFS Server, SGE master
    PC2 : NIS Client, NFS Client, SGE Execution Hosts
    PC3 : NIS Client, NFS Client, SGE Execution Hosts
    PC4 : NIS Client, NFS Client, SGE Execution Hosts
    ----
    PC1, share /home
    PC2~4, mount PC1:/home on /home
OS:
    OpenSuSE 11.2 x64
Package Requirement:
    openmotif22-libs
---------------------------------------------------------------------------

Step.1 Configuration Password-less ssh Access for the root User
    === PC2~4 ===

      check /etc/ssh/sshd_config

        => "PermitRootLogin yes"

    === PC1 ===

    // Generate SSH Key
    # ssh-keygen -t rsa

    // Put SSH public key to slave PC2~4
    # rsync -av /root/.ssh/id_rsa.pub root@PC2:/root/.ssh/authorized_keys
    # rsync -av /root/.ssh/id_rsa.pub root@PC3:/root/.ssh/authorized_keys
    # rsync -av /root/.ssh/id_rsa.pub root@PC4:/root/.ssh/authorized_keys

    // Test Password-less ssh access for root user

    # ssh root@PC2
    # ssh root@PC3
    # ssh root@PC4

    Step.2 Download Sun Grid Engine

      Sun Grid Engine 6.2 Update 4, Linux x64 (required), tar.gz format

        sge62u4_linux24-x64_targz.zip ... 27.63 MB

      Sun Grid Engine 6.2 Update 4, Linux x86 (required), tar.gz format

        sge62u4_linux24-i586_targz.zip ... 27.56 MB

    Step.3 Setup SGE Master / Execute Node

      PC1 (SGE Master):


      # mkdir /home/srv/sge6-2
      # cd /home/srv/sge6-2
      # tar -zxvf $DOWNLOAD/sge6_2u4/sge-6_2-common.tar.gz
      # tar -zxvf $DOWNLOAD/sge6_2u4/sge-6_2u4-bin-linux24-x64.tar.gz
      # tar -zxvf $DOWNLOAD/sge6_2u4/sge-6_2u4-bin-linux24-i586.tar.gz
      # SGE_ROOT=/home/srv/sge6-2; export SGE_ROOT
      # util/setfileperm.sh $SGE_ROOT


      // GUI Install
      # ./start_gui_installer

        Admin User = root
        Qmaster Host = PC1
        Grid Engine root directory = /opt/sge6-2
        Cell Name = cell_test
Step.4 Test
    // Login in PC1~4 by normal user account
    # source /home/srv/sge6-2/cell_eda/common/settings.csh
    # qsub my_job.sh

在 Mac OS 下的 SystemC 開發環境

最近在學習 SystemC
發現 LogicPoet 在 MacOS 下提供了非常不錯的發展環境

http://www.logicpoet.com/downloads/

SystemC Installer Suite for Mac OSX and Scansion




2009年11月27日 星期五

Install FreeNX Server on OpenSUSE 11.2

openSUSE 11.2

The FreeNX package is no longer present in the official openSUSE 11.2 repositories. You can find the package in the Build Service.

  • Install NX and FreeNX rpms from here and here. The versions from the repository X11:RemoteDesktop/openSUSE_11.2 should work fine.

rpm -ivh http://download.opensuse.org/repositories/X11:/RemoteDesktop/openSUSE_11.2/x86_64/FreeNX-0.7.2-26.1.x86_64.rpm http://download.opensuse.org/repositories/X11:/RemoteDesktop/openSUSE_11.2/x86_64/NX-3.2.0-22.1.x86_64.rpm

    • As pre-requisite before installing the rpm above, you may need to install packages like expect and rdesktop. Install using YaST's Software Management or zypper on command line.
  • Run nxsetup --install --setup-nomachine-key --clean to install the server the first time
  • Use nxserver --status to check status of the server. The server runs on the ssh port, 22.
  • Test connecting using any NX client. Official No Machine client can be downloaded from www.nomachine.com which installs the client binary at /usr/NX/bin/nxclient See http://walter.deback.net/blog/archives/19 for using the NX client effectively.

Install FreeNX Server on OpenSUSE 11.2

openSUSE 11.2

The FreeNX package is no longer present in the official openSUSE 11.2 repositories. You can find the package in the Build Service.

  • Install NX and FreeNX rpms from here and here. The versions from the repository X11:RemoteDesktop/openSUSE_11.2 should work fine.

rpm -ivh http://download.opensuse.org/repositories/X11:/RemoteDesktop/openSUSE_11.2/x86_64/FreeNX-0.7.2-26.1.x86_64.rpm http://download.opensuse.org/repositories/X11:/RemoteDesktop/openSUSE_11.2/x86_64/NX-3.2.0-22.1.x86_64.rpm

    • As pre-requisite before installing the rpm above, you may need to install packages like expect and rdesktop. Install using YaST's Software Management or zypper on command line.
  • Run nxsetup --install --setup-nomachine-key --clean to install the server the first time
  • Use nxserver --status to check status of the server. The server runs on the ssh port, 22.
  • Test connecting using any NX client. Official No Machine client can be downloaded from www.nomachine.com which installs the client binary at /usr/NX/bin/nxclient See http://walter.deback.net/blog/archives/19 for using the NX client effectively.

2009年11月14日 星期六

在 Mac OS 10.6 安裝 git

  • Make sure your ports are up to date.
  • Install Git (You may want to include Subversion support if you want to import SVN repositories)
$sudo port selfupdate
$sudo port install git-core +svn

Reference: http://help.github.com/mac-git-installation

在 Mac OS 10.6 安裝 git

  • Make sure your ports are up to date.
  • Install Git (You may want to include Subversion support if you want to import SVN repositories)
$sudo port selfupdate
$sudo port install git-core +svn

Reference: http://help.github.com/mac-git-installation

2009年11月12日 星期四

Verilog: 避免 未定義 的 net 出錯

寫 Verilog時,
常常打錯字,
而被誤認為是一條新的net,而造成錯誤,

為了要避免這個惱人問題,

可在 Verilog file 裡加上

`default_nettype none



Mac OS X 10.6, MD5 checksum

由於 Mac OS X 10.6 並未內建 md5sum
所以先安裝 md5sum

sudo port install md5sha1sum

可以一次列出所有檔案的 MD5 Checksum,包含子目錄

find . ! -type d -print0 | xargs -0 md5sum

檢查所有檔案的 MD5 Checksum,包含子目錄

find . ! -type d -print0 | xargs -0 md5sum -c check.md5


Verilog: 避免 未定義 的 net 出錯

寫 Verilog時,
常常打錯字,
而被誤認為是一條新的net,而造成錯誤,

為了要避免這個惱人問題,

可在 Verilog file 裡加上

`default_nettype none



2009年11月11日 星期三

Mac OS X 10.6, MD5 checksum

由於 Mac OS X 10.6 並未內建 md5sum
所以先安裝 md5sum

sudo port install md5sha1sum

可以一次列出所有檔案的 MD5 Checksum,包含子目錄

find . ! -type d -print0 | xargs -0 md5sum

檢查所有檔案的 MD5 Checksum,包含子目錄

find . ! -type d -print0 | xargs -0 md5sum -c check.md5


2009年11月7日 星期六

在 Mac OS X 10.6 安裝 SVN

Create User/Password for Access Control

sudo htpasswd -cm /etc/apache2/svn-auth-file username


Create /etc/apache2/other/svn.conf:

[sourcecode language="php"]
LoadModule dav_svn_module /usr/libexec/apache2/mod_dav_svn.so
<Location /svn>
DAV svn
SVNParentPath /Users/SVN-ROOT
SVNListParentPath on
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /etc/apache2/svn-auth-file
Require valid-user
</Location>
[/sourcecode]

This will make the Subversion repository /Users/SVN-ROOT available at http://localhost/svn .

Update the repositories owner (otherwise commits would fail):


chown -R www:www /Users/SVN-ROOT


Restart Apache

sudo apachectl restart

在 Mac OS X 10.6 安裝 SVN

CODE {
display: block; /* fixes a strange ie margin bug */
font-family: Courier New;
font-size: 8pt;
overflow:auto;
background: #f0f0f0 url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y;
border: 1px solid #ccc;
padding: 10px 10px 10px 21px;
max-height:200px;
line-height: 1.2em;
}

Create User/Password for Access Control

sudo htpasswd -cm /etc/apache2/svn-auth-file username
Create /etc/apache2/other/svn.conf:

LoadModule dav_svn_module /usr/libexec/apache2/mod_dav_svn.so

\
DAV svn
SVNParentPath /Users/SVN-ROOT
SVNParentPath /opt/subversion/repos
SVNListParentPath on

AuthType Basic
AuthName "Subversion repository"
AuthUserFile /etc/apache2/svn-auth-file
Require valid-user


This will make the Subversion repository /Users/SVN-ROOT/svn/fmt available athttp://localhost/svn/fmt.

Update the repositories owner (otherwise commits would fail):

chown -R www:www /Users/SVN-ROOT/*
Restart Apache

sudo apachectl restart

2009年6月10日 星期三

Wordpress latin1 轉utf-8

有效告別數據庫亂碼, gbk/gb2312/big5/latin1轉utf-8

1. 在shell中用root登陸服務器
2. 進入mysql目錄 (linux Server):

  • cd /var/lib/mysql/
3. 利用mysql自帶的mysqldump功能dump一下原有的latin1編集的數據庫:

  • mysqldump –user=username –password=password –default-character-set=latin1 –skip-set-charset dbname > dump.sql

4. 把數據庫數據從latin1轉換成utf-8編集:

  • sed -r ’s/latin1/utf8/g’ dump.sql > dump_utf.sql

5. 創建新的urf-8新數據庫:

  • mysql –user=username –password=password –execute=”DROP DATABASE dbname; CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;”

6. 以正確編集導入轉碼後的數據庫數據:

  • mysql –user=username –password=password –default-character-set=utf8 dbname

2009年6月9日 星期二

Wordpress latin1 轉utf-8

有效告別數據庫亂碼, gbk/gb2312/big5/latin1轉utf-8

1. 在shell中用root登陸服務器
2. 進入mysql目錄 (linux Server):

  • cd /var/lib/mysql/
3. 利用mysql自帶的mysqldump功能dump一下原有的latin1編集的數據庫:

  • mysqldump –user=username –password=password –default-character-set=latin1 –skip-set-charset dbname > dump.sql

4. 把數據庫數據從latin1轉換成utf-8編集:

  • sed -r ’s/latin1/utf8/g’ dump.sql > dump_utf.sql

5. 創建新的urf-8新數據庫:

  • mysql –user=username –password=password –execute=”DROP DATABASE dbname; CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;”

6. 以正確編集導入轉碼後的數據庫數據:

  • mysql –user=username –password=password –default-character-set=utf8 dbname <>