Hi everybody, I wrote an ocean-script to perform some parametric calculations. Within this script I use the following expressions: if(( cornerType == "ws" ) outp = outfile("./results.log")) if(( cornerType == "ws" ) ocnPrint( ?output outp ?width 11 ?numSpaces 1 "corner" "r_length" "cf" "ccomp" "rvalue" "BW" "Noise" "Overshot" "Target" )) ocnPrint( ?output outp ?width 11 ?numSpaces 1 cornerType evalstring( desVar("r_length")) evalstring( desVar("cf")) evalstring( desVar("ccomp")) r b n ue zf ) close(outp) The variable cornerType is set to "ws" at the beginning within a foreach-loop. Tha expressions above are all within this loop. The close(outp) is out of the loop. When I start this script with ocean it works fine. The file results.log is opened, the results from each run of the loop are wirtten to the file and the file is closed. When I call ocean from within a C program using the following expressions ( an .oceanrc with the file name of the script is existing): sprintf(h_txt, "ocean -nograph\n"); system(h_txt); it returns the following error messages What's wrong? The call from within the C program works if I don't use the output expressions above. -- Best regards Frank. F. Nitsche Technical Manager Chipdesign MAZeT GmbH
Without seeing the whole example, I can't be sure. However, one thing that doesn't look right - there shouldn't be a "\n" in your sprintf in the C program - since the command shouldn't have a carriage return at the end of it. I can't quite see why that would have the problems you're seeing, but it's worth a try. I assume that when you try it normally you just do "ocean -nograph" too? Andrew.
just had a look on sourcelink. there's a solution on this issue (#11110574) here's what it says: This occurs only in the case when a simulation has not been run before using ocnPrint. This is because ocnPrint requires that the path to resultDir should be set. The path to resultDir is set by default if the simulation is run, or this can be set using openResults function. To overcome this problem use the openResults function to set the path to a valid PSF directory. stephane
Thanks, it seems to be the solution. I made some experiments in the last days regarding this point and came to the same result. It's important to have a results directory with valid psf data. It works also without running a simulation within the script, but I must have run a simulation anytimes before to have valid psf data. I only have to select a simulator, a results directory with valid psf data and openResults(resultsDir()). This has to be done also when I only use internal variables ( which would no require any simulation). The example looks like this (xxx.inc contains desVar expressions e.g. for the variable "laenge"): simulator('spectre) resultsDir("./res") load("xxx.inc") openResults(resultsDir()) selectResults('variables) outp = outfile( "xxx.log" ) laenge = evalstring( desVar("laenge")) d = (laenge+2.0)*(laenge+2.0) ocnPrint( ?output "xxx.log" d ) close(outp) ocnPrint(?output "ocean_out" d) exit This example works with ocean, ocean -nograph and also with the system call from within a C program. I've also seen the print expression in ocean which can also print to a port. What's the difference between ocnPrint and print ? Using ocnPrint I can place format informations within the expression. Is this the only difference? Best regards Frank. -- Mit freundlichen Grüßen ========================================================= Dr. Frank Nitsche Technischer Leiter Chipdesign MAZeT GmbH Email: mailto: Göschwitzer Str. 32 Tel : (3641) 2809 0 D-07745 Jena Fax : (3641) 2809 12 Besuchen Sie bitte unsere Web-Seiten: http://www.MAZeT.de =========================================================
printf() is the low level SKILL function (based on the C printf function). It can deal with printing individual values (although it does handle lists). ocnPrint is a higher level function - geared up more for dealing with waveform objects and so on. You can control the precision and formatting to some extent, but whilst more convenient than printf for waveform objects, it is less flexible overall. (note, you can print a waveform object directly with a single call to printf). Andrew.