473,382 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Sending exit to vsim prompt

4
Hi,
I work on modelslim installed on unix server.It has its own prompt called vsim prompt.By using perl script,i call the vsim prompt ,I run what i want and then its stays in vsim promp.so,my question is how to switch to unix prompt from vsim prompt.

the following is the code:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/intel/bin/perl
  2. $vlog = "vlog *.v < tt.txt";
  3. print "$vlog";
  4. open (PINGTEST, "vsim rwr0unit -f tcl_script -c |");
  5. $i=1;
  6. while (<PINGTEST>){
  7.     print "Line # ".$i." ".$_;
  8.     $i++;
  9.     print STDOUT "exit" if $_ =~ /VSIM/; ## need help over here.
  10. }
  11. print "All done!\n";
  12. close PINGTEST;
  13.  
Thanks,
Tushit
Jul 20 '07 #1
7 4092
miller
1,089 Expert 1GB
If you want to interact with an external program, then what you're looking for is Expect.

cpan Expect

- Miller
Jul 20 '07 #2
tuspa
4
I know that exit is the command to exit vsim.so what will be coomands in CPAN.
Thanks
Jul 20 '07 #3
miller
1,089 Expert 1GB
Observe the following two scripts.

Expand|Select|Wrap|Line Numbers
  1. # name: vsim.pl
  2. #
  3. # Response to http://www.thescripts.com/forum/thread680957.html
  4. #
  5. # Script to simulate interaction of the vsim prompt.  Give introduction,
  6. # then prompt to exit command.
  7.  
  8. use strict;
  9.  
  10. print <<'END_INTRO';
  11. Mary had a little lamb
  12. Then the lamb ate Mary
  13. and it was little no more.
  14. END_INTRO
  15.  
  16. my $choice = '';
  17. while ($choice ne 'exit') {
  18.     print "VSIM: ";
  19.     for (;;) {
  20.         $choice = <STDIN>;
  21.         chomp $choice;
  22.         last if $choice =~ qr/^\w+$/;
  23.         print "VSIM (requires a single word; exit to quit): ";
  24.     }
  25.     print "You typed '$choice'\n";
  26. }
  27.  
  28. 1;
  29.  
  30. __END__
  31.  
Expand|Select|Wrap|Line Numbers
  1. # name: scratch.pl
  2. #
  3. # Response to http://www.thescripts.com/forum/thread680957.html
  4. #
  5. # Script to simulate interact with the vsim.pl script.  Goal is simply
  6. # to print the introduction of the vsim.pl script using the Expect
  7. # module.
  8. #
  9. # Dependency: Expect
  10.  
  11. use Expect;
  12.  
  13. use strict;
  14.  
  15. my $exp = Expect->spawn("perl vsim.pl")
  16.     or die "Cannot spawn: $!\n";
  17. $exp->log_stdout(0);
  18.  
  19. $exp->expect(5,
  20.     [ qr/VSIM:/ => sub {
  21.         my $exp = shift;
  22.         my $linenum = 0;
  23.         for my $line (split "\n", $exp->before) {
  24.             print 'Line # '.++$linenum.' '.$line."\n";
  25.         }
  26.         $exp->send("exit\n");
  27.     } ],
  28. ) or die "Expect timed out: $!";
  29.  
  30. $exp->soft_close();
  31.  
  32. 1;
  33.  
  34. __END__
  35.  
You'll need to look at the Expect module documentation that I linked to before. But if you're running this on a unix based system, this should work just fine.

- Miller
Jul 23 '07 #4
tuspa
4
sir,thanks for the reply..but you are not understang my question.
look at this

#!/usr/intel/bin/perl
$vlog = "vlog *.v > tt.txt";
print "$vlog";
system ("vsim rwr0unit -f tcl_script -c > tt.txt");=> this line runs the in build
script and calls upon the modelsim.
close PINGTEST;

Output what i get is
filc5087[84]% perl tu_2.pl
vlog *.v < tt.txtReading /nfs/site/eda/data/eda410/mentor/modelsim/6.2d_cse/common/tcl/vsim/pref.tcl

# 6.2d

