Home
  • Products
  • Solutions
  • Support
  • Company

This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  • Products
  • Solutions
  • Support
  • Company
Community Custom IC Design Reading from a text file in Spectre
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Reading from a text file in Spectre

Analogstudent
Analogstudent over 13 years ago

Hi all,

How can I convert the below Hspice code to something acceptable for Spectre?

************************************************************************************

 Simulator lang=spice

.Tran 100u 1m


.DATA vals LAM
+ FILE='data1'
+ idep1val=1
+ itd1val=2
.ENDDATA   ****** This is how it works in Hspice

Idep1 vdd idep1  idep1val   ***** Bias currents in my spectre netlist
Itd1  vdd itd1   itd1val  

 *********************************************************************

This is the stimulus file that I have included for my scptre simulation.  

It works fine if I just mention the reuired values like this:

Idep1 vdd idep1  100u
Itd1  vdd itd1   100p 

But I need to read these values from an extrenal file and that's where it doesn't like it.

 Is there any better way of doing this?

Your help is highly appreciated.

Regards

Mostafa

 

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    I don't think that syntax is currently supported (you'd have to file an enhancement request for this with customer support).

    You could just define your file:

    myParams paramset {
    idep1val itd1val
    100u 100p
    200u 200p
    // etc
    }

    and then use:

    include "paramset.scs"

    in the netlist.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Analogstudent
    Analogstudent over 13 years ago

     Thank you very much Andrew. I was away for a couple of weeks.

     I tried the way you suggested. But I couldn't get it work.

     Here is what my file contains:

    myParams paramset {
    idep1val itd1val
    100u 100p
    }

     

    I included this file to my stimuli file as:

    simulatro lang=spectre

    include "(path)/paramset.scs"

    simulatro lang=spice

    Idep1 vdd idep1  idep1val

    Itd1  vdd  itd1     itd1val

     

    but still it complains that "unknown parameter name idep1val"

     

    What am I missing here?

     

    Thanks in advance

    Mostafa

     

     

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    Mostafa,

    The only point of using a paramset is if you want to sweep - so for example you can use a sweep analysis to vary the parameters over the paramset. But you need a default value defined in a parameters statement:

     

    // parameter set example
    parameters p1=1 p2=2 p3=3 p4=4 val1
    r1 1 2 resistor r=p1
    r2 2 3 resistor r=p2
    r3 3 4 resistor r=p3
    r4 4 0 resistor r=p4
    v1 1 0 vsource dc=1

    mydata paramset {
    p2 p3
    1 2
    1 0.5
    2 3
    }

    sweep1 sweep param=p1 start=1 stop=2 step=1 {
      sweep2 sweep paramset=mydata {
          sweep4 sweep param=p4 start=1 stop=5 step=1 {
            dc dc start=0.5 stop=5 step=0.5 param=dc dev=v1
          }
        }
    }

     

     Hopefully that's clearer

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Analogstudent
    Analogstudent over 13 years ago

     Thank you Andrew,

    Your example makes everything clear for me. I guess this approach is not useful for me.

    What I'm going to do is,

    (1) reading the bias values from a file,

    (2) simulating the circuit using those bias values,

    (3) computing an error value using the outputs of the circuit,

    (4) checking a termination criteria,

    (5) writing a new bias set to the file again till my termination criteria is satisfied.

    (6) back to (1) 

     

     I already did that in Hspice, but I can't do that in Spectre. Maybe I'll do the whole thing again in Hspice.

     

    Anyway, thank you very much for your time.

    Mostafa

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 13 years ago
    Mostafa,

    You can do that entirely in spectre. Look at the documentation for spectre's Measurement Description Language (MDL) which would allow you to implement such an optimisation within the simulator.

    There are examples in <MMSIMinstDir>/tools/spectre/examples - an MDL workshop is provided.

    Alternatively you could implement the loop around the simulator using OCEAN - this would allow you to use the same kind of measurement functions that you can use in ADE and then place an adaptive loop around the simulator, altering the values of design variables based on the results of the previous simulation.

    Best Regards,

    Andrew
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Analogstudent
    Analogstudent over 13 years ago

    Thank you Andrew,

     

    I give it a try.

     

    I'll be around and ask you more questions soon!

     

    Merry christmas and have a good one.

    Mostafa

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 125
  • Views 15613
  • Members are here 0

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information