Tuesday, December 30, 2008

System Verilog by example by example

System Verilog by example(constraint, random, covergroup)
module top;
typedef enum bit { BAD_PARITY, GOOD_PARITY } parity_e;
class packet_c;
rand bit [5:0] pkt_length;
bit[63:0][7:0] pkt_payload;
bit[7:0] parity;
rand parity_e parity_type;
function bit [7:0] calc_parity();
 calc_parity = { pkt_length, pkt_addr };
 for (int i = 0; i calc_parity ^= pkt_payload[i];
endfunction :calc_parity

function void randomize_payload();
 pkt_addr = $urandom ;
 pkt_length = $urandom ;
 for (int i=0; i < pkt_length; i ++)
  pkt_payload[i]= $urandom;
endfunction:randomize_payload

function void post_randomize();
  randomize_payload();  
  if (parity_type == GOOD_PARITY)
  parity = calc_parity();
  else
  do
  parity = $urandom;
  while (parity == calc_parity());
endfunction:post_randomize

endmodule

class packet_c;
typedef enum bit { BAD_PARITY , GOOD_PARITY } parity_e;
typedef enum bit[1:0] { SMALL,MEDIUM, LARGE } payload_e;
  constraint c { parity_type == GOOD_PARITY ;}
  constraint c1 { payload_type == LARGE ;}
  constraint c3 { pkt_addr == 2; }
  constraint length_range {
  (payload_type == SMALL) -> pkt_length inside { [1 : 20] };
  (payload_type == MEDIUM) -> pkt_length inside { [21 : 44]};
  (payload_type == LARGE) -> pkt_length inside { [45 : 63]};
  }
// Define the Coverage module for the packet defined
  covergroup cg @ (pkt_event);
  coverpoint pkt_length {
  bins usb_range = {[0 : 20]};
  bins pci_range = {[21 : 44]};
  bins ahb_range = {[45 : 63 ]};
  }
  coverpoint pkt_addr;
  coverpoint parity;
  endgroup


Monday, December 1, 2008

水仙养殖

宝贝名称:水仙种球(别名:凌波仙子、玉玲珑、金盏银台等)

宝贝特点:为石蒜科多年生草本。地下部分的鳞茎肥大似洋葱,卵形至广卵状球形,外被棕褐色皮膜。叶狭长带状,二列状着生。花葶中空,扁筒状,通常每球有花葶数支,多者可达10余支,每葶数支,至10余朵,组成伞房花序。

栽培方法:栽培水仙有水培法和土培法两种方法。

一:水培法:即用浅盆水浸法培养。将水仙直立放入水仙浅盆中,加水淹没鳞茎三分之一的为宜。盆中可用石英砂 、鹅卵石等将鳞茎固定。

阳光:白天要放置在阳光充足的地方,夜晚可放在灯光下;

温度:以10-15度为宜,过低(4度以下)容易发生冻害,过高(20度以上)容易发生徒长;

换水:刚上盆时,水仙可每日换一次水,以后每2-3天换一次,花苞形成后,每周换一次水。为防止叶片徒长,最好是傍晚把盆水倒尽,次日清晨再加清水;

花期调控:一般水仙从上盆到开花约45天,但通过适当调控,可以在28天内至60天左右开花,比如节前10天还未看到饱满花苞,可改用接近体温的温水浸泡,并适当添加营养液催花;若想延长开花时间,则可将水仙放至温度较低处4-5度,适当控水等; 

按照以上方法,可使水仙叶短宽厚、茁壮,叶色浓绿,花开香浓。水养水仙,一般不需要施肥,如有条件,在开花期间稍施一些速效磷肥,花可开得更好。

二:土培法:准备肥沃的沙质土壤,将水仙种球栽入一半露出一半,鳞下面应事先垫一些细沙,以利排水。把花盆置于阳光充足、温度适宜的室内。以4至12℃为好,温度过低容易发生冻害,温度过高再加之光照不足,容易陡长,植株细弱,开花时间短暂,降低观赏价值。管理中如果满足光照和温度的要求,则叶片肥大,花莛粗壮,因而能使花朵开得大,芳香持久。土培水仙,可在开花前追施二至三次液肥。

Sunday, November 30, 2008

cadence eplanner/emanager

NTF
Nested Text Format (NTF) is a standard format for defining a nested list of containers that hold attribute/value pairs. The following files used by Enterprise Manager conform to this format:
• vplan
• vsif
• vsof
• config
• views
• coverage_attributes
• instance_map

NTF is a meta format, like XML. Specific files are not in NTF format, but in some descendant format.

The BNF description of the NTF format is:
entity_list : entity entity_list entity
entity : container attribute ’;’ ’;’
container : container_type BLANK container_name ’{’ entity_list ’}’
container_type : IDENTIFIER
container_name : IDENTIFIER NON_RESERVED_CHARACTER_TOKEN STRING
attribute : attribute_name ’:’ attribute_value
attribute_name : IDENTIFIER
attribute_value : TEXT STRING data
data : NON_RESERVED_CHARACTER_TOKEN
data BLANK NON_RESERVED_CHARACTER_TOKEN
IDENTIFIER : [_a-zA-Z][0-9_a-zA-Z]*
STRING ’[^’\n]*’ "[^"\n]*"
TEXT .*
BLANK [ \n\t\r]+
NON_RESERVED_CHARACTER_TOKEN [^ \n\;:{}’"]+


The container identifier is dependent on file type. For example:
vsif files session, group or test
vsof files session_output, run, failure, coverage_model, coverage_data
vplan files import, section, perspective, coverage, extend, instantiate or within.


Identifiers are case insensitive.

You can add #include directives anywhere in the NTF file.

The following containers are valid within a vplan file:
import {}: Import an XML plan into an NTF plan
import DMA_Verif_Plan {
vplan_file_name: "/vobs/plans/DMA_Verif_plan.xml"
};
section{}:Define hierarchy in a verification plan model
section Xbus_subsystem {
section Reading_from_Xcore {
coverage: vr_xbus_master_sequence.read_ended;
};
section Writing_to_Xcore {
coverage: vr_xbus_master_sequence.write_ended;
};
};
perspective{}:Defines attributes for a subset of the verification plan sections
Syntax Example
perspective Integration {
top_section: Full_SoC;
};
perspective Prototype {
top_section: Xbus_subsystem;
};
perspective Production {
top_section: Xserial_subsystem;
};
coverage{}:Define a coverage group, while allowing filtering and weighting
coverage valid_small_packets {
items_pattern: packet.gen.cross_all;
buckets_filter : len <>UCM
a coverage model is a hierarchical list of all the checks and coverage points in the DUT that you want to monitor during the run.
Incisive Simulator and Specman generate separate coverage model files.
Incisive Simulator writes the coverage model during the first run on a design. For subsequent runs on the same design, Incisive Simulator does not write the coverage model unless some special occasions
When Specman is run under Enterprise Manager, the coverage model format is set automatically to ucm, the Unicov format that Enterprise Manager requires.

By default, the HDL coverage model is written to:
/model_dir/_.ucm
To specify the location of the HDL model file, use the cov options to irun or ncsim. For example, with the following settings:
-covworkdir $DIR(session)
-covdesign $ENV(MY_DESIGN)
-covtest $BRUN_RUN_ID
The HDL coverage model is written to the following directory:
$BRUN_SESSION_DIR/model_dir/$MY_DESIGN/$BRUN_RUN_ID.ucm

VSIF
A verification session input format (vsif) file specifies one or more tests to be run in a single session.
The individual tests and the session itself have multiple attributes, including the testbench top files, the seed, and the SVE.
you can used any standard CPPdirective, including #define, #ifdef, and #ifndef.
There are three types of top-level containers in a vsif file:
•The session container describes default session attributes that apply globally to all tests.
•The optional group container holds one or more test containers and describes default test attributes that apply to all tests contained within it.
•The test container describes the attributes of a specific test, including, for example, the seed and the number of times the test must be run.
The following is a simple vsif, specifying one test to be run five times (count: 5 is specified) with
random seeds (there is no seed: n specified):
session short_tests {
top_dir : $VM_WORK/vm_xsoc;
pre_session_script: vm_xsoc/scripts/setup_xsoc.sh;
};
group xsoc_tests {
run_script: vm_xsoc/scripts/run_ex_vm_xsoc.sh;
scan_script: "vm_scan.pl ies.flt shell.flt";
timeout : 300;
pre_commands: "set checks ERROR_CONTINUE";
test test_simple {seed: 1;top_files: "vm_xsoc/examples/test_simple.e";};
test input_from_xbus {top_files: "vm_xsoc/examples/input_from_xbus.e";};
};
test simple_test {
run_script: vm_xsoc/scripts/run_ex_vm_xsoc.sh;
scan_script: "vm_scan.pl ius.flt shell.flt";
count: 5;
};

coverage

cited from http://www.ovmworld.org/forums/showthread.php?t=121
Code coverage: This will give information about how many lines are exected, how many times expressions, branches executed. This coverage is collected by the simulation tools. Users use this coverage to reach those corner cases which are not hit by the random testcases. Users have to write the directed testcases to reach the missing code covearage areas.

Functional coverage: This coverage will be defined by the user. User will define the coverage points for the functions to be covered in DUT. This is completly under user control. like covergroup definition defined in SV

Both of them have equal importance in the verification. 100% functional coverage does not mean that the DUT is completly exercised and vice-versa. Verification engineers will consider both coverages to measure the verifcation progress.

Coverage tool
All the HVL simulators have Functional Coverage tool with it.You have to write coverage code and then switch ON the coverage during simulation.
And use a coverage viewing tool (again, the same EDA company will have it) to view the coverage.
For Cadence IES/IUS:
1. For switching coverage ON:Use +nccovfile+dut_cov.txt while compiling.
The content of dut_cov.txt is:
select_coverage -all -module top
...
select_functional
select_fsm
During simulation use:-covoverwrite -covtest mycov.cov
2. To view coverage:
Do:
iccr -keywords+detail iccr.cmd
or:
iccr -keywords+summary iccr.cmd
or:
iccr -keywords+dontmerge iccr.cmd
The respective content of iccr.cmd is:
load_test cov_work/design/*merge * -output ALL
reset_coverage
load_test cov_work/design/ALL
report_detail -instance -betsafd -cgopt top... > detail.rpt

load_test cov_work/design/*merge * -output ALL
reset_coverage
load_test cov_work/design/ALL
report_summary -instance -cgopt top... > summary.rpt

load_test cov_work/design/*
report_summary -instance -cgopt top... > summary.rpt

There is a coverage quick start guide included with IUS as well in order to get you started. Search for "icc quick start guide" in cdnshelp

Wednesday, November 19, 2008

签证

申根签证 (摘自百度,http://baike.baidu.com/view/639689.htm)

1.渊源

申根(Schengen)是卢森堡东南端一个人口不足450人的宁静小城。

1985年有德国、法国、比利时、荷兰、卢森堡五国在这里共同签署了“关于逐步取消边界检查的条约”。加入条约的国家即简称为申根国家,取得申根国家的签证就是申根签证。

在这条约中明确规定:成员国中的公民可以任意出入成员国的国境而不需要办理签证手续,成员国以外的外籍人士,只要取得了成员国中一个国家的签证,便可在签证有效期内自由出入各成员国国境,而不需要再办签证,也可以在任何一个申根国家入境通行。乘坐申根国家之间的飞机航班就像乘国内航班一样,无需办理出入境手续。
从2007年12月21日起,《申根协定》参与国的范围将由目前的15国扩大到24国,匈牙利、捷克、斯洛伐克、斯洛文尼亚、波兰、爱沙尼亚、拉脱维亚、立陶宛和马耳他9个2004年才加入欧盟的国家也将成为申根大家庭中的成员。《申根协定》的“边界”将再一次得到拓展。

2.分类和申请申根签证的种类及申办办法:
  1)入境签证有一次入境和多次入境两种。签证持有者分别可一次连续停留90天或每半年多次累计不超过3个月。如需长期停留,可向某一成员国申请只在该使用的国别签证;
  2)过境签证指过境前往协定国以外国家的签证.一般有一次、两次两种、特殊情况下可颁发多次过境签。每次过境时间一般为3天,最长为5天

只前往某一成员国,应申办该国的签证,即“国别签证”。“国别签证”只能入、出签发国有效,不能从别的申根国家过境而进入签发国,否则应申办“申根签证”。签证上的停留天数只在签证有效期内停留有效;只办一次入境有效的“申根签证”,只能在有效期内在申根国家区域内旅行,不能中途转机去非申根国家后又返回申根国家

个人怎样办理申根签证?

第一步:准备好8项相关资料
1申根国家的邀请函
2有效期六个月以上的个人护照
3护照照片10张
4申请人的身份证、户口本复印件
5所在单位的营业执照复印件及本人名片2张
6个人存款证明
7家庭地址及联系电话
8所在单位的担保信,中英文各一份。
第二步:去相关国家的驻华使馆办理
准备好相关资料后,需要去相关国家的驻华使馆办理。一次去若干国家的,通常向第一个抵达的国家或停留最长时间的国家大使馆办理。(来源:北京娱乐信报)


申根协定还包含以下原则:
1、申根协议国家应在人员流动方面,尤其是在签证方面采取统一的政策规定;
2、申根协议国家决定颁发在申根区域内普遍有效的统一签证;
3、允许一次或二次入境的短期旅行签证,其前提条件是逗留的天数总和在第一次入境后半年内不能超过3个月;
4、在申根签证使用前,各个国家的国别签证应该得到承认;
5、根据申根协议的规定,持有任何一个申根协议成员国有效居留许可证的旅行者,3个月内无需签证可在申根区域内自由旅行。在申根区域外的旅行者,只要持有某申根国家有效的居留许可证和护照,无需办理签证即可前往该申根国家。超过90天的逗留,申请者应根据有关法律及其逗留目的申请国别签证;
6、统一的申根签证应由协议国家的外交和领事部门颁发;
7、原则上说,颁发某申根签证的国家应该是该签证持有者的主要目的地国家,或者是该签证持有者进入的第一个申根国家;
8、旅行证件的有效期必须长于签证的有效期,该旅行证件必须保证申根国家以外的外国人能够顺利回到自己的国家或进入申根区域外的国家;
9、每个国家都有权决定某人是否有权进入该国,或被拒绝入境,他国颁发的申根签证在另一申根国家使用时将得到限制,但该国必须将有关情况通报其他协议国家;

DDR description

pins descriptions
A13,A12-A0:
Address inputs: Provide the row address for ACTIVATE commands,
and the column address and auto precharge bit (A10) for
READ/WRITE commands, to select one location out of the memory
array in the respective bank. A10 sampled during a PRECHARGE
command determines whether the PRECHARGE applies to one
bank (A10 LOW, bank selected by BA[2:0] or all banks (A10 HIGH).
The address inputs also provide the op-code during a LOAD MODE
command.
A13,A12-A0
Address inputs: Provide the row address for ACTIVATE commands,
and the column address and auto precharge bit (A10) for
READ/WRITE commands, to select one location out of the memory
array in the respective bank. A10 sampled during a PRECHARGE
command determines whether the PRECHARGE applies to one
bank (A10 LOW, bank selected by BA[2:0] or all banks (A10 HIGH).

BA0–BA2
Bank address inputs: BA[2:0] define to which bank an ACTIVATE,
READ, WRITE, or PRECHARGE command is being applied. BA[2:0]
define which mode register, including MR, EMR, EMR(2), and
EMR(3), is loaded during the LOAD MODE command.

CK, CK#
Clock: CK and CK# are differential clock inputs. All address and control
input signals are sampled on the crossing of the positive edge
of CK and negative edge of CK#. Output data (DQ and DQS/DQS#)
is referenced to the crossings of CK and CK#.

CKE
Clock enable: CKE (registered HIGH) activates

CS#
Chip select: CS# enables (registered LOW) and disables (registered
HIGH) the command decoder.

RAS#, CAS#,WE#
Command inputs: RAS#, CAS#, and WE# (along with CS#) define
the command being entered.

command
LOAD MODE (LM)
The mode registers are loaded via bank address and address inputs. The bank address
balls determine which mode register will be programmed.
RAS#/CAS#/WE#: L L L

ACTIVATE
The ACTIVATE command is used to open (or activate) a row in a particular bank for a
subsequent access. The value on the bank address inputs determines the bank, and the
address inputs select the row. This row remains active (or open) for accesses until a precharge
command is issued to that bank. A precharge command must be issued before
opening a different row in the same bank.
RAS#/CAS#/WE#: L H H

READ
The READ command is used to initiate a burst read access to an active row. The value
on the bank address inputs determine the bank, and the address provided on address
inputs A0–Ai (where Ai is the most significant column address bit for a given configuration)
selects the starting column location. The value on input A10 determines whether
or not auto precharge is used.
RAS#/CAS#/WE#: H L H

WRITE
The WRITE command is used to initiate a burst write access to an active row. The value
on the bank select inputs selects the bank, and the address provided on inputs A0–Ai
(where Ai is the most significant column address bit for a given configuration) selects
the starting column location. The value on input A10 determines whether or not auto
precharge is used.
RAS#/CAS#/WE#: H L L

PRECHARGE
The PRECHARGE command is used to deactivate the open row in a particular bank or
the open row in all banks.
RAS#/CAS#/WE#: L H L

REFRESH
REFRESH is used during normal operation of the DDR2 SDRAM and is analogous to CAS#-
before-RAS# (CBR) REFRESH.
RAS#/CAS#/WE#: L L H
CKE: previous H, now H

SELF REFRESH
The SELF REFRESH command can be used to retain data in the DDR2 SDRAM, even if
the rest of the system is powered down.
RAS#/CAS#/WE#: L L H
CKE: previous H, now L

Mode Register (MR)
The mode register is used to define the specific mode of operation of the DDR2 SDRAM.
This definition includes the selection of a burst length, burst type, CAS latency, operating
mode, DLL RESET, write recovery, and power-down mode,
1.Burst length is defined by bits M0–M2,
The block is uniquely selected by A2–Ai when BL = 4 and by A3–Ai when BL = 8. The remaining (least significant) address bit(s) is (are) used to select the starting location within the block.
2.Accesses within a given burst may be programmed to be either sequential or interleaved.
The burst type is selected via bit M3. sequential: use WRAP, and interleaved: grouped by 2
3.The normal operating mode is selected by issuing a command with bit M7 set to “0”. if 1, test mode and unpredicatable
4. DLL RESET is defined by bit M8, as shown in Figure 34 (page 77). Programming bit M8
to “1” will activate the DLL RESET function.
5. Write recovery (WR) time is defined by bits M9–M11.
6. Active power-down (PD) mode is defined by bit M12, which determines performance versus power savings.
7. The CAS latency (CL) is defined by bits M4–M6, as shown in Figure 34 (page 77). CL is
the delay, in clock cycles, between the registration of a READ command and the availability
of the first bit of output data. The CL can be set to 3, 4, 5, 6, or 7 clocks, depending
on the speed grade option being used.
Extended Mode Register (EMR)
The extended mode register controls functions beyond those controlled by the mode
register; these additional functions are DLL enable/disable, output drive strength, ondie
termination (ODT), posted AL, off-chip driver impedance calibration (OCD), DQS#
enable/disable, RDQS/RDQS# enable/disable, and output disable/enable.
Posted CAS additive latency (AL) is supported to make the command and data bus efficient
for sustainable bandwidths in DDR2 SDRAM. Bits E3–E5 define the value of AL,


Graphs

Ball



DDR RAM State Machine



Hierarchical Diagram



Read Timing diagram



Write Timing diagram


Typical AC/DC characteristics
tCK: 1.875~5 ns
CL: 7~3 tCK
TR and CP must have a minimum 500mV peak-to-peak swing.
Supply voltage Vdd: min 1.7, max 1.9 V
DC differential input voltage Vid(DC): min 250, max VddQ (mV)
Input high (logic 1) voltage: min Vih(DC), max Vref(DC) + 125 VddQ1 (mV)

led vs ccfl

。在视频领域,人们一般用NTSC作为衡量视频设备的色彩还原特性的标准。这个指标是指在整个色彩空间内,显示设备能在各种色彩上显示到何种饱和度,就是能够显示显眼到什么程度的蓝色、绿色、红色。对于传统的液晶电视和显示器而言,能够覆盖的色域范围只有NTSC标准的65%~75%。如果我们仔细观察其色域曲线,就会发现在绿色、黄色和红色部分和标准距离较远。因此,传统液晶电视的色彩范围较小,难以完美呈现绿草、大海等自然场景。


我们知道,液晶显示器本身不会发光,它依靠背光源将光线穿过显示面板,展现图形图像。因此,背光源的技术直接影响到液晶电视的画质。传统的液晶显示器通常采用冷阴极荧光灯(cold cathode fluorescent lamps,CCFL)作为光源,而正是CCFL造成了液晶显示器颜色不够丰富,色彩还原度差。我们再看Sony QUALIA005系列电视机,它把液晶电视的色域范围扩展到NTSC标准的105%,基本上可以重现我们所有观察到的自然界场景。其核心就是使用LED背光源替代传统的CCFL背光源。


LED背光技术领先优势

LED作为LCD的背光源,与传统背光技术相比,除了在色域范围的优势外,还有很多独特的优点,归纳为十个方面:

1)LED背光源有更好的色域。其色彩表现力强于CCFL背光源,可对显示色彩数量不足的液晶技术起到很好的弥补作用,色彩还原好;

2)LED的使用寿命可长达10万小时。即使每天连续使用10个小时,也可以连续用上27年,大大延长了液晶电视的使用寿命,可获得对等离子技术压倒性的优势;

3)亮度调整范围大。实现LED功率控制很容易,不像CCFL的最低亮度存在一个门槛。因此,无论在明亮的户外还是全黑的室内,用户都很容易把显示设备的亮度调整到最悦目的状态;

4)完美的运动图像。传统CCFL灯管的闪烁发光频率较低,表现动态场景可能产生画面跳动。LED背光可以灵活调整发光频率,而且频率大大高于CCFL,因此能完美地呈现运动画面;

5)实时色彩管理。由于红绿蓝3色独立发光,很容易精确控制目前的显示色彩特性;

6)可以调整的背光白平衡,同时保证整体对比度。当用户的视频源在计算机和DVD机间切换时,可以轻松在9600K和6500K间调整白平衡,而且不会牺牲亮度和对比度;

7)可以为大尺寸屏幕提供连续面阵光源。LED是一种平面状光源,最基本的发光单元是3~5mm边长的正方形封装后,极容易组合在一起成为既定面积的面光源,具有很好的亮度均匀性,如果作为液晶电视的背光源,所需的辅助光学组件可以做得非常简单,屏幕亮度均匀性更为出色;

8)安全。LED使用的是5~24V的低压电源,十分安全,供电模块的设计也颇为简单;

9)环保。LED光源没有任何射线产生,也没有水银之类的有毒物质,可谓是绿色环保光源;

10)抗震。平面状结构让LED拥有稳固的内部结构,抗震性能很出色。


表1、LED与CCFL对比
CCFL LED
色域 72% 105%
色温 固定 可变
频闪驱动 需要 不需要
上升/下降沿时间 500毫秒 20纳秒
寿命 5万小时 10万小时
功耗 110瓦 415瓦
厚度 32.5毫米 45毫米
灯/LED数量 16 455

(数据来源 :Samsung Electronics)

在液晶显示器已经成为主流显示器的今天,LED背光源凭借其独特、压倒性的优势,逐渐显示出强大的应用前景。



LED背光源现在存在的问题

LED背光技术就象许多新型技术一样拥有许多诱人的优点,但LED要想占据大尺寸LCD背光源的主流,目前还需要解决一些技术难点。通过表1的对比,我们已经发现LED在功耗方面处于劣势,除此之外还存在成本高、一致性差等问题。

1)LED的发光效率较低,与同等尺寸CCFL背光源相比耗电量高。目前CCFL的输出光通量多在5000~7000lm范围,实际屏幕的输出光通量高于300lm,而多数LED背光都还无法达到这一指标。不过,现在全球有大量的企业从事相关研究,LED发光效率提升相当之快,目前光通量达到10000lm 的高亮型LED背光也已经出现,相信离成熟仅是咫尺之遥。

2)成本太高、价格昂贵,同等尺寸的背光源,LED是CCFL价格的4倍。对于目前价格竞争激烈的市场而言,让厂家有些望而却步。只有索尼为了图像质量不计成本。当然,随着工艺的成熟和生产规模的增加,LED背光的成本会逐步下降。

3)用LED作为背光源存在白光的一致性问题,这比起CCFL是个劣势。

4)LED在网点设计上较线性光源CCFL难,需考虑LED辐射状的光强衰减。

5)RGB LED背光源时间一久会产生色移波长会随温度变化,产生不同颜色。