# vsim -L gtech -L dware -L dw01 -L dw02 -L dw03 -L dw04 -L misc -L ctech -L misr -L noa -L spymi -L test_bench -L spypipecs -L gfxramdft -L gen6mem -L aub_ware -L
ramdft -L maunit -L icunit -L emunit -L euunit -L fpuunit -c rwr0unit
# // QuestaSim 6.2d Oct 16 2006 Linux 2.6.5-7.276.PTF.196309.1-smp
# //
# // Copyright 2006 Mentor Graphics Corporation
# // All Rights Reserved.
# //
# // THIS WORK CONTAINS TRADE SECRET AND
# // PROPRIETARY INFORMATION WHICH IS THE PROPERTY
# // OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS
# // AND IS SUBJECT TO LICENSE TERMS.
# //
# Loading /p/gen6/validation/3d/rowwrapunit/models/v070719_tus/lib/rowwrapunit.rwr0unit
# Loading /nfs/site/eda/data/eda410/mentor/modelsim/6.2d_cse/common/linux/../sv_std.std
# Loading /p/gen6/validation/3d/maunit/models/latest_rel/lib/maunit.maunit
# Loading /p/gen6/validation/3d/maunit/models/latest_rel/lib/maunit.inarb
# Loading /p/gen6/validation/lib/aub_ware/models/v070703r/lib/aub_ware.gen_fifo
# ** Warning: (vsim-3010) [TSCALE] - Module 'gen_fifo' has a `timescale directive in effect, but previous modules do not.
# Region: /rwr0unit/maunit0/inarb1/td_ma_data_input_fifo
# Loading /p/gen6/validation/lib/aub_ware/models/v070703r/lib/aub_ware.gen_ram
# ** Warning: (vsim-3009) [TSCALE] - Module 'gen_ram' does not have a `timescale directive in effect, but previous modules do.
# Region: /rwr0unit/maunit0/inarb1/td_ma_data_input_fifo/RAM0
# Loading /p/gen6/validation/lib/dware/models/v070706.1/lib/dware.DW01_decode
# ** Warning: (vsim-3009) [TSCALE] - Module 'DW01_decode' does not have a `timescale directive in effect, but previous modules do.
# Region: /rwr0unit/maunit0/inarb1/td_ma_data_input_fifo/RAM0/WR_DECODER
# Loading /p/gen6/validation/lib/dware/models/v070706.1/lib/dware.DW01_mux_any
# ** Warning: (vsim-3009) [TSCALE] - Module 'DW01_mux_any' does not have a `timescale directive in effect, but previous modules do.
# Region: /rwr0unit/maunit0/inarb1/td_ma_data_input_fifo/RAM0/INST_MUX
# Loading /p/gen6/validation/3d/maunit/models/latest_rel/lib/maunit.outarb
# ** Warning: (vsim-3009) [TSCALE] - Module 'outarb' does not have a `timescale directive in effect, but previous modules do.
# Region: /rwr0unit/maunit0/outarb1
# Loading /p/gen6/validation/3d/maunit/models/latest_rel/lib/maunit.ma_clkgatefub
# ** Warning: (vsim-3009) [TSCALE] - Module 'ma_clkgatefub' does not have a `timescale directive in effect, but previous modules do.
# Region: /rwr0unit/maunit0/ma_clkgatefub1
# Loading /p/gen6/validation/lib/misc/models/v070718/lib/misc.clock_gate
# ** Warning: (vsim-3009) [TSCALE] - Module 'clock_gate' does not have a `timescale directive in effect, but previous modules do.
# Region: /rwr0unit/maunit0/ma_clkgatefub1/ma_clock_gate_i
# Loading /p/gen6/validation/3d/maunit/models/latest_rel/lib/maunit.ma_noa
# ** Warning: (vsim-3009) [TSCALE] - Module 'ma_noa' does not have a `timescale directive in effect, but previous modules do.
# Region: /rwr0unit/maunit0/ma_noa1
# Loading /p/gen6/validation/lib/noa/models/v070327/lib/noa.noa2_varnodes
# ** Warning: (vsim-3009) [TSCALE] - Module 'noa2_varnodes' does not have a `timescale directive in effect, but previous modules do.
exit => this is what i type to exit from the vsim command.
VSIM 1>filc5087[84]%

So i want to know how to send the command exit from script rather than typing manually.

Thanks
Jul 23 '07 #5
miller
1,089 Expert 1GB
sir,thanks for the reply..but you are not understang my question.
No. I'm understanding it just fine.

Take a look at the scripts that I provided to you, and the module that I gave a reference for. You'll be able to figure it out from there.

- Miller
Jul 23 '07 #6
tuspa
4
I tried with one which you gave it to me by schanging perl vsim.pl to perl tu_2.pl,VSIM: to VSIM 1>,but still it is not working.olease help me.
Jul 23 '07 #7
miller
1,089 Expert 1GB
I've helped you as much as I can.

"Expect" is the tool that I would use for this type of problem (assuming you're on unix). The example scripts that I provided demonstrate how this would be done.

You'll have to figure out how to apply it to your problem yourself.

- Miller
Jul 23 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: drose0927 | last post by:
Please help! I can't get my program to exit if the user hits the Escape button: When I tried exit(EXIT_SUCCESS), it wouldn't compile and gave me this error: Parse Error, expecting `'}''...
11
by: Peter Steele | last post by:
I have a Windows application written in C# that I want to return a non-zero exit code when it it run. The problem is that as a Windows application, there doesn't seem to be a way to control this....
3
by: Micus | last post by:
Greetings, I need to execute 2 applications from an application or batch file. The first app launched has the user enter a product key and the app's exit code will be 0 (failed) or 1...
6
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
4
by: eva.monsen | last post by:
I'm trying to run a .BAT file using System.Diagnostics.Process. I'm having trouble getting Process.ExitCode to match up with what the .BAT file returns. Here are the contents of...
1
by: Chris Cairns | last post by:
I have a MDI Application and would like to prompt the user before exit. I placed the following in the FormClosing event. It appears to work properly, however when a user answers no to the...
1
by: yevgenia | last post by:
Hi there, I am developing an application in Access 2003 and need to send an email through Outlook based on the information entered on the form. Everything works except that the email is being sent...
0
by: rd301 | last post by:
i want to send fillowing oralce commands at command prompt through VB-6 coding on the click event of a command button: sqlplus connect internal shutdown startup exit Can any one help me.
0
by: Graycon | last post by:
I am trying to reboot several devices on my private network through telnet. I wrote a vbs that does the operation but i cannot select any other window while it is running of the input will not go...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.