1import os.path 2import numpy as np 3import itertools 4import Tools 5 6 7# Those patterns are used for tests and benchmarks. 8# For tests, there is the need to add tests for saturation 9 10 11 12def writeTests(config): 13 NBSAMPLES=256 14 15 samples=np.random.randn(NBSAMPLES) 16 samples = Tools.normalize(samples) 17 config.writeInput(1, samples,"Samples") 18 19 20def generatePatterns(): 21 PATTERNDIR = os.path.join("Patterns","DSP","Controller","Controller") 22 PARAMDIR = os.path.join("Parameters","DSP","Controller","Controller") 23 24 configf32=Tools.Config(PATTERNDIR,PARAMDIR,"f32") 25 configf16=Tools.Config(PATTERNDIR,PARAMDIR,"f16") 26 configq31=Tools.Config(PATTERNDIR,PARAMDIR,"q31") 27 configq15=Tools.Config(PATTERNDIR,PARAMDIR,"q15") 28 29 30 writeTests(configf32) 31 writeTests(configf16) 32 writeTests(configq31) 33 writeTests(configq15) 34 35if __name__ == '__main__': 36 generatePatterns() 37 38 39