Monday, November 15, 2010

short summary of package

Packages are explicitly named scopes appearing at the outermost level of the source text (at the same level as top-level modules and primitives). Types, variables, tasks, functions, sequences, and properties may be declared within a package.
Packages must not contain any processes. Therefore, wire declarations with implicit continuous assignments are not allowed.

Items within packages are generally type definitions, tasks, and functions. Items within packages cannot have hierarchical references. It is also possible to populate packages with parameters, variables, and nets.

One way to use declarations made in a package is to reference them using the class scope resolution operator ::.
ComplexPkg::Complex cout = ComplexPkg::mul(a, b);

Explicit import allows control over precisely which symbols are imported:
import ComplexPkg::Complex;


An alternate method for utilizing package declarations is via the import statement.

Thursday, November 11, 2010

ansi color (with python)

#! /magnum/oss/bin/python
def printC(bg,fg):
print "\033[05;"+bg+";"+fg+"mABC"+"\033[0m"
mystr=""
attrib=[0,1,4,5,7,8]
for i in attrib:
mystr+="\033[%dm%d\033[0m " % (i,i)
print mystr
mystr="\n\n"
for i in range (40,48):
mystr="%d:" % i
for j in range (30,38):
fg=str(j)
mystr= mystr + (" \033[1;%d;%dm%d\033[0m" % (i,j,j))
print mystr

#EOF

%color.py
0 1 4 5 7 8
40: 30 31 32 33 34 35 36 37
41: 30 31 32 33 34 35 36 37
42: 30 31 32 33 34 35 36 37
43: 30 31 32 33 34 35 36 37
44: 30 31 32 33 34 35 36 37
45: 30 31 32 33 34 35 36 37
46: 30 31 32 33 34 35 36 37
47: 30 31 32 33 34 35 36 37

Thursday, November 4, 2010

how to change color of "ls" command

use "man dir_colors" for detailed help.
copy "/etc/DIR_COLORS" to "~/.dir_colors" to create user-defined color file.

to ease visibility of folder color with blackground, change default setting
 on line 59:
"DIR 01;34     # directory"  #i.e. darkblue
to
"DIR 04;36     # directory"  #i.e. darkcyan, underline

This is enough.

Tuesday, November 2, 2010

IQ 调制

I:in phase同相分量
Q:quadrature phase正交分量
IQ调制是通信调制的基础概念,实际是属于相干调制的范畴。
IQ调制通过将数据分路,分别进行相干的载波调制(注意,这里不完全是正交,正交适应于BPSK、QPSK中,8PSK等八相以上调制不适合这种提法)。正交调幅信号QAM有两个相同频率的载波,但是相互正交(相位相差90度,四分之一周期)。一个信号叫I信号,另一个信号叫Q信号。最后通过合路,将调制信息置于载波中的幅度、相位或者频率。
从传输线角度来看,I/Q信号是一种双线传输模式,能量主要集中在两线之间。与外界关系不大。以此可以抗击共模干扰。当然,双线间回路面积要小些。

IQ信号和抗干扰没关系
现代通信系统为了使频谱利用率更高,所以用了许多种矢量调制,如BPSK、QPSK、QAM等等。
而对于数字信号而言是不会区分一个信号是不是矢量的,所以就用了IQ调制这种方式,使数字和模拟之间塔起了矢量的桥梁。
I/Q调制最基本的好处就是单边带输出。