number conversion for use in property values in skill ?

R

RolfK

Guest
Dear All,

I'm unfortunately found myself still a skill beginner.
Please have alook at the following snipet:
#################################
procedure( CreateRCNetwork(Width BaseR BaseC MetalNumber )
let( ( ScaleFactor RValue CValueRL CValueMid
SchematicName )

ScaleFactor = 80/Width;
printf("%f" scaleFactor )

;RValue = sprintf(nil "%fm" baseR * ScaleFactor) ;
;CValueMid =sprintf(nil "%fp" baseC * ScaleFactor) ;
;CValueRL =sprintf(nil "%fp" baseC * ScaleFactor / 2) ;


;SchematicName= sprintf(nil "RCBASE80R%dC%dM%d" RValue CValueMid
MetalNumber);
;cvID= dbOpenCellViewByType("GENERIC" SchematicName "schematic"
"schematic" "w")

); let
);procedure

CreateRCNetwork(160 100 2 1)

###########################################

I already got stuk at the simple first print statement (just for test)
==> *Error* fprintf/sprintf: format spec. incompatible with data - 0
My final goal is to calculate the schematicname and to calculate some
property values for
the values of R and C to be instanciated later.

In general I have a lot of diificulties to undertand how strings and
numbers are handled in skill.
Also it looks like that there in no function to avoid sprintf just to
create a value string like 100p for e.g a capacitance property value.

Could someone help me on that please ?

Thanks a lot
Rolf
 
Rolf,
There are two types of numbers in SKILL. fixnum (integers) and float.
The arithmetic operations become integer operations when both the
operands are integers (fixnum).

For example, 2/1 => 0

When at least one of the operands is a float, then it becomes a
floating point arithmetic operation and which is what we want in most
of the times.

So, its better to convert unknown number values to avoid possible
integer operation. To do so, we can use float()

In your function, just change ScaleFactor = 80/Width; to ScaleFactor 80.0/Width or ScaleFactor = 80/float(Width)

Regards,
Suresh

On Oct 11, 12:06 pm, RolfK <Rolf.Kem...@eu.necel.com> wrote:
Dear All,

I'm unfortunately found myself still a skill beginner.
Please have alook at the following snipet:
#################################
procedure( CreateRCNetwork(Width BaseR BaseC MetalNumber  )
let( (  ScaleFactor     RValue     CValueRL  CValueMid
SchematicName )

ScaleFactor = 80/Width;
printf("%f"  scaleFactor   )

;RValue = sprintf(nil "%fm" baseR * ScaleFactor)  ;
;CValueMid =sprintf(nil "%fp" baseC * ScaleFactor) ;
;CValueRL =sprintf(nil "%fp" baseC * ScaleFactor / 2) ;

;SchematicName= sprintf(nil "RCBASE80R%dC%dM%d" RValue  CValueMid
MetalNumber);
;cvID= dbOpenCellViewByType("GENERIC" SchematicName "schematic"
"schematic" "w")

); let
);procedure

CreateRCNetwork(160 100  2  1)

###########################################

I already got stuk at the simple first print statement (just for test)
==> *Error* fprintf/sprintf: format spec. incompatible with data - 0
My final goal is to calculate the schematicname and to calculate some
property values for
the values of R and C to be instanciated later.

In general I have a lot of diificulties to undertand how strings and
numbers are handled in skill.
Also it looks like that there in no function to avoid sprintf just to
create a value string like 100p for e.g a capacitance property value.

Could someone help me on that please ?

Thanks a lot
Rolf
 
For example, 2/1 => 0
Sorry, it should be 1/2 => 0

Regards,
Suresh


On Oct 11, 4:33 pm, Suresh Jeevanandam <jm.sur...@gmail.com> wrote:
Rolf,
 There are two types of numbers in SKILL. fixnum (integers) and float.
The arithmetic operations become integer operations when both the
operands are integers (fixnum).

For example, 2/1 => 0

 When at least one of the operands is a float, then it becomes a
floating point arithmetic operation and which is what we want in most
of the times.

So, its better to convert unknown number values to avoid possible
integer operation. To do so, we can use float()

In your function, just change ScaleFactor = 80/Width; to ScaleFactor > 80.0/Width  or ScaleFactor = 80/float(Width)

Regards,
Suresh

On Oct 11, 12:06 pm, RolfK <Rolf.Kem...@eu.necel.com> wrote:

Dear All,

I'm unfortunately found myself still a skill beginner.
Please have alook at the following snipet:
#################################
procedure( CreateRCNetwork(Width BaseR BaseC MetalNumber  )
let( (  ScaleFactor     RValue     CValueRL  CValueMid
SchematicName )

ScaleFactor = 80/Width;
printf("%f"  scaleFactor   )

;RValue = sprintf(nil "%fm" baseR * ScaleFactor)  ;
;CValueMid =sprintf(nil "%fp" baseC * ScaleFactor) ;
;CValueRL =sprintf(nil "%fp" baseC * ScaleFactor / 2) ;

;SchematicName= sprintf(nil "RCBASE80R%dC%dM%d" RValue  CValueMid
MetalNumber);
;cvID= dbOpenCellViewByType("GENERIC" SchematicName "schematic"
"schematic" "w")

); let
);procedure

CreateRCNetwork(160 100  2  1)

###########################################

I already got stuk at the simple first print statement (just for test)
==> *Error* fprintf/sprintf: format spec. incompatible with data - 0
My final goal is to calculate the schematicname and to calculate some
property values for
the values of R and C to be instanciated later.

In general I have a lot of diificulties to undertand how strings and
numbers are handled in skill.
Also it looks like that there in no function to avoid sprintf just to
create a value string like 100p for e.g a capacitance property value.

Could someone help me on that please ?

Thanks a lot
Rolf
 
Also it looks like that there in no function to avoid sprintf just to
create a value string like 100p for e.g a capacitance property value.
Could someone help me on that please ?
Thanks a lot
Rolf
And you could just use aelSuffixNotation(1e-10) => "100p"

(I think you may have logged a service request about this, since I saw something
similar coming through just now).

Regards,

Andrew.

--
Andrew Beckett
Senior Solution Architect - Cadence Design Systems Ltd (UK)
 

Welcome to EDABoard.com

Sponsor

Back
Top