Home > Community > Forums > Custom IC Design > How do I implement this offset logic in ocean script?

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 How do I implement this offset logic in ocean script? 

Last post Tue, Jul 30 2013 11:24 AM by Andrew Beckett. 2 replies.
Started by chaosatom 29 Jul 2013 08:23 PM. Topic has 2 replies and 387 views
Page 1 of 1 (3 items)
Sort Posts:
  • Mon, Jul 29 2013 8:23 PM

    • chaosatom
    • Not Ranked
    • Joined on Tue, Jul 30 2013
    • Posts 8
    • Points 100
    How do I implement this offset logic in ocean script? Reply
    I have a ramp in my input of comparator and I am getting the offset by implementing this logic in ocean script. If clock= 1 and output= 1 in an transient response, then get the x-value for the first time that it happens. From that x-value, get the y-value of input. How would I accomplish this?

    Do I need to loop through each time step and see where it occurs? Or is there an easier implementation for it? I am new to ocean script. 
    • Post Points: 20
  • Tue, Jul 30 2013 10:04 AM

    • chaosatom
    • Not Ranked
    • Joined on Tue, Jul 30 2013
    • Posts 8
    • Points 100
    Ocean Script to Adexl Calculator Reply
    I have this code that works in ocean: (Basically I sweep time and store the Vin value on to a text file)
    for(tt 1 1200
      time = (tt*.0005)-.0005
              if( (value(VT("/Vout"), time)<=.8 && value(VT("/clk"), time)>=1) && (value(VT("/Vout"), time)>=.1)
                     then fprintf(of "Vin = %1.3f \n" value(VT("/Vn"),time))
                )
           

    )

    I want to add this ocean script to a calculator and display the Vin value on the output of ADE window (then run Monte carlo). Can anybody give me a step by step guide on how to proceed?   

     Thanks,

    Vipul
    • Post Points: 5
  • Tue, Jul 30 2013 11:24 AM

    Re: Ocean Script to Adexl Calculator Reply

    Vipul,

    Probably I'd do this using the code in this post (also in this post). You could also define:

    procedure(abWithinRange(wave min max)
      abApplyToWave(
        lambda((val)
          cond(
            (val<max 1)
            (val>min 1)
            (t 0)
          )
        )
      )
    )

    In conjunction with abPositive in the earlier post, you'd do:

    value(VT("/Vin") cross(abPositive(VT("/clk")-1)*abWithinRange(VT("/Vout") 0.1 0.8) 0.5 "rising"))

    Something like that.

    I'll link your earlier question to this, because I think it answers both. Your above approach won't really work because it doesn't output a single value - but you could of course alter the logic to return a single value and encapsulate it in a function definition.

    Kind Regards,

    Andrew.

     

    • Post Points: 5
Page 1 of 1 (3 items)
Sort Posts:
Started by chaosatom at 29 Jul 2013 08:23 PM. Topic has 2 replies.