• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC Design
  3. A stochastic model in Verilog A for Monte Carlo simulat...

Stats

  • Locked Locked
  • Replies 29
  • Subscribers 125
  • Views 33231
  • Members are here 0
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

A stochastic model in Verilog A for Monte Carlo simulation

UUinfini
UUinfini over 11 years ago

 Hello Guys,

I have a problem for Veriglog A in Cadence, I hope you can help me. In fact I need to elaborate a stochastic model by coding in Verilog A executed under Cadence. My aim is to offer a model with which the customers can do the Monte Carlo Analysis. But I used the functions like "$random", "$temperature" etc. to generate a seed for obtaining a parameter which changes each time of simulation. But finally it changes just according to the real time of simulation, but not according to different times of simulation. Do you have any experiences like this? Thank you for you response.

Best regards,

UU

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    The first problem is that your "source.scs" should not have the ahdl_include statement in it. Since you've created a cellView in Virtuoso for that cell containing the veriloga code, the spectre netlister will automatically add the "ahdl_include" for you. So you've defined it twice because of this.

    The second issue is that (for some reason) the instance of source in your schematic seems to be passing seedin - which it shouldn't be. Did you set the value on the instance? I suspect that maybe there was an issue with the veriloga parser in MMSIM10.1 which meant that it mistakenly identified this cds_inherited_param as a normal parameter - I don't have that version to hand though so I can't test that.

    Could you use Tools->CDF->Edit in the CIW, set it to "Base", and pick the lib and "source" cell that you've created, and then use the "CDF Dump" button to dump out the CDF for the "source" cell, and then post it here (maybe as an attachment via the Options tab)? Then I can see what's going on in your case.

    Kind Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • UUinfini
    UUinfini over 11 years ago

     Hello Andrew,

    I have modified the file "source.scs" as following:

    simulator lang=spectre
    parameters seedin=0
    statistics {
      mismatch {
        vary seedin dist=gauss std=5
      }
    }

    And the file "veriloga.va" is:

    `include "constants.vams"
    `include "disciplines.vams"
    module source(a,b);
         inout a,b;
         electrical a,b;
         integer seed;
         (*cds_inherited_parameter*)parameter real seedin = 0;
         analog begin
         seed=seedin;
         V(b) <+ cos($abstime*seed*100000000);
         end
    endmodule

    When I did as you said for "CDF", there came the error attached.

    Best regards,

    UU

     

    • problem.jpg
    • View
    • Hide
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    From the error messages, you appear to have dumped the CDF and then added it as a Model Library in ADE. I have no idea why you did that, since I didn't ask you to (and clearly spectre would not be able to read a SKILL dump of the CDF - that makes no sense).

    I asked you to dump the CDF and then post it in this forum so that I can see it to understand what is wrong...

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • UUinfini
    UUinfini over 11 years ago

     Sorry, perhaps it's this one

    • CDF.jpg
    • View
    • Hide
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    You appear to have overwritten the "source.scs" file with your CDF dump! Not sure why you did that - dump it to any file name you like (eg "dump.txt" and then post the contents here. That's what I asked for, not a picture of the CDF form. 

    You'll also need to recreate your source.scs file since you clobbered it.

    Andrew 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • UUinfini
    UUinfini over 11 years ago

    Hello, 

    I have done as you said, but there is nothing in the file "dump.txt" in the end. 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • UUinfini
    UUinfini over 11 years ago

     Hello,

    I'am sorry I have made an error. The text in the "dump.txt" is:

     
    /****************************************************/
     LIBRARY = "PMAMTJ40symstoRp"
     CELL    = "source"
    /****************************************************/

    let( ( libId cellId cdfId )
        unless( cellId = ddGetObj( LIBRARY CELL )
            error( "Could not get cell %s." CELL )
        )
        when( cdfId = cdfGetBaseCellCDF( cellId )
            cdfDeleteCDF( cdfId )
        )
        cdfId  = cdfCreateBaseCellCDF( cellId )

        ;;; Simulator Information
        cdfId->simInfo = list( nil )
        cdfId->simInfo->ams = '( nil
            isPrimitive       ""
            extraTerminals    ""
            propMapping       ""
            termMapping       ""
            termOrder         ""
            componentName     ""
            excludeParameters ""
            arrayParameters   ""
            stringParameters  ""
            referenceParameters ""
            enumParameters    ""
            instParameters    ""
            otherParameters   ""
            netlistProcedure  ""
        )
        cdfId->simInfo->auCdl = '( nil
            dollarEqualParams ""
            dollarParams      ""
            modelName         ""
            namePrefix        ""
            propMapping       ""
            termOrder         ""
            componentName     ""
            instParameters    ""
            otherParameters   ""
            netlistProcedure  ""
        )
        cdfId->simInfo->auLvs = '( nil
            namePrefix        ""
            permuteRule       ""
            propMapping       ""
            deviceTerminals   ""
            termOrder         ""
            componentName     ""
            instParameters    ""
            otherParameters   ""
            netlistProcedure  ""
        )
        cdfId->simInfo->hspiceD = '( nil
            opParamExprList   ""
            optParamExprList  ""
            propMapping       ""
            termMapping       ""
            termOrder         ""
            namePrefix        ""
            componentName     ""
            instParameters    ""
            otherParameters   ""
            netlistProcedure  ""
        )
        cdfId->simInfo->spectre = '( nil
            modelParamExprList ""
            optParamExprList  ""
            opParamExprList   ""
            stringParameters  ""
            propMapping       ""
            termMapping       ""
            termOrder         ""
            componentName     ""
            instParameters    ""
            otherParameters   ""
            netlistProcedure  ""
        )

        ;;; Properties
        cdfId->formInitProc            = ""
        cdfId->doneProc                = ""
        cdfId->buttonFieldWidth        = 340
        cdfId->fieldHeight             = 35
        cdfId->fieldWidth              = 350
        cdfId->promptWidth             = 175
        cdfId->instNameType            = "schematic"
        cdfId->instDisplayMode         = "cellName"
        cdfId->netNameType             = "schematic"
        cdfId->termSimType             = "DC"
        cdfId->termDisplayMode         = "none"
        cdfId->paramSimType            = "DC"
        cdfId->paramDisplayMode        = "parameter"
        cdfId->viewInfo                = '(nil veriloga (nil termMapping (nil c "\\:c" b "\\:b"
    a "\\:a"
    ) moduleName "source"
    namePrefix "ahdl" termOrder ("a" "b") parameterList
    (seedin)
    )
    )
        cdfSaveCDF( cdfId )
    )

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

    Thanks. I assume you've already removed the "seedin" CDF parameter (since it's not in the dump above), so it may well work already, but if you still have a problem, type this in the CIW:

    almSetParameterList("PMAMTJ40symstoRp" "source" nil ?view "veriloga")

    This will remove the "seedin" parameter from being potentially netlisted when the veriloga view is used. Note that you will still need to fix your source.scs file if it still contains a copy of the above dump information and replace it with the "statistics" block definition etc.

    I'm pretty certain that the problem was due to the spectre version you're using causing the parameter with the cds_inherited_parameter attribute being identified as a normal parameter when the veriloga was parsed. Ah yes, it was - CCR 922010 was filed (by me) for this issue, and it was fixed in MMSIM11.1 ISR17. No need to switch versions of spectre if you use the workaround above - see this post.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • UUinfini
    UUinfini over 11 years ago

     Hello Andrew,

    Thank you for your help and patience. In fact it didn't work, but now it works well with your command:

    almSetParameterList("PMAMTJ40symstoRp" "source" nil ?view "veriloga")

    I don't really understand why although I have read the lien that you sent me but I will try to learn more. By the way what does CRR means?

    Best regards,

    WANG You

     

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

    A CCR is a Cadence Change Request and is the system we use for tracking bugs and enhancement requests. 

    If you'd used a newer simulator version when editing the veriloga view, the problem would not have happened.

    Regards,

    Andrew 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
<>

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