Friday, November 21, 2008     Register | Login | Search | Contact Us
     

Many of you already received communications about the move of the Cadence user community into cadence.com. And many of you have already joined, with over 4000 registrations in the first two weeks.

The new Cadence Community enhances the ability of Cadence users to connect and collaborate. In addition to moving the community into cadence.com -- enabling single sign-on for community, Sourcelink and Cadence events -- the new site is organized around nine technology segments, giving you easy access to product information, training, forums and blogs. Some of the new features include:
  • Ability to respond to posts via e-mail
  • Technology-specific blogs
  • Latest Web 2.0 social networking capabilities
  • Public profile options
  • Private messaging
  • Friends lists
Visit the new Cadence Community today at www.cadence.com/community and join the discussions!

Registration note: Due to the scope of the enhancements and the new SSO registration system, we were not able to migrate existing cdnusers.org member accounts. So new registrations are required, but this enables a broader set of functionality we think you'll enjoy.

Forum note: Under the guidance of forum moderators, we have taken the 20+ cdnusers.org forums and consolidated them into 11 forums on the new site. Posts have been brought over so you can leverage that posting history. CDNusers forums will be set to read only starting 7/30, and cdnusers.org will be redirected to the new community on 8/4.

Best regards,
Mike and Tom

Michael A. Catrambone - Steering Committee Chairman
Distinguished Engineer
PCB/Mechanical
UTStarcom, Inc.

Tom Diederich
Cadence Community Manager
Home
Forums
Subject: parsing the arguments from command line
Posting to forums is available to community members only.
Login or Register
Rate this topic:
   
Author Messages
knrajesh29
Posts: 1
Online: User is Offline
4/26/2007 2:18 AM  
Hi,

My requirement is that from the command line,  I need to pass arguments.  And in the system verilog class, I need to parse the argument and based on that I have to set some constraints.

For an example,  I have 2 different packets, pkt1 and pkt2.  Suppose if I pass the arg as pkt1_25_pkt_10, pkt1 and pkt2 should be generated in the propotion of 25:10.

vsim -c ..... +test_args=" -pkt_mode  pkt1_25_pkt2_10" ....

Could you please give some clue on this ?

Thanks.
stephenh
Posts: 77
Online: User is Offline
4/26/2007 2:29 AM  
Hi.

This is quite easy to do. If you have the Verilog manual, just search for "plusargs".
Here's a small example:
if ( $test$plusargs("verbose") )
$display("a relly verbose message");

Or to get a value from the arguments:

string testname;
TESTNAME_GIVEN : assert ( $value$plusargs("testname+%s", testname) )
else $fatal(1,"No +testname+xyz argument passed to simulator.");
if ( testname == "AddrTest01" ) RunAddrTest01;
else if ( testname == "AddrTest02" ) RunAddrTest02;

Then when calling ncsim:
% ncsim snapshot +testname+AddrTest01 ...

Hope this helps.

Steve.

Steve H.
prasad_vc
Posts: 0
Online: User is Offline
4/26/2007 2:49 AM  
I don’t know how you will use it with vsim (modelsim) but in ncsim you can use it like shown below,

ncsim –define pkt1=25 –define pkt2=10

This will make the variables pkt1 and pkt2 visible in the code and and inturn you can use it like

int packet1 = ‘pkt1;
int packet2 = ‘pkt2;

Now, use the packet1 with the value 25 and packet2 with value 10.

-Vivek
tmackett
Posts: 34
Online: User is Offline
4/27/2007 10:05 AM  

If $test$plusargs isn't what you need, there's another way to pass arguements  into the simulator.  Any +arguement not recognized by nceverilog or ncsim is passed into the simulator and is available for TCL.  For instance:

ncverilog .... ... ... +test_name+mytestname
or
ncsim ... ... ... +test_name+mytestname

Then this can be extracted via TCL at the NCSim command prompt:

set covTestName "+test_name+"
foreach i $argv {
  if {[string match [format "%s%s" $covTestName "*"] $i]} {
    set my_test_name [string range $i [string length $covTestName ] [string length $i]]
  }
}

puts "Test Name: $my_test_name"


Todd Mackett
Cadence Incisive
Posting to forums is available to community members only.
Login or Register

Forums > Functional Verification > SystemVerilog > parsing the arguments from command line


ActiveForums 3.6
     
Copyright 2006 Cadence Design Systems, Inc.