(no commit message)
[libreriscv.git] / openpower / sv / remapfft.py
index 458c839c237d707234ad933cdfd9744a7b7a43ab..43590f2274fc43dcd8d00cfa5a5cb5a5cf5d42bc 100644 (file)
@@ -1,8 +1,11 @@
-# FFT and convolution test (Python)
+# FFT and convolution test (Python), "generators" version
 #
 # Copyright (c) 2020 Project Nayuki. (MIT License)
 # https://www.nayuki.io/page/free-small-fft-in-multiple-languages
 #
+# Copyright (C) 2021 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
+# https://libre-soc.org/openpower/sv/remap/
+#
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
 # in the Software without restriction, including without limitation the rights
@@ -94,15 +97,16 @@ def transform_radix2(vec, inverse, generators_mode):
         SVSHAPE0 = SVSHAPE()
         SVSHAPE0.lims = [n, 0, 0]
         SVSHAPE0.order = [0,1,2]
-        SVSHAPE0.mode = 0b00
+        SVSHAPE0.mode = 0b01      # FFT mode
+        SVSHAPE0.skip = 0b00
         SVSHAPE0.offset = 0
         SVSHAPE0.invxyz = [0,0,0] # inversion if desired
         # j+halfstep schedule
         SVSHAPE1 = deepcopy(SVSHAPE0)
-        SVSHAPE1.mode = 0b01
+        SVSHAPE1.skip = 0b01
         # k schedule
         SVSHAPE2 = deepcopy(SVSHAPE0)
-        SVSHAPE2.mode = 0b10
+        SVSHAPE2.skip = 0b10
 
         # enumerate over the iterator function, getting 3 *different* indices
         for idx, (jl, jh, k) in enumerate(zip(iterate_indices(SVSHAPE0),
@@ -160,7 +164,10 @@ def convolve(xvec, yvec, realoutput=True):
     else:
         return [(val / n) for val in xvec]
 
+
+###################################
 # ---- Main and test functions ----
+###################################
 
 def main():
     global _maxlogerr