diff --git a/__init__.py b/__init__.py new file mode 100644 diff --git a/lfr_emulator.sublime-project b/lfr_emulator.sublime-project new file mode 100644 --- /dev/null +++ b/lfr_emulator.sublime-project @@ -0,0 +1,8 @@ +{ + "folders": + [ + { + "path": "/opt/LFR_EMULATOR" + } + ] +} diff --git a/lfr_emulator.sublime-workspace b/lfr_emulator.sublime-workspace new file mode 100644 --- /dev/null +++ b/lfr_emulator.sublime-workspace @@ -0,0 +1,322 @@ +{ + "auto_complete": + { + "selected_items": + [ + [ + "MEM", + "MEM_IN_SM_Empty" + ], + [ + "out_re", + "out_ren" + ], + [ + "fft", + "fft_reg" + ], + [ + "address_MEM", + "address_MEM_IN_SM_0" + ], + [ + "wfr", + "wfrm0" + ], + [ + "print", + "print_reg_fft" + ], + [ + "sin", + "sineWave" + ], + [ + "if", + "ifmain if __name__ == '__main__'" + ], + [ + "address_", + "address_MEM_IN_SM_0" + ], + [ + "wf", + "wfrm0" + ], + [ + "address_FIFO_F0_", + "address_FIFO_F0_4" + ], + [ + "add", + "address_CTRL" + ], + [ + "wfrm", + "wfrm1" + ], + [ + "index", + "indexTransformDecimationInFrequency" + ], + [ + "in", + "indexTransformDecimationInFrequency" + ], + [ + "dft", + "dft_val" + ], + [ + "butter", + "butterflyProcessor" + ], + [ + "chec", + "checkbox_sy_lfr_bw" + ], + [ + "send", + "sendLoadCommonPar" + ], + [ + "groupbo", + "groupbox_tc_lfr_load_common_par" + ], + [ + "l", + "layout_tc" + ], + [ + "button", + "button_tc_lfr_load_common_par" + ], + [ + "a", + "addWidget" + ], + [ + "group", + "groupbox_tc_lfr_load_common_par" + ], + [ + "c", + "common" + ], + [ + "laben", + "label_UNKNOWN_nb" + ], + [ + "UN", + "UNKNOWN_nb" + ] + ] + }, + "buffers": + [ + { + "file": "test_fft/test_fft_mini_lfr.py", + "settings": + { + "buffer_size": 4505, + "line_ending": "Unix" + } + } + ], + "build_system": "", + "command_palette": + { + "height": 392.0, + "selected_items": + [ + ], + "width": 392.0 + }, + "console": + { + "height": 146.0 + }, + "distraction_free": + { + "menu_visible": true, + "show_minimap": false, + "show_open_files": false, + "show_tabs": false, + "side_bar_visible": false, + "status_bar_visible": false + }, + "file_history": + [ + "/opt/LFR_EMULATOR/test_fft/functions_evaluations.py", + "/opt/LFR_EMULATOR/SRC/processing_chain.py", + "/opt/LFR_EMULATOR/main.py", + "/opt/LFR_EMULATOR/fft_8_decimation_in_frequency.py", + "/opt/LFR_EMULATOR/SRC/basic_parameters_Int.py", + "/opt/LFR_EMULATOR/butterfly_processor.py", + "/opt/LFR_EMULATOR/index_transform_decimation_in_frequency.py", + "/opt/LFR_EMULATOR/efficient_complex_multiplier.py", + "/opt/LFR_EMULATOR/twiddle_factors.py", + "/opt/LFR_EMULATOR/SRC/filters.py", + "/opt/LFR_EMULATOR/SRC/test_cases1.py", + "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step02/UploadDumpMemory.py", + "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step02/UploadDumpMemory (copy).py", + "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0001/Step01/grspw_registers.py", + "/opt/VALIDATION/lfrverif/LFR_SVS/SVS-0002/tc_during_matrix_transmission.py", + "/opt/VALIDATION/lfrverif/common/actions_tc_lfr_launcher.py", + "/opt/VALIDATION/lfrverif/common/test_monitor.py", + "/opt/VALIDATION/validation.sublime-workspace", + "/opt/VALIDATION/validation.sublime-project", + "/opt/PYTHON/lfrverif/test1/test1main.py", + "/opt/PYTHON/lfrverif/test1/test1launcher.py", + "/opt/PYTHON/lfrverif/common/crcforlfr.py", + "/opt/PYTHON/lfrverif/common/tcparams.py", + "/opt/PYTHON/lfrverif/test1/testgui.py", + "/opt/PYTHON/lfrverif/test1/tcmonitor.py", + "/opt/PYTHON/lfrverif/test1/lppmoncfg.py", + "/opt/PYTHON/lfrverif/test1/wfdisplay.py", + "/opt/PYTHON/lfrverif/test1/lppmonplot.py", + "/opt/PYTHON/lfrverif/test1/tmmonitor.py" + ], + "find": + { + "height": 34.0 + }, + "find_in_files": + { + "height": 0.0, + "where_history": + [ + "/opt/VALIDATION/lfrverif", + "/opt/VALIDATION/lfrverif/LFR_SVS" + ] + }, + "find_state": + { + "case_sensitive": false, + "find_history": + [ + "def displayInfoSendTc", + "dump", + "tc_lfr_dump_par", + "processpac", + "WriteSPWDelay", + "sendPacket", + "sendLoadCommonPar" + ], + "highlight": true, + "in_selection": false, + "preserve_case": false, + "regex": false, + "replace_history": + [ + ], + "reverse": false, + "show_context": true, + "use_buffer2": true, + "whole_word": false, + "wrap": true + }, + "groups": + [ + { + "selected": 0, + "sheets": + [ + { + "buffer": 0, + "file": "test_fft/test_fft_mini_lfr.py", + "settings": + { + "buffer_size": 4505, + "regions": + { + }, + "selection": + [ + [ + 1524, + 1524 + ] + ], + "settings": + { + "syntax": "Packages/Python/Python.tmLanguage", + "translate_tabs_to_spaces": false + }, + "translation.x": 0.0, + "translation.y": 1998.0, + "zoom_level": 1.0 + }, + "type": "text" + } + ] + } + ], + "incremental_find": + { + "height": 0.0 + }, + "input": + { + "height": 0.0 + }, + "layout": + { + "cells": + [ + [ + 0, + 0, + 1, + 1 + ] + ], + "cols": + [ + 0.0, + 1.0 + ], + "rows": + [ + 0.0, + 1.0 + ] + }, + "menu_visible": true, + "output.exec": + { + "height": 28.0 + }, + "replace": + { + "height": 0.0 + }, + "save_all_on_build": true, + "select_file": + { + "height": 0.0, + "selected_items": + [ + ], + "width": 0.0 + }, + "select_project": + { + "height": 500.0, + "selected_items": + [ + [ + "", + "/opt/PYTHON/waveform_analysis/wfmr_plots.sublime-project" + ] + ], + "width": 380.0 + }, + "show_minimap": true, + "show_open_files": false, + "show_tabs": true, + "side_bar_visible": true, + "side_bar_width": 289.0, + "status_bar_visible": true +} diff --git a/test_fft/__init__.py b/test_fft/__init__.py new file mode 100644 diff --git a/test_fft/__init__.pyc b/test_fft/__init__.pyc new file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..bf7bfa406c3ae8657db0af3aec5509e6eeb24847 GIT binary patch literal 125 zc${PY%*)lz7!j1r00oRd>;S~YEI=ZKfgxA}B;uz5l0zek)qsS4enE-8k6Tc@t8b`} uV~Br{eo1O^NqkybiGF;1W?p7Ve7s&kWeEpRsZDNvN@-529mv39kO2Un@fQ;S diff --git a/test_fft/fft_test_functions.py b/test_fft/fft_test_functions.py new file mode 100644 --- /dev/null +++ b/test_fft/fft_test_functions.py @@ -0,0 +1,38 @@ +import numpy as np + +from __main__ import RMAPPlugin0 + +def getWaveFromRecord( cwf, bufferSize, offset, column ): + yVector = cwf[(0+offset):(bufferSize+offset), column] + return yVector + +def sineWave( bufferSize, nbPeriod, amplitude): + deltaX = nbPeriod * 2 * np.pi / bufferSize + xVector = np.arange( bufferSize ) * deltaX + yVector = np.int16( amplitude * np.sin( xVector ) ) + return yVector + +def continuous( bufferSize, value ): + tmpVector = np.empty( bufferSize ) + tmpVector.fill( value ) + yVector = np.int16( tmpVector ) + return yVector + +def generateDataToWrite( bufferSize, wfrm0, wfrm1 ): + dataVector = [] + for k in range(bufferSize): + dataVector.append( ( wfrm1[k] << 16) + wfrm0[k] ) + return dataVector + +def print_reg_fft( address_CTRL ): + fft_reg = RMAPPlugin0.Read( address_CTRL, 1) + out_ren = (fft_reg[0] & 0x0000001f) + out_reuse = (fft_reg[0] & 0x000003e0) >> 5 + out_locked = (fft_reg[0] & 0x00007c00) >> 10 + MEM_IN_SM_Full = (fft_reg[0] & 0x000f8000) >> 15 + MEM_IN_SM_Empty = (fft_reg[0] & 0x01f00000) >> 20 + print "out_ren = " + bin( out_ren ) \ + + ", out_reuse = " + bin( out_reuse ) \ + + ", out_locked = " + bin( out_locked ) \ + + ", MEM_IN_SM_Full = " + bin( MEM_IN_SM_Full ) \ + + ", MEM_IN_SM_Empty = " + bin( MEM_IN_SM_Empty ) diff --git a/test_fft/fft_test_functions.pyc b/test_fft/fft_test_functions.pyc new file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2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`f}2q&gNc|PC 0111 1100 0001 1111 +RMAPPlugin0.Write( address_CTRL, [0x00007c1f] ) + +# wait for SM_Full +fft_reg = RMAPPlugin0.Read( address_CTRL, 1) +while (fft_reg[0] & 0x000f8000) == 0: + print "SM not full" + fft_reg = RMAPPlugin0.Read( address_CTRL, 1) + +print_reg_fft( address_CTRL ) + +# READ FFT +print "read data in fft FIFOs" +fft0_re = np.zeros( nbSamples ) +fft0_im = np.zeros( nbSamples ) +fft1_re = np.zeros( nbSamples ) +fft1_im = np.zeros( nbSamples ) +fft2_re = np.zeros( nbSamples ) +fft2_im = np.zeros( nbSamples ) +fft3_re = np.zeros( nbSamples ) +fft3_im = np.zeros( nbSamples ) +fft4_re = np.zeros( nbSamples ) +fft4_im = np.zeros( nbSamples ) + +for k in range(nbSamples): + val = RMAPPlugin0.Read( address_MEM_IN_SM_0, 1) + fft0_re[k] = val[0] & 0xffff + fft0_im[k] = ( val[0] >> 16 ) & 0xffff + val = RMAPPlugin0.Read( address_MEM_IN_SM_1, 1) + fft1_re[k] = val[0] & 0x0000ffff + fft1_im[k] = ( val[0] >> 16 ) & 0xffff + val = RMAPPlugin0.Read( address_MEM_IN_SM_2, 1) + fft2_re[k] = val[0] & 0x0000ffff + fft2_im[k] = ( val[0] >> 16 ) & 0xffff + val = RMAPPlugin0.Read( address_MEM_IN_SM_3, 1) + fft3_re[k] = val[0] & 0x0000ffff + fft3_im[k] = ( val[0] >> 16 ) & 0xffff + val = RMAPPlugin0.Read( address_MEM_IN_SM_4, 1) + fft4_re[k] = val[0] & 0x0000ffff + fft4_im[k] = ( val[0] >> 16 ) & 0xffff + # read enable => 0111 1100 0000 0000 + RMAPPlugin0.Write( address_CTRL, [0x00007c00] ) + +print "data read in fft FIFOs" + +print_reg_fft( address_CTRL ) + +#unlock FIFOs => 0000 0000 0001 1111 +RMAPPlugin0.Write( address_CTRL, [0x0000001f] ) + +print_reg_fft( address_CTRL ) + +# PLOT FFT + +plt.figure( 1 ) +plt.subplot(231) +plt.plot(wfrm0) +plt.subplot(232) +plt.plot(wfrm1) +plt.plot(wfrm1, '.') +plt.subplot(233) +plt.plot(wfrm2) +plt.subplot(234) +plt.plot(wfrm3) +plt.subplot(235) +plt.plot(wfrm4) + +plt.figure( 2 ) +plt.subplot(311) +plt.plot(fft0_re) +plt.plot(fft1_re) +plt.plot(fft2_re) +plt.plot(fft3_re) +plt.plot(fft4_re) + +plt.subplot(312) +plt.plot(fft0_im) +plt.plot(fft1_im) +plt.plot(fft2_im) +plt.plot(fft3_im) +plt.plot(fft4_im) + +plt.subplot(313) +plt.plot(fft0_re * fft0_re + fft0_im * fft0_im, 'b') +plt.plot(fft1_re * fft1_re + fft1_im * fft1_im, 'g') +plt.plot(fft2_re * fft2_re + fft2_im * fft2_im, 'r') +plt.plot(fft3_re * fft3_re + fft3_im * fft3_im, 'c') +plt.plot(fft4_re * fft4_re + fft4_im * fft4_im, 'm') + +plt.show() \ No newline at end of file