dayalannair / FMCW_FFT_Radar

Implementation of the Xilinx FFT IP using a UART packetised data stream
MIT License
7 stars 1 forks source link

Notes on reading data in Testbench #23

Closed dayalannair closed 2 years ago

dayalannair commented 2 years ago
  1. readmemh reads .mem which is same as text with newline delim
  2. file needs to be in xsim folder
  3. need to use blocking statement when reading
dayalannair commented 2 years ago

Read data incorrect

image

Code: https://github.com/dayalannair/FMCW_FFT_Radar/blob/5672fe550288c4748f2c9ae143796b73d0a87feb/FMCW_FFT_Radar.srcs/sim_1/new/UART_AXIS_TB.sv#L50-L81

dayalannair commented 2 years ago

Solved

mem in wave shows the last sample at the top

dayalannair commented 2 years ago

ERROR with shift

image The above was generated with code: image This indicates that the shift is shifting the hexadecimal number and not its binary form. This must have something to do with the memory read. Seems like memory read stores the value as a set of hexadecimals instead of as a single hexadecimal value.

jpt13653903 commented 2 years ago

the shift is shifting the hexadecimal number and not its binary form

The statement makes no sense. It's one and the same thing. If you shift by 8 bits, that is 2 hex places.

dayalannair commented 2 years ago

True...when I set data hold as shown for data_hold1, it comes out to 00000800 and when I set it as shown above, it comes out the same but now data_hold1 is somehow correct. Will be an interesting fix

dayalannair commented 2 years ago

maybe needs a clk edge wait inside nested loop since its in initial begin. This will cause the whole thing to be clocked

dayalannair commented 2 years ago

Can confirm its a timing issue - added waits. Easiest would be to store all 4 bytes at once then feed them in instead of shifting image image

dayalannair commented 2 years ago

Fixed for the shifting case and also got it working for the split into bytes case