[SAL-HELP] [Fwd: Doubt regarding simulation( immediate help needed)]

Bruno Dutertre bruno at csl.sri.com
Wed Feb 21 18:50:43 PST 2007



-------- Original Message --------
Subject: Doubt regarding simulation( immediate help needed)
Date: Wed, 21 Feb 2007 15:59:46 -0800 (PST)
From: suman kasam <sumankasam1 at yahoo.co.in>
To: Bruno Dutertre <bruno at csl.sri.com>

Hi,

         I am facing a problem in simulating the SAL code.Can some one help me in getting rid of that.

       I am dealing with a 4 dimensional array and few 2 dimensional arrays in my model which consists of a lots of constants or say input data.I have two constants  N and T and the arrays are of sizes N , T and N+T. My SAL code works properly for values of N=5 and T=3 . From then if i increase the size of N or T by just 1 the parsing of model is never ending. (also there are many arithemtic operations performed on the array elements).

      Can any one help me in this with some predictions for  the reason behind the problem.Does some SAL codes really take days to simulate.Of course for me it is taking days just to parse the model.

         Is there some reason behind it or it is only bcoz of some bugs in the code.

   Thank you,

   Regards,
   Suman Kasam
Bruno Dutertre <bruno at csl.sri.com> wrote:
   suman kasam wrote:
> Hi,
> 
> Can some one help me in executing loops in SAL.I have an array the sum of whose elements is 1.Thus if one of the element in the array is '1' I have to make remaining all as 0's.Can I use loop statements in SAL. If yes what is the syntax for its use.Presently iam trying to implement it using recursive function call.But if looping statements can be used it becomes pretty easy.
> 
> Please help me in this .
> 
> Thanking you,
> Regards,
> Suman Kasam
> 

Hi,

There is no imperative loop in SAL. But there are ways of defining arrays
that do not require defining recursive functions. For example, you can
write

N: NATURAL = 10;
ID: TYPE = [1..N];
A: TYPE = ARRAY ID OF NATURAL;

set_one(n: ID): A = [[i:ID] IF i=n THEN 1 ELSE 0 ENDIF];

Then set_one(n) is an array with one element 1 and all others 0.
You can also use array updates:

all_zero: A = [[i:ID] 0];
set(n:ID): A = all_zero WITH [n] := 1;


Bruno




---------------------------------
No need to miss a message. Get email on-the-go
with Yahoo! Mail for Mobile. Get started.



More information about the SAL-HELP mailing list