Author Topic: How can I kill this bug in my Data logger Code?  (Read 1226 times)

0 Members and 1 Guest are viewing this topic.

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1668
  • Country: ca
How can I kill this bug in my Data logger Code?
« on: January 18, 2022, 09:09:01 am »
Hi,
I'm using Gowin FPGA, the part number is GW2AR-LV18QN88C8 which has 20K LUT and internal 64Mb SDRAM, I have designed a data logger, that would capture ADC data and saves it into internal SDRAM, the program should work as follow, it should save data a configurable amount of time for Pre and post trigger event, so I can see what was happening before and after the event,

I have applied a sine wave to the ADC, and the ADC core is working perfectly, it spit out ADC data to the Recorder logic, I think I have some problems with the Reading logic, I got some distortion in the read data logic, here is my Recorder state machine logic code,





I have tried many times to figure out what could be the problem?
Do you have any Idea what I might have done wrong?

Finally I have solved it!

« Last Edit: January 22, 2022, 03:24:09 pm by ali_asadzadeh »
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline mfro

  • Regular Contributor
  • *
  • Posts: 152
  • Country: de
Re: How can I kill this bug in my Data logger Code?
« Reply #1 on: January 18, 2022, 11:36:29 am »
I have tried many times to figure out what could be the problem?
Do you have any Idea what I might have done wrong?

I do.

You missed to simulate your design. If you did, you would most likely already have found the problem.
Beethoven wrote his first symphony in C.
Nach oben
 
The following users thanked this post: Bassman59

Offline Bassman59

  • Super Contributor
  • ***
  • Posts: 2502
  • Country: us
  • Yes, I do this for a living
Re: How can I kill this bug in my Data logger Code?
« Reply #2 on: January 18, 2022, 05:22:39 pm »
I have tried many times to figure out what could be the problem?
Do you have any Idea what I might have done wrong?

I do.

You missed to simulate your design. If you did, you would most likely already have found the problem.

This is the way.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 9860
  • Country: fr
Re: How can I kill this bug in my Data logger Code?
« Reply #3 on: January 18, 2022, 06:10:04 pm »
Ditto. I can't even understand the idea of trying to debug a design written in some HDL without simulation. At best, this is usually terribly inefficient, and at worst, you may just never figure it out and claim that FPGAs are crap. (A less generalized variation of this would be to put the blame on the FPGA vendor. Yes, I've seen this. ;D )
 

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1668
  • Country: ca
Re: How can I kill this bug in my Data logger Code?
« Reply #4 on: January 19, 2022, 07:31:45 am »
I know the way to do it is simulation :)
The problem is that I'm using Gowin Internal SDRAM IP and unfortunately Gowin does not provide any means for simulation their IP.
So Imagine that you have a Black box in your FPGA design that you can not simulate it, how do you solve your problems?
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline mfro

  • Regular Contributor
  • *
  • Posts: 152
  • Country: de
Re: How can I kill this bug in my Data logger Code?
« Reply #5 on: January 19, 2022, 08:29:49 am »
I know the way to do it is simulation :)
The problem is that I'm using Gowin Internal SDRAM IP and unfortunately Gowin does not provide any means for simulation their IP.
So Imagine that you have a Black box in your FPGA design that you can not simulate it, how do you solve your problems?

If you have a black box in your design, you should at least have documentation on how this black box' interface is supposed to behave (at least it was good enough for you to attempt implementing a design around it first place, wasn't it?).
Beethoven wrote his first symphony in C.
Nach oben
 

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1668
  • Country: ca
Re: How can I kill this bug in my Data logger Code?
« Reply #6 on: January 19, 2022, 08:42:49 am »
I have attached the Documentation in the first post, I think I have done exactly like the docs, But do you suggest how it should be done?
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline mfro

  • Regular Contributor
  • *
  • Posts: 152
  • Country: de
Re: How can I kill this bug in my Data logger Code?
« Reply #7 on: January 19, 2022, 08:45:43 am »
I have attached the Documentation in the first post, I think I have done exactly like the docs, But do you suggest how it should be done?

Write a simulation model based on this documentation and simulate, as you've been told already.
Beethoven wrote his first symphony in C.
Nach oben
 

Offline Bassman59

  • Super Contributor
  • ***
  • Posts: 2502
  • Country: us
  • Yes, I do this for a living
Re: How can I kill this bug in my Data logger Code?
« Reply #8 on: January 19, 2022, 03:10:51 pm »
I know the way to do it is simulation :)
The problem is that I'm using Gowin Internal SDRAM IP and unfortunately Gowin does not provide any means for simulation their IP.
So Imagine that you have a Black box in your FPGA design that you can not simulate it, how do you solve your problems?

FPGA vendors that will not provide simulation models for hardware features of their devices are scratched off of the list.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf