Im trying to read data from ADC with ADC Inteface Im designing with FPGA.

The data that coming out from the ADC is offset binary with 12 bits.. looks like that:

enter image description here

I want to simulate this results using Matlab for example to see if i getting back the Sine wave with the same frequency as in the input. Any idead how I can do it? I didnt find any matlab code when I searched the internet. How would you check the results and compare to the analog sine in the input?

  • \$\begingroup\$ What are d_o and d_i intended to represent? Have you considered writing some Matlab code of your own? \$\endgroup\$
    – brhans
    Feb 23, 2020 at 15:41
  • 2
    \$\begingroup\$ And what do you mean by offset binary? Also you have posted a picture of the values. If you paste a text version and use the code formatting button we can copy it into a spreadsheet, etc. \$\endgroup\$
    – Transistor
    Feb 23, 2020 at 15:42

1 Answer 1


How would I check it?

I would write (VHDL testbench code) to translate from the real data (sinewave) I put into my ADC simulation model, into the binary format it produced and transmitted to the FPGA, and the testbench would check that the value computed and the value inside the FPGA were identical.

If they were not always identical I would then look at the simulation waveforms around the times that the simulation reported errors, to identify what caused the differences, and correct whatever was wrong. Modelsim can display analog waveforms, which make spotting some forms of error easy.

Some types of error are easier to see using a ramp waveform, which should generate a monotonic count, so not all tests have to be sinewaves.

(as ADCs aren't always provided with good simulation models, you often have to write the models yourself. But that's just behavioural code, so it's not too difficult, and it's well worthwhile in the long run)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.