• 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 SKILL
  3. calculator numconv function

Stats

  • Locked Locked
  • Replies 50
  • Subscribers 143
  • Views 26268
  • 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

calculator numconv function

abdurrahman0234
abdurrahman0234 over 4 years ago

When ı plot to calculator, I get error as below. I want to convert binary signal to decimal.Please can help me. 

ERROR (VIVA-3002):expression evaluation failed: val is not legal.
ERROR (VIVA-3002):expression evaluation failed: numConv(VT("/out<0:2>") "dec" t)

  • Cancel
Parents
  • abdurrahman0234
    abdurrahman0234 over 4 years ago

    sorry, when ı send my plot to calculator

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to abdurrahman0234

    I think you should use the analog to digital functions that were referenced in the other thread you posted in after this. The numConv is really for single valued text numbers and will convert them into a different number base. I don't think it's the right solution here.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to abdurrahman0234

    OK, so the bus output are analog, not digital - the y-axis is in volts. So the approach you need to take is exactly as I described before - use Measurements->Analog to Digital to convert the analog bits into a digital bus (with your chosen radix). Then you probably want to convert that back into a voltage so that you can perform a PSD on it.

    Here's an example of an A2D converter output which has been driven with a sine wave input.

    I took the 8 digital bus signals shown at the top, and converted them to a bus using the form like this:

    This gave the bus in the middle (below it is the expansion into the individual logic bits). If you zoom in, you'll see the numbers on the bus (note I picked. Unsigned Decimal because that's what my ADC would have produced, but the Radix can be signed Decimal too).

    The bottom curve (in both plots) was the result of selecting "mybus" and using Measurements->Digital to Analog and converting it back into an analog waveform. That means you've now got an analog-like signal from your original digital bus (which was in volts rather than logic) and you can then do whatever signal processing you like on that.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • abdurrahman0234
    abdurrahman0234 over 4 years ago in reply to Andrew Beckett

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • abdurrahman0234
    abdurrahman0234 over 4 years ago in reply to abdurrahman0234

    Sır, why I get 0. U want to say that digital output is not ideal u should convert to bits?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to abdurrahman0234

    Well, with a centre value of 4, 800mV is always below 4, and so it's always zero. You probably want to enter a centre value of 400m or 0.4.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • abdurrahman0234
    abdurrahman0234 over 4 years ago in reply to abdurrahman0234

    In addition to this, we can create bus from the trace. But ı can not any signal in these section although selecting my signals before click trace-create-bus. It is since analog bits?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to abdurrahman0234
    abdurrahman0234 said:
    In addition to this, we can create bus from the trace. But ı can not any signal in these section although selecting my signals before click trace-create-bus. It is since analog bits?

    I have no idea what you mean by this question.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • abdurrahman0234
    abdurrahman0234 over 4 years ago in reply to Andrew Beckett

    I understand sir. But I get no digital signal as in the above pic when convert analog to digital. Why please 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • abdurrahman0234
    abdurrahman0234 over 4 years ago in reply to abdurrahman0234

    SORRY. I achieved

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • abdurrahman0234
    abdurrahman0234 over 4 years ago in reply to abdurrahman0234

    while converted digital to analog, high and low voltages range is; -4*840m for low and 3*840m for the decimals between  -4 and 3?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • abdurrahman0234
    abdurrahman0234 over 4 years ago in reply to abdurrahman0234

    (vhi+vlo)/2 this formula is constant?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • abdurrahman0234
    abdurrahman0234 over 4 years ago in reply to abdurrahman0234

    (vhi+vlo)/2 this formula is constant?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to abdurrahman0234

    I assume you're referring to the X: (vhi+vlo)/2. That is indicating what voltage would be used if there are any "unknowns" in the digital waveform. There won't be if you use the "Center" mode in the analog to digital (you'll only get X if you have used the High/Low setting on analog to Digital, and the signal stays between the low and the high for longer than a certain time).

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • abdurrahman0234
    abdurrahman0234 over 4 years ago in reply to Andrew Beckett

    Sır, dıgıtal bıts are converted to analog bıts, wrongly. For example, digital bit '4' is converted to 226mv and  bit '-1' is converted to 336mv. I dont understand

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • abdurrahman0234
    abdurrahman0234 over 4 years ago in reply to abdurrahman0234

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • abdurrahman0234
    abdurrahman0234 over 4 years ago in reply to abdurrahman0234

    Why negative decimals dont take a negative voltage

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to abdurrahman0234
    abdurrahman0234 said:
    Sır, dıgıtal bıts are converted to analog bıts, wrongly. For example, digital bit '4' is converted to 226mv and  bit '-1' is converted to 336mv. I dont understand

    I don't understand either, mainly because you've posted on the end of an old thread (you had this working before, so I presume it's something different) and you've not provided any supporting information - such as a graph of the results, what you entered on the form, and so on. I can't read your mind!

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • abdurrahman0234
    abdurrahman0234 over 4 years ago in reply to Andrew Beckett

    when ı converted  digital bits to analog bits, ıt takes decimals wrongly for the voltage output. For example, '-1' digital bit should be 840mv or else '-2' decimal should be at the minumum level but graph show not coorect

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • abdurrahman0234
    abdurrahman0234 over 4 years ago in reply to abdurrahman0234

    analog bıts shows not correct for the digital bits.Hı:3360m li:-840m X=(Xİ + Lİ)/2

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to abdurrahman0234

    OK - when I posted before I'd not seen your picture as you posted three posts rather than combining into one.

    It seems that when converting the digital bus back into a single analog waveform, the conversion does not take into account whether you'd marked your bus as being displayed with the radix signed or unsigned. It simply uses the value of the bus as a binary sequence - it seems to always be treated as unsigned. It would seem to be a reasonable enhancement request to allow the conversion to analog to treat the input as a signed bus - so you should contact customer support to request this enhancement.

    Goodness me, whilst typing this you've posted 3 more single line responses. You're doing your best to really annoy me so this will be my last answer.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • abdurrahman0234
    abdurrahman0234 over 4 years ago in reply to Andrew Beckett

    Ok, Sir. I have to look psd of the analog bits. There are any way of  digital bus converting to analog? I think that ıt will not be correct sımulation with wrong analog bits

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to abdurrahman0234

    Now I'm going to go against what I said earlier. You should still contact customer support for this, but it's actually possible to convert the value the way you want. In my case I have an 8 bit unsigned bus, so I converted this to analog with a minimum of 0, and maximum of 255. I then sent this to the calculator:

    awvDigital2Analog(awvCreateBus("thebus" list(awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<7>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<6>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<5>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<4>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<3>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<2>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<1>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<0>" ) nil nil 0.4 nil "centre") ) "Signed Decimal") 255 0 "(vhi+vlo)/2" ?mode "busvalue" ?outWaveType "zeroT" ?risetime 0 ?falltime 0)

    I added 128 (i.e. half the range of an 8 bit value), and then surrounded the expression with abApplyToTwoWaves('modf expression 256.0) as found in this post. So I got this:

    abApplyToTwoWaves('modf awvDigital2Analog(awvCreateBus("thebus" list(awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<7>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<6>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<5>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<4>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<3>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<2>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<1>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<0>" ) nil nil 0.4 nil "centre") ) "Signed Decimal") 255 0 "(vhi+vlo)/2" ?mode "busvalue" ?outWaveType "zeroT" ?risetime 0 ?falltime 0)+128 256.0)

    I finally subtracted 128 again, and got this:

    abApplyToTwoWaves('modf awvDigital2Analog(awvCreateBus("thebus" list(awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<7>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<6>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<5>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<4>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<3>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<2>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<1>" ) nil nil 0.4 nil "centre") awvAnalog2Digital(leafValue( VT("/data<7:0>") "bit" "/data<0>" ) nil nil 0.4 nil "centre") ) "Signed Decimal") 255 0 "(vhi+vlo)/2" ?mode "busvalue" ?outWaveType "zeroT" ?risetime 0 ?falltime 0)+128 256.0)-128

    This gives me:

    Note that my vertical markers are showing the bus value (the bus has a signed decimal radix) - and you can see the voltages match. Of course, if your bus widths are different you'll need to change the 128 and 256 in the above expression (note the last argument of abApplyToTwoWaves needs to be a float, so must have .0 at the end).

    Of course, this would be much simpler if there was a built-in way to convert the digital to analog treating it as a signed number in the first place (but that needs an enhancement). You could also write a Verilog-A DAC model which does the same thing.

    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