資源簡介
業界通用驗證方法學。包內包括userguide, reference, source code, examples.
代碼片段和文件信息
//----------------------------------------------------------------------
//???Copyright?2007-2011?Cadence?Design?Systems?Inc.
//???Copyright?2009-2010?Mentor?Graphics?Corporation
//???Copyright?2010-2011?Synopsys?Inc.
//???All?Rights?Reserved?Worldwide
//
//???Licensed?under?the?Apache?License?Version?2.0?(the
//???“License“);?you?may?not?use?this?file?except?in
//???compliance?with?the?License.??You?may?obtain?a?copy?of
//???the?License?at
//
//???????http://www.apache.org/licenses/LICENSE-2.0
//
//???Unless?required?by?applicable?law?or?agreed?to?in
//???writing?software?distributed?under?the?License?is
//???distributed?on?an?“AS?IS“?BASIS?WITHOUT?WARRANTIES?OR
//???CONDITIONS?OF?ANY?KIND?either?express?or?implied.??See
//???the?License?for?the?specific?language?governing
//???permissions?and?limitations?under?the?License.
//----------------------------------------------------------------------
#include?“vpi_user.h“
#include?“veriuser.h“
#include?“svdpi.h“
#include?
#include?
#include?
/*?
?*?UVM?HDL?access?C?code.
?*
?*/
/*
?*?This?C?code?checks?to?see?if?there?is?PLI?handle
?*?with?a?value?set?to?define?the?maximum?bit?width.
?*
?*?If?no?such?variable?is?found?then?the?default?
?*?width?of?1024?is?used.
?*
?*?This?function?should?only?get?called?once?or?twice
?*?its?return?value?is?cached?in?the?caller.
?*
?*/
static?int?uvm_hdl_max_width()
{
??vpiHandle?ms;
??s_vpi_value?value_s?=?{?vpiIntVal?{?0?}?};
??ms?=?vpi_handle_by_name(
??????(PLI_BYTE8*)?“uvm_pkg::UVM_HDL_MAX_WIDTH“?0);
??if(ms?==?0)?
????return?1024;??/*?If?nothing?else?is?defined?
?????????????????????this?is?the?DEFAULT?*/
??vpi_get_value(ms?&value_s);
??return?value_s.value.integer;
}
#ifdef?QUESTA
static?int?uvm_hdl_set_vlog(char?*path?p_vpi_vecval?value?PLI_INT32?flag);
static?int?uvm_hdl_get_vlog(char?*path?p_vpi_vecval?value?PLI_INT32?flag);
static?int?partsel?=?0;
/*
?*?Given?a?path?with?part-select?break?into?individual?bit?accesses?
?*?path?=?pointer?to?user?string
?*?value?=?pointer?to?logic?vector
?*?flag?=?deposit?vs?force/release?options?etc
?*/
static?int?uvm_hdl_set_vlog_partsel(char?*path?p_vpi_vecval?value?PLI_INT32?flag)
{
??char?*path_ptr?=?path;
??int?path_len?idx;
??svLogicVecVal?bit_value;
??path_len?=?strlen(path);
??path_ptr?=?(char*)(path+path_len-1);
??if?(*path_ptr?!=?‘]‘)?
????return?0;
??while(path_ptr?!=?path?&&?*path_ptr?!=?‘:‘?&&?*path_ptr?!=?‘[‘)
????path_ptr--;
??if?(path_ptr?==?path?||?*path_ptr?!=?‘:‘)?
????return?0;
??while(path_ptr?!=?path?&&?*path_ptr?!=?‘[‘)
????path_ptr--;
??if?(path_ptr?==?path?||?*path_ptr?!=?‘[‘)?
????return?0;
??int?lhs?rhs?width?incr;
??//?extract?range?from?path
??if?(sscanf(path_ptr“[%u:%u]“&lhs?&rhs))?{
????char?index_str[20];
????int?i;
????path_ptr++;
????path_len?=?(path_len?-?(path_ptr?-?path));
????incr?=?(lhs>rhs)???1?:?-1;
????width?=?(lhs>rhs)???lhs-rhs+1?:?rhs-lhs+1;
????//?perform?set?for?each?individual?bit
????for?(i=0;?i?
- 上一篇:嵌入式系統原理及應用.pdf
- 下一篇:遙感影像去云處理
評論
共有 條評論