NCVerilog设计秘诀与点评

    技术2022-05-11  21

    1. * S) ]8 E. K" x% ZThis approach allows completely transparent mixed language, mixed-level, and mixed cycle-event simulations. It also lays the foundation for mixed signal simulations. ' y+ l3 s- ?   E, q+ C' J9 o+ Y4 C' w   c2.External Interface: 0 o8 q- I, I2 F4 X* Y(1) VHDL: VHPI,OMI $ o% N5 c0 Q3 U3 }. [( Q(2) Verilog: PLI, VPI, OMI% F9 z9 W1 G( J( [$ y(Modelsim和VCS也有这个功能)* q- K- l2 k+ K* D   {. C# t(PLI用的比较多,仿真器一般自带常用的PLI。) 8 s: s: o: u' _. a( y3 k( Z$ y(如果需要添加 FSDB支持,需要将debussy提供的libpli.dll和libpli.lib拷贝到tools/lib下面)   _/ Z   {; m   X9 X+ ]; t   E7 Y: H0 o! {3 ?. e! ~4 Y, {3. After elaboration, Single executable code stream, Affirma NC Simulator; ) P# J) n. h% [" D+ x7 Z/ ?4 c5 g2 r' O# {3 h4. ' q7 Y3 `3 L5 e* k, i9 /' vCode Coverage ??? : /; V" ]5 {. n9 W, P- E) S* C* W) F4 k7 Y& _5. Verilog supported: $ e: Y1 k( @: f1 h/ j(1) OVI 2.0; 3 `8 t0 [- N0 i- o(2) IEEE 1364; 8 N% _( I, j9 n, [(3) Verilog-XL implementation;    x1 w2 X9 l/ ]6 a3 w* }! ]( y" g5 k0 D% A* }3 h- S; q6. NC-Verilog use: Library.Cell:View 0 [" {/ k" r, Z/ _4 }cds.lib: This file contains statements that define your libraries and that map logical library names to physical directory paths. 7 S   f8 ~# `$ n8 L# h4 j% O+ Whdl.var:This file defines which library is the work library. ( c3 i7 y6 e/ Y# T, F* q$ @0 l( X& h- [7. You can write a setup.loc file to change the directories to search or to change the order of precedence to use when searching for the cds.lib and hdl.var files. & T& R$ o6 ]5 ?1 O+ f, [2 a) j# u/ /" z, i( C8 B8. (仿真器的“构成-步骤”:ncvlog-parse,ncelab-elaborate,ncsim-simulate). {6 n/ o( s% [% u0 w" Q   S& YSingle-step invocation: ncverilog : a parser called ncvlog; an elaborator called ncelab to build the model, and then invokes the ncsim simulator to simulate the model. # A9 r/ v5 B6 ~8 JMulti-step invocation: invoke ncvlog, ncelab, and ncsim separately. % R9 i0 h% z6 F5 h, K4 F8 U=> : G0 K3 k- p: o) AThe cell binding mechanism is the major difference between the two invocation methods. " `' x% ]. N5 p0 ~) U) o6 b6 g   I8 V9.ncpack:change the properties of a database to make it read-only or add-only. . E0 l& n1 q2 h) /; p" y3 `9 Yinca.architecture.lib_version.pak ! ^5 f- N, R2 `7 ?1 C! H   Iinca.sun4v.091.pak * [- T+ i4 p8 _! Oncls utility: list the objects contained in the library system, 1 w+ k- [% U* u. U' `& c5 b. s4 ]+ j* o, s10. Library files protect: . g9 w+ f6 ^9 u   V, L5 j( {(1) file locking mechanism: ncpack -unlock, to unlock a file * _* Z1 D$ q9 o7 t' q* o(2) signal handling mechanism ensures that any unexpected event, 0 _! X8 i. A( g! F+ S, C9 P5 r$ J: o0 T0 q) |11. cdsdoc: 3 }- X, F5 }) k+ p8 Y% ]% bTo invoke the Cadence documentation window 3 a+ e1 M) k3 ?* j# x: L) M% Jtool_name -help $ H' n& K( ~   e( h( _/ B( cnchelp [options] tool_name message_code ******* ; o' Q' y. D2 q# H   p6 M0 d" hncsim> help [help_options] [command | all [command_options]] 7 ]0 Y& M% /7 G4 Y, a4 P0 C- a$ B8 Y& S& g11. ; R* X" ^& [! O; A- lNCLaunch is a graphical user interface ( Q% R6 /& v9 t0 c) Enclaunch 3 e$ Q+ J: l3 S; c. O6 F( VSimVision Waveform Viewer, ; S" O7 Z6 n# |9 U" ?* d* q0 /7 e" _1 i' r: y1 D' M* u/ Z12. 8 E! K& j- O7 N+ ~! Q0 Q1 N* w3 CMany of these options have a corresponding plus option that you ( J$ [8 b% o' t) Ucan use on the ncverilog command. ; u5 M% f# g* U& f+ Q' [   zncvlog -ieee1364 => ncverilog +ncieee1364 4 h   D; J8 [   |# _! ~6 aWhen you run ncverilog, the parser is invoked with the -update option by default. 2 M8 O* k& L$ Y' F) p1 u2 [: ~8 h& f2 d13. ncverilog:    r: k# x4 J5 g! x# G   q, U$ P(1) +debug. This option turns on read access to all objects in the design. , o' h5 y' Z/ ?1 R=> ncelab -access +r - A) {7 S/ }6 x* V5 u4 z(2) +ncaccess+. Use this option to selectively turn on different kinds of access. * @0 g% D8 Y9 E, c$ g( /2 ve.x.: +ncaccess+r, +ncaccess+r+w - M/ q/ s5 F2 i" e0 b(3) +ncafile+access_file: to specify an access file, # [) j) K8 A' q5 O, Q# G- O/ Q6 Y2 n9 ^2 ]5 cThree access: ) I7 G$ M5 Y$ H1 G$ lEnabling Read, Write, or Connectivity Access to Simulation Objects. 0 }   l' d3 b" H" R- R( I, r5 {0 U4 K" P* l3 g14. % d7 l7 A& ?$ R4 m' Rncsim -licqueue: license queue 9 w9 j4 U# W# H6 O( D% K(当license不足的时候,用这个语句可以确保有人退出的时候,你能及时获得license)" A. F8 I* b' B" IThe NC-Verilog simulator command language is based on Tcl. 6 d( s/ ]; B+ ~4 KTCL input file: +ncinput+filename or +tcl+filename; ! ]6 v+ R& u2 @( l$ /) d   ]5 S& w9 ^& r- n5 O15. 4 a4 b0 j9 ^) X8 m, cncverilog.args in the snap.nc directory: command-line options of ncverilog ( r: Q8 N' D2 h6 p- y1 ^   C(所以前一次的命令在彼处有保存)/ i( x+ N/ j: R) C: g& D# d* w" E6 T7 P# s! F) v, V2 ccds.lib and hdl.var file in the INCA_libs directory. ! a. k( m; f' N8 k5 W4 ?% ]3 `2 J% S# g5 }- [7 ?All tools share a common log file named ncverilog.log. 5 d; o. m9 p$ Z& D5 ^$ [/ C(查看log文件从而掌握运行时情况是最重要的debug方法之一)& g" t/ g$ D5 f8 y) @) L9 E: s9 s9 `" r: ]/ S0 FDesign units in files specified directly on the command line are compiled into the work library, and design units specified in -y libraries or -v library files are compiled into libraries that have the same names. 9 X2 M$ u: `; i: Y( `: ?, {) t& t: s- V4 b0 J$ `. W. a. mWrites the SNAPSHOT variable to the hdl.var file in the snap.nc directory to store the name of the snapshot used in this run. 3 }$ O0 o; L/ l# J; ?+ }% w" U; r% A---The SNAPSHOT variable in the hdl.var file is used to determine what snapshot was + u/ z- B, [% t6 c# Vcreated the last time this directory was used. ) ^. m9 P3 N/ T6 a6 ?- @0 X& F9 e7 J' ~# L7 {16. The next time you invoke ncverilog, it compares the current set of command-line options to the options stored in the ncverilog.args file. All of the plus options and dash options must be the same and in the same order for the options to be evaluated as equal. $ u6 o5 b2 r9 [8 h% V" B4 ~8 G. w3 x" `; q17. ' T9 N' n: _1 }# r* T( P2 ~4 }. OThe ncverilog +ncuid+ncuid_name option enables functionality in ncverilog that lets you run multiple simulations using the same intermediate objects and the same storage locations. The +ncuid+ option enables this functionality by providing a unique ID name for each simulation. : t7 ?) k* k+ j' S6 /0 G0 y/ y( M% y   z18. (命令行参数含义)1 z2 R$ f0 `' B5 /, e+ F8 l+ b1 Gncverilog -h +all 0 k4 s: h# c( z+cdslib+path * u/ N: O. W$ e" I6 q1 _+checkargs: Display a list of the arguments used on the command line. . m/ k: M7 H   B6 i; F* T0 B+compile: Run ncvlog to compile the design, but do not invoke ncelab to elaborate the design or ncsim to simulate. ( }* ?& U1 T; H! n) y# t9 V5 m* E+debug:Turn on read access to all objects in the design. 2 y   z" K! i; V/ F9 YThis option is the same as +ncaccess+r. & ~( f4 e( F; y   `: P( X+elaborate:Run ncvlog and ncelab % g0 C; a( p8 k3 a" L: z$ I+expand: Expand all vectors. + F6 p" G3 V, |( D4 D+hdlvar+path 4 K& y0 Z% o+ Y6 o5 G$ k-h ! J; Z7 a* t/ t3 A* u$ G: d9 x4 n5 n+import:Prepare this Verilog design for import to VHDL. 1 Z$ ~! A6 o+ K+mixedlang:Search the library structure for a VHDL binding for instances that correspond to VHDL import. 9 v" J) q; a% S3 D1 y' H/ @5 n% Z+name+name: Use the specified name for the snapshot and for the INCA_libs/snap.nc directory. 0 v3 i1 h3 i6 O8 ]/ J+ncelabargs+string:Pass the specified ncelab command options to the elaborator before invoking it. 4 c1 q! G8 e3 t0 Y! B; l0 S3 H+ncelabexe+path_to_ncelab 3 F8 `9 p2 H- e! P' k1 B: a: d; g+ncerror+warning_code:Increase the severity level of the specified warning message from warning to error. 1 Q* ]$ C/ x7 a* u+ b7 }) s3 V+ncfatal+{warning_code | error_code}: Increase the severity level of the specified warning message or error message from warning or error to fatal. 8 c& u0 T; s7 b9 S: ^+nclibdirname+directory_name: to change INCA_libs & Y+ Y5 G. w   O4 ?+ncls_all:List all of the objects in all libraries. # d   d' u   {* y1 U, q; }( B+ncls_dependents:Show the dependents for each object. & j2 j/ g- s, w0 D: V, Y+ncls_snapshots: List all snapshot (SSS) objects. ( ^8 k% s0 G$ l: P4 q* n8 s1 p+ncls_source:Show the source file dependents of each object. ; V- a3 }* _5 B0 D   /0 E: T+ncsimargs+string $ Q8 F9 W4 M- X. {/ y+ncsimexe+path_to_ncsim 5 @. B: f1 C! {* d* U* ]+ncuid+ncuid_name + M# g( B, w( a7 x, D+ncvlogargs+string ' X1 _0 O/ Z* l6 `: O7 X+noautosdf:Do not perform automatic SDF annotation. % o. {* Z   {1 m+noupdate: prevents the writing of intermediate objects for design units that are up-to-date. + W7 p( g+ e2 G+ `+ppe:Invoke the Post Processing Environment (PPE). 6 J) |4 _6 f- x-R: Invoke the simulator (ncsim) to simulate the snapshot in the INCA_libs/worklib directory. & Q% `, ^6 B( c   [-r snapshot: Load the specified snapshot. * _. x5 O6 f$ T" }: r7 ?+sdf_orig_dir:Put the compiled SDF file in same location as the original SDF file. : ~5 n. y) ^+ R+work+library_name:Use the specified library as the work library. ( K9 Z6 @0 ^8 G" [6 J-c Compile and elaborate only. //same to Verilog-XL & {0 M! O. P+ x& I4 A; h( w% N& F* h0 T% m* C' W20. , S. ]4 b( g6 e* e& p3 A( kncverilog: 0 p- K9 @. k8 o2 s2 f* a% R+tcl+filename,+ncinput+filename:The NC-Verilog simulator command language is based on Tcl. 4 z3 ?% `- a# v, e6 R7 K6 h& r: v: a% ?1 D1 @# g& H21.The compiled SDF file:dcache.sdf.test1.X). " E% r2 L4 /9 [# n0 W: L6 QSnapshots are always named lib.cell:ncuid_name + @& b8 L1 @- /9 S3 _5 P7 J+ [' Q" z: _- _/ B. i22. $test$plusargs ) |# Z8 W4 D2 B, _# Y6 G4 r% ncverilog -R +userarg 0 ~9 `! {7 j3 u2 L- r% ncverilog -R +some_other_userarg 3 |$ I& c7 q; w/ C% E5 v: E. N0 e3 S1 g- ?( T& O) b4 U7 T0 }( v23. // To understand the concept of Snapshot ; l! V9 e$ [1 L1 T- h! E   x% ncverilog source.v +ncuid+test1 # O: f( s1 r9 P' ~/ r$ V% ncverilog source.v +ncuid+test2 , M+ e: o& ^% k. O: P4 I. uTwo snapshots are generated in the INCA_libs/worklib directory: ! I1 V, H& @# u- U) a3 Cworklib.top:test1 and worklib.top:test2. , ]0 x- J* Y+ `4 m8 _" j+ }) g, H4 r! F- T: @% {% Eyou generate two snapshots using the following command lines: $ o- p% |7 Q   w: }1 c! J, /% ncverilog source.v +elaborate ) I+ a' J5 e: z+ o, E+ f% ncverilog source.v +elaborate +ncaccess+r +nclibdirname+MYINCA_libs +name+debug + ]' r8 L, R) ?$ V+ K- v=> To simulate this snapshot: 6 z9 A# a4 A% k6 d4 l! j% ncverilog -R +nclibdirname+MYINCA_libs +name+debug [+simulator_options] 4 B0 k# H- f8 M0 /6 z2 a0 h# u/ t$ L. Y/ W& N$ }24.Using -r to Simulate a Saved Snapshot: , P/ b8 I$ x+ V3 Z/ h9 L% ncverilog -f verilog.vc +elaborate & F4 o" W* T9 |! q3 c% ncverilog -R -s - R! R2 }% @9 F) Z% b. T+ Uncsim> run 1000 5 V) V( h" j! p' u, x" tncsim> save save1 + O3 b) j6 |$ X' [9 R( B( lncsim> exit * [5 x& f, q7 T8 e8 B/ Z, p8 S% n. E" F# I   [//To simulate the saved snapshot, specify the snapshot name with the -r option, & Z6 V* n) w! k7 N# B. N) F   P% ncverilog -r worklib.save1:v // or: ncverilog -r save1 2 q% {4 h) v5 c4 S/ @; ?' j$ R* i2 j- i7 p# e' k=> Simulation Environment: + O! ^/ |' X; v" I* M: ^. ^' eIf you want to restore the full Tcl debug environment when you restart with a saved snapshot, make sure that you save the environment with the save -environment filename command. This command creates a Tcl script that captures the current breakpoints, databases, probes, aliases, and predefined Tcl variable values. You can then use the +ncinput+ option when you invoke ncverilog to execute the script, or you can invoke ncverilog in interactive mode with the -s option and then use the Tcl source command to source the script. $ ]: b3 h! c: s4 E3 P. V. c$ k$ t1 S   [3 l1 {ncsim> save -environment ckpt1.tcl * X) d3 ^2 B7 l& F$ /% U" G% R/ d! K$ ancverilog -s -r worklib.top:ckpt1 +ncinput+ckpt1.tcl & m( k1 R- j6 J1 j/ m2 Z% d$ X: U: i' u3 ^Note: If you set a breakpoint that triggers, for example, every 10 ns (that is, at time 10, 20, 30, and so on) and restart with a snapshot saved at time 15, the breakpoint triggers at 20, 30, and so on, not at time 25, 35, and so on. * }( ?9 L7 P3 t( B0 M# A* }4 ^- r: B8 z& C' Z2 M6 l, G( Z25. 6 x. X" d# {+ M. s6 ?-R: The -R option lets you simulate the same snapshot multiple times using different simulator - B* i& l0 D* H) |command-line options. $ /! w. g) R, W3 F" p% B% Y6 ?0 ~& I/ a8 D$ {$ D; /- {. Q-r: You can use the -r option to load a snapshot. - F) R+ o9 q; g) ]- M! E8 G2 j% o) J4 I: /6 e5 D: |/ U26. " m+ y# q; e, Y) c% R( sSDF versions 1.0, 2.0, 2.1, and 3.0. For versions 2.0 and above, use the SDFVERSION statement in the header of the SDF file to specify the version. # S1 p% O5 p; V& H+ C3 {; H. X- ESDF annotation is performed during elaboration. The elaborator recognizes $sdf_annotate system tasks in the design source files, ! I1 y+ @9 y! t; N; k8 u2 |! X& v   S, l   Pto override the default automatic SDF annotation mechanism and force annotation by using the +sdf_cmd_file+filename option , y. P+ j. d) a8 K3 u. i# M# v2 H" @& B3 }, }2 X9 E4 A( F- y8 LSDF: The NC-Verilog simulator reads only compiled SDF files. 6 d& A9 n2 i1 }(1) text SDF file, cpu.sdf, ' L; W2 ~9 G. V" v6 B(2) compiled file: cpu.sdf.X. 6 N! T7 w* D- _5 H5 e7 s- U; o0 ?2 X, b4 fncsdfc utility to automatically compile the SDF file. " C4 ~) j6 G+ D' ^2 Y& /& R+ j: T" ]& Z$ ~9 B2 I& o. D   k, c% /' EUsing $test$plusargs to Selectively Perform Annotations: 4 l& A   T+ h( P: E9 Lif ($test$plusargs( preroute )) 4 b1 v2 R% W3 /% j+ V$sdf_annotate( preroute.sdf , m1); / v4 o) M* G; c1 X8 Z" R8 aelse if ($test$plusargs( postroute )) 8 s1 G& ^9 e6 R   z$sdf_annotate( postroute.sdf , m1); $ n( {2 C. q9 y9 W1 X$ ~( ^! X$ V6 /$ v! x9 RThe ncsdfc utility always compiles the SDF file with a precision of 1 fs. The elaborator annotates each module using the precision of the module or the precision set by using the ncelab -sdf_precision command_line option. 8 ?   t- C7 L; `. /! o1 ?! ?8 H! E& P3 o. k. l0 s( V30.Turning Off SDF Annotation: * o. @% q/ d# Y; W3 h% Q. s0 x6 V(1) Use the +noautosdf option on the ncverilog command line. . J& W% b- H8 f   I9 w(2) Comment out the $sdf_annotate system task(s) in the Verilog source file. ) m. {: ]5 ~3 D5 N# b2 j; ?4 `31. 4 k, Q; ^   {/ Y2 Q5 M+sdf_cmd_file+filename 9 J' [2 P   n- Z3 n3 v. r, k/ O: C2 b1 n8 X$ J- t! {; M32. & s% F$ v2 D1 R5 g% S+ i+ n$ z( b" I' I( ?9 i" |3 C: QYou can use the -ieee1364 command-line option when you compile the design with ncvlog and elaborate the design with ncelab to check your code for 1 {: J" a; F2 Z9 [5 K) L( dcompatibility with the IEEE standard. + P1 H( o" |, W! l6 E* H$ P3 y' o' ?$ U! q( }" R4 q33. IEEE 1364 - 1995 Verilog: array of instances, bufif0 ar[3:0] (out, in, en); // array of tri-state buffers However, an array of instances must have a continuous range. : D7 V' q4 ]( z7 p. |( o3 ^; j" L5 S7 x3 T% [# L! W' k34. Set up your environment: 2 ^* I- E* X   {0 x! R% s( pcds.lib , Z9 o- j- k4 [. qhdl.var . E/ D/ k5 R! Lsetup.loc * `! t+ t9 n( j5 n2 a) e9 n% u# X: u; l: Z; b! g3 J$ U3 Y35. 7 R. K) ~: H# R/ F2 O+ U4 BVerilog: module, macromodule, or UDP " u2 ?# I3 b" C, ]7 v2 e* RVHDL: entity, architecture, package, package body, or configuration % s1 I% z- V# h, `7 V: J% h: |3 T+ r: h+ k. z) e/ {36. * O4 h; _4 V7 Tinternal intermediate objects: ' B) g" w" R- b. u( W+ tlibrary database file (.pak file) * C- K6 v+ c% L( /! M8 p+ n5 A7 s" Y) h: U6 f1 G37. 6 |) x4 @$ W5 e5 @1 Ccds.lib: 9 w; /& m0 ?9 I3 r8 @DEFINE worklib ../worklib ' C' m0 G. D: {0 r" i# JDEFINE lib_std /usr1/libs/std_lib ) a! Z7 D5 o, j% o6 s+ n9 n/ X+ i7 g3 t7 X$ b- F% u1 wYou can have more than one cds.lib file. 6 L8 J( n5 O6 c6 g9 NUse the INCLUDE or SOFTINCLUDE statements to include a cds.lib file within a cds.lib If you are doing a pure VHDL or a mixed-language simulation, you must use the INCLUDE or SOFTINCLUDE statement in the cds.lib (System provide one) ' q& U4 y* ^; N; y& N$ A6 Y5 P8 f8 j+ [; @! l1 aSOFTINCLUDE is the same as the INCLUDE statement, except that no error messages are printed if the file does not exist. $ b# a. V; L4 N% ?4 v6 {8 z/ q* Y% w# u7 {$ m0 z, V38. Binding One Library to Multiple Directories: / p9 e* E) V) NDEFINE iclib ./ic_lib 3 W( R- c; Y4 X3 ~ASSIGN iclib TMP ./ic_tmp_lib # C# }) Z/ E6 J" [/ x... 2 G) _7 u7 }! K5 R& m% T9 aUNASSIGN iclib TMP ; F5 i, U- T6 P& {0 D& a$ ^+ ]" W$ a* a6 i1 d2 p- k4 w38. -- can be used to check the content of the cds.lib # Q- o/ u# /5 k& w4 Q0 j% nchelp -cdslib 6 A8 {, W5 @9 }( {# C) H- s4 V5 R# y( o7 _6 ^+ A; w39. hdl.lib ; d' ]3 a# x0 J( y1 Y# fDEFINE WORK worklib & A+ q' i3 ]+ g, l8 v7 |. zDEFINE VERILOG_SUFFIX (.v, .vg, .vb) . U- |; _0 V$ d+ P! K+ y) T, ?NCVLOGOPTS -messages -errormax 10 -update 1 O- G. l, i" B! q* N6 |   U' H. O2 ~/ l5 S/ A40. hdl.var & q' u# W# @2 C% nchelp -hdlvar ; m3 H7 [' E   _9 q; t8 a* /; r7 G# m/ R' [41. view & snapshot $ e9 f. o: w* `3 V7 ^2 }1 w(1) The file mychip.v gets compiled into the default module view:worklib.mychip:module.    V% S7 b9 ?( M2 ^It is created after compile, (ncvlog) 2 Z4 ]3 M$ r9 h# G5 I9 o( C(2) The elaborator generates a simulation snapshot for the design. * K+ I, j+ /5 C; a8 `) N" ZIntermediate objects created during the elaboration phase are stored in the .pak file. , R: u2 i3 m: Y0 W5 B   u5 AThe snapshot is also a Lib.Cell:View. 9 q1 W" Y" S1 N; P. @3 y! Z9 p3 x+ }/ S5 b9 V9 ]! j! }% m7 r6 n. wsource =>(compile)=> module =>(elaborate) => snapshot => simulation, , M. /) R. `( gSo the snapshot is the object of simulator


    最新回复(0)