{"action":"created","comment":{"url":"https://api.github.com/repos/maxeler/maxpower/pulls/comments/46692512","id":46692512,"diff_hunk":"@@ -0,0 +1,415 @@\n+package maxpower.fft;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import maxpower.kernel.mem.Transpose;\n+\n+import com.maxeler.maxcompiler.v2.kernelcompiler.Kernel;\n+import com.maxeler.maxcompiler.v2.kernelcompiler.KernelLib;\n+import com.maxeler.maxcompiler.v2.kernelcompiler.stdlib.core.Count.Params;\n+import com.maxeler.maxcompiler.v2.kernelcompiler.stdlib.core.CounterChain;\n+import com.maxeler.maxcompiler.v2.kernelcompiler.stdlib.memory.Memory;\n+import com.maxeler.maxcompiler.v2.kernelcompiler.types.KernelObject;\n+import com.maxeler.maxcompiler.v2.kernelcompiler.types.KernelType;\n+import com.maxeler.maxcompiler.v2.kernelcompiler.types.base.DFEType;\n+import com.maxeler.maxcompiler.v2.kernelcompiler.types.base.DFEVar;\n+import com.maxeler.maxcompiler.v2.kernelcompiler.types.composite.DFEVector;\n+import com.maxeler.maxcompiler.v2.kernelcompiler.types.composite.DFEVectorType;\n+import com.maxeler.maxcompiler.v2.utils.MathUtils;\n+\n+/**\n+ * Containing all buffer used in the fft\n+ *\n+ * @author Stephen Girdlestone\n+ * @author Nils Voss\n+ */\n+public class FftBufferLib {\n+\n+\tstatic final int ADDRESSING_BIT_REVERSE_RAM0[][] = {{0, 1, 2, 3}, {0, 2, 3, 1}, {0, 3, 1, 2}};\n+\tstatic final int ADDRESSING_BIT_REVERSE_RAM1[][] = {{0, 1, 2, 3}, {1, 3, 0, 2}, {3, 2, 1, 0}, {2, 0, 3, 1}};\n+\tstatic final int ADDRESSING_BIT_REVERSE_RAM2[][] = {{0, 1, 2, 3}, {2, 0, 1, 3}, {1, 2, 0, 3}};\n+\tstatic final int ADDRESSING_BIT_REVERSE_RAM3[][] = {{0, 1, 2, 3}, {3, 1, 2, 0}};\n+\tstatic final int BIT_REVERSE_RAM_LATENCY[] = {3, 4, 3, 2};\n+\tstatic final int SWAPPING_BIT_REVERSE[][] = {{0, 2, 1, 3}, {2, 0, 3, 1}, {1, 3, 2, 0}, {3, 1, 0, 2}};\n+\n+\t/**\n+\t * Creates a buffer to store data between two stages in the fft.\n+\t *\n+\t * @param input Data from the previous fft stage.\n+\t * @param fftSize Size of the fft and as a result also size of the buffer.\n+\t * @param radix Radix of the fft stages connected to the buffer.\n+\t * @return Data to be feed into the next fft stage.\n+\t */\n+\tprotected static <T extends KernelObject<T>> List<T> applyInterStageBuffer(List<T> input, int fftSize) {\n+\t\tint numPipes = FourierTransform.NUM_FFT_PIPES;\n+\n+\t\tif (fftSize % numPipes != 0) {\n+\t\t\tthrow new IllegalArgumentException(\"fftSize must be divisible by numPipes.\");\n+\t\t}\n+\t\tint bufferDepth = fftSize / numPipes;\n+\n+\t\tList<DFEVar> packedInput = packInput(input);\n+\t\tDFEVector<DFEVar> output;\n+\t\tint height = bufferDepth / (numPipes * numPipes);\n+\t\tif (height > 0) {\n+\t\t\tList<DFEVar> transposedInput = new ArrayList<DFEVar>(numPipes);\n+\n+\t\t\ttransposedInput.addAll(transpose(packedInput, numPipes));\n+\n+\t\t\tDFEVector<DFEVar> packedData = DFEVectorType.newInstance(transposedInput);\n+\t\t\tDFEVectorType<DFEVar> packedType = packedData.getType();\n+\n+\t\t\toutput = packedType.unpack(transpose(packedData.pack(), numPipes,\n+\t\t\t\t\theight, numPipes));\n+\t\t} else {\n+\t\t\tDFEVector<DFEVar> packedData = DFEVectorType.newInstance(packedInput);\n+\t\t\tDFEVectorType<DFEVar> packedType = packedData.getType();\n+\n+\t\t\toutput = packedType.unpack(Transpose.transpose(packedData.pack(),\n+\t\t\t\t\tbufferDepth / numPipes, numPipes));\n+\t\t}\n+\n+\t\tList<DFEVar> transposedOutput = transpose(output.getElementsAsList(), numPipes);\n+\n+\t\treturn unpackOutput(transposedOutput, input[0].getType());\n+\t}\n+\n+\t/**\n+\t * Buffer used to arrange the input data for the fft\n+\t * Only tested for 4 Pipes and a Radix of 4.\n+\t * @param input Input data\n+\t * @param fftSize Size of the fft\n+\t * @return Data ready to be feed into the first fft stage\n+\t */\n+\tprotected static <T extends KernelObject<T>> List<T> applyInputBuffer(List<T> input, int fftSize) {\n+\t\tint numPipes = FourierTransform.NUM_FFT_PIPES;\n+\n+\t\tList<DFEVar> packedInput = packInput(input);\n+\n+\t\tDFEVector<DFEVar> transposerInput = DFEVectorType.newInstance(packedInput);\n+\n+\t\tDFEVector<DFEVar> transposerResult =\n+\t\t\ttransposerInput.getType().unpack(Transpose.transpose(transposerInput.pack(),\n+\t\t\t\t\tfftSize / numPipes / numPipes, numPipes));\n+\n+\t\t// Now we finish with a small 4 x 4 transpose in the end\n+\t\tList<DFEVar> outputTranspose = transpose(transposerResult.getElementsAsList(), numPipes);\n+\n+\t\treturn unpackOutput(outputTranspose, input[0].getType());\n+\t}\n+\n+\tprivate static <T extends KernelObject<T>> List<T>transpose(List<T> input, int numOutputs) {","path":"src/maxpower/fft/FftBufferLib.maxj","position":102,"original_position":102,"commit_id":"06748971abcc4dfc82567081e2a835d37d58a643","original_commit_id":"06748971abcc4dfc82567081e2a835d37d58a643","user":{"login":"chr1sj0nes","id":387854,"avatar_url":"https://avatars.githubusercontent.com/u/387854?v=3","gravatar_id":"","url":"https://api.github.com/users/chr1sj0nes","html_url":"https://github.com/chr1sj0nes","followers_url":"https://api.github.com/users/chr1sj0nes/followers","following_url":"https://api.github.com/users/chr1sj0nes/following{/other_user}","gists_url":"https://api.github.com/users/chr1sj0nes/gists{/gist_id}","starred_url":"https://api.github.com/users/chr1sj0nes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chr1sj0nes/subscriptions","organizations_url":"https://api.github.com/users/chr1sj0nes/orgs","repos_url":"https://api.github.com/users/chr1sj0nes/repos","events_url":"https://api.github.com/users/chr1sj0nes/events{/privacy}","received_events_url":"https://api.github.com/users/chr1sj0nes/received_events","type":"User","site_admin":false},"body":"Missing space between return type and method name.","created_at":"2015-12-04T15:24:30Z","updated_at":"2015-12-04T15:24:30Z","html_url":"https://github.com/maxeler/maxpower/pull/39#discussion_r46692512","pull_request_url":"https://api.github.com/repos/maxeler/maxpower/pulls/39","_links":{"self":{"href":"https://api.github.com/repos/maxeler/maxpower/pulls/comments/46692512"},"html":{"href":"https://github.com/maxeler/maxpower/pull/39#discussion_r46692512"},"pull_request":{"href":"https://api.github.com/repos/maxeler/maxpower/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/maxeler/maxpower/pulls/39","id":51097149,"html_url":"https://github.com/maxeler/maxpower/pull/39","diff_url":"https://github.com/maxeler/maxpower/pull/39.diff","patch_url":"https://github.com/maxeler/maxpower/pull/39.patch","issue_url":"https://api.github.com/repos/maxeler/maxpower/issues/39","number":39,"state":"open","locked":false,"title":"Fft","user":{"login":"nilsv","id":14997140,"avatar_url":"https://avatars.githubusercontent.com/u/14997140?v=3","gravatar_id":"","url":"https://api.github.com/users/nilsv","html_url":"https://github.com/nilsv","followers_url":"https://api.github.com/users/nilsv/followers","following_url":"https://api.github.com/users/nilsv/following{/other_user}","gists_url":"https://api.github.com/users/nilsv/gists{/gist_id}","starred_url":"https://api.github.com/users/nilsv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nilsv/subscriptions","organizations_url":"https://api.github.com/users/nilsv/orgs","repos_url":"https://api.github.com/users/nilsv/repos","events_url":"https://api.github.com/users/nilsv/events{/privacy}","received_events_url":"https://api.github.com/users/nilsv/received_events","type":"User","site_admin":false},"body":"We still want to make changes to the Interface. This will probably only require changes to FftFactory4Pipes and Encoder.\r\nThe remaining classes should be pretty \"final\" (Yes I know that there are probably 1000 things you want me to change).","created_at":"2015-11-18T15:19:32Z","updated_at":"2015-12-04T15:24:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f4703f8f485b26e4aee1a0e04fcb865b059d3dac","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/maxeler/maxpower/pulls/39/commits","review_comments_url":"https://api.github.com/repos/maxeler/maxpower/pulls/39/comments","review_comment_url":"https://api.github.com/repos/maxeler/maxpower/pulls/comments{/number}","comments_url":"https://api.github.com/repos/maxeler/maxpower/issues/39/comments","statuses_url":"https://api.github.com/repos/maxeler/maxpower/statuses/06748971abcc4dfc82567081e2a835d37d58a643","head":{"label":"maxeler:FFT","ref":"FFT","sha":"06748971abcc4dfc82567081e2a835d37d58a643","user":{"login":"maxeler","id":10088478,"avatar_url":"https://avatars.githubusercontent.com/u/10088478?v=3","gravatar_id":"","url":"https://api.github.com/users/maxeler","html_url":"https://github.com/maxeler","followers_url":"https://api.github.com/users/maxeler/followers","following_url":"https://api.github.com/users/maxeler/following{/other_user}","gists_url":"https://api.github.com/users/maxeler/gists{/gist_id}","starred_url":"https://api.github.com/users/maxeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxeler/subscriptions","organizations_url":"https://api.github.com/users/maxeler/orgs","repos_url":"https://api.github.com/users/maxeler/repos","events_url":"https://api.github.com/users/maxeler/events{/privacy}","received_events_url":"https://api.github.com/users/maxeler/received_events","type":"Organization","site_admin":false},"repo":{"id":27921920,"name":"maxpower","full_name":"maxeler/maxpower","owner":{"login":"maxeler","id":10088478,"avatar_url":"https://avatars.githubusercontent.com/u/10088478?v=3","gravatar_id":"","url":"https://api.github.com/users/maxeler","html_url":"https://github.com/maxeler","followers_url":"https://api.github.com/users/maxeler/followers","following_url":"https://api.github.com/users/maxeler/following{/other_user}","gists_url":"https://api.github.com/users/maxeler/gists{/gist_id}","starred_url":"https://api.github.com/users/maxeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxeler/subscriptions","organizations_url":"https://api.github.com/users/maxeler/orgs","repos_url":"https://api.github.com/users/maxeler/repos","events_url":"https://api.github.com/users/maxeler/events{/privacy}","received_events_url":"https://api.github.com/users/maxeler/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/maxeler/maxpower","description":"Maxeler standard library","fork":false,"url":"https://api.github.com/repos/maxeler/maxpower","forks_url":"https://api.github.com/repos/maxeler/maxpower/forks","keys_url":"https://api.github.com/repos/maxeler/maxpower/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maxeler/maxpower/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maxeler/maxpower/teams","hooks_url":"https://api.github.com/repos/maxeler/maxpower/hooks","issue_events_url":"https://api.github.com/repos/maxeler/maxpower/issues/events{/number}","events_url":"https://api.github.com/repos/maxeler/maxpower/events","assignees_url":"https://api.github.com/repos/maxeler/maxpower/assignees{/user}","branches_url":"https://api.github.com/repos/maxeler/maxpower/branches{/branch}","tags_url":"https://api.github.com/repos/maxeler/maxpower/tags","blobs_url":"https://api.github.com/repos/maxeler/maxpower/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maxeler/maxpower/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maxeler/maxpower/git/refs{/sha}","trees_url":"https://api.github.com/repos/maxeler/maxpower/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maxeler/maxpower/statuses/{sha}","languages_url":"https://api.github.com/repos/maxeler/maxpower/languages","stargazers_url":"https://api.github.com/repos/maxeler/maxpower/stargazers","contributors_url":"https://api.github.com/repos/maxeler/maxpower/contributors","subscribers_url":"https://api.github.com/repos/maxeler/maxpower/subscribers","subscription_url":"https://api.github.com/repos/maxeler/maxpower/subscription","commits_url":"https://api.github.com/repos/maxeler/maxpower/commits{/sha}","git_commits_url":"https://api.github.com/repos/maxeler/maxpower/git/commits{/sha}","comments_url":"https://api.github.com/repos/maxeler/maxpower/comments{/number}","issue_comment_url":"https://api.github.com/repos/maxeler/maxpower/issues/comments{/number}","contents_url":"https://api.github.com/repos/maxeler/maxpower/contents/{+path}","compare_url":"https://api.github.com/repos/maxeler/maxpower/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maxeler/maxpower/merges","archive_url":"https://api.github.com/repos/maxeler/maxpower/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maxeler/maxpower/downloads","issues_url":"https://api.github.com/repos/maxeler/maxpower/issues{/number}","pulls_url":"https://api.github.com/repos/maxeler/maxpower/pulls{/number}","milestones_url":"https://api.github.com/repos/maxeler/maxpower/milestones{/number}","notifications_url":"https://api.github.com/repos/maxeler/maxpower/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maxeler/maxpower/labels{/name}","releases_url":"https://api.github.com/repos/maxeler/maxpower/releases{/id}","created_at":"2014-12-12T13:40:35Z","updated_at":"2015-10-13T09:44:13Z","pushed_at":"2015-12-04T12:43:07Z","git_url":"git://github.com/maxeler/maxpower.git","ssh_url":"git@github.com:maxeler/maxpower.git","clone_url":"https://github.com/maxeler/maxpower.git","svn_url":"https://github.com/maxeler/maxpower","homepage":null,"size":2853,"stargazers_count":7,"watchers_count":7,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7,"mirror_url":null,"open_issues_count":15,"forks":7,"open_issues":15,"watchers":7,"default_branch":"master"}},"base":{"label":"maxeler:master","ref":"master","sha":"8e0802cab290747708806142d86ecead0af3d768","user":{"login":"maxeler","id":10088478,"avatar_url":"https://avatars.githubusercontent.com/u/10088478?v=3","gravatar_id":"","url":"https://api.github.com/users/maxeler","html_url":"https://github.com/maxeler","followers_url":"https://api.github.com/users/maxeler/followers","following_url":"https://api.github.com/users/maxeler/following{/other_user}","gists_url":"https://api.github.com/users/maxeler/gists{/gist_id}","starred_url":"https://api.github.com/users/maxeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxeler/subscriptions","organizations_url":"https://api.github.com/users/maxeler/orgs","repos_url":"https://api.github.com/users/maxeler/repos","events_url":"https://api.github.com/users/maxeler/events{/privacy}","received_events_url":"https://api.github.com/users/maxeler/received_events","type":"Organization","site_admin":false},"repo":{"id":27921920,"name":"maxpower","full_name":"maxeler/maxpower","owner":{"login":"maxeler","id":10088478,"avatar_url":"https://avatars.githubusercontent.com/u/10088478?v=3","gravatar_id":"","url":"https://api.github.com/users/maxeler","html_url":"https://github.com/maxeler","followers_url":"https://api.github.com/users/maxeler/followers","following_url":"https://api.github.com/users/maxeler/following{/other_user}","gists_url":"https://api.github.com/users/maxeler/gists{/gist_id}","starred_url":"https://api.github.com/users/maxeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxeler/subscriptions","organizations_url":"https://api.github.com/users/maxeler/orgs","repos_url":"https://api.github.com/users/maxeler/repos","events_url":"https://api.github.com/users/maxeler/events{/privacy}","received_events_url":"https://api.github.com/users/maxeler/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/maxeler/maxpower","description":"Maxeler standard library","fork":false,"url":"https://api.github.com/repos/maxeler/maxpower","forks_url":"https://api.github.com/repos/maxeler/maxpower/forks","keys_url":"https://api.github.com/repos/maxeler/maxpower/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maxeler/maxpower/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maxeler/maxpower/teams","hooks_url":"https://api.github.com/repos/maxeler/maxpower/hooks","issue_events_url":"https://api.github.com/repos/maxeler/maxpower/issues/events{/number}","events_url":"https://api.github.com/repos/maxeler/maxpower/events","assignees_url":"https://api.github.com/repos/maxeler/maxpower/assignees{/user}","branches_url":"https://api.github.com/repos/maxeler/maxpower/branches{/branch}","tags_url":"https://api.github.com/repos/maxeler/maxpower/tags","blobs_url":"https://api.github.com/repos/maxeler/maxpower/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maxeler/maxpower/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maxeler/maxpower/git/refs{/sha}","trees_url":"https://api.github.com/repos/maxeler/maxpower/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maxeler/maxpower/statuses/{sha}","languages_url":"https://api.github.com/repos/maxeler/maxpower/languages","stargazers_url":"https://api.github.com/repos/maxeler/maxpower/stargazers","contributors_url":"https://api.github.com/repos/maxeler/maxpower/contributors","subscribers_url":"https://api.github.com/repos/maxeler/maxpower/subscribers","subscription_url":"https://api.github.com/repos/maxeler/maxpower/subscription","commits_url":"https://api.github.com/repos/maxeler/maxpower/commits{/sha}","git_commits_url":"https://api.github.com/repos/maxeler/maxpower/git/commits{/sha}","comments_url":"https://api.github.com/repos/maxeler/maxpower/comments{/number}","issue_comment_url":"https://api.github.com/repos/maxeler/maxpower/issues/comments{/number}","contents_url":"https://api.github.com/repos/maxeler/maxpower/contents/{+path}","compare_url":"https://api.github.com/repos/maxeler/maxpower/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maxeler/maxpower/merges","archive_url":"https://api.github.com/repos/maxeler/maxpower/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maxeler/maxpower/downloads","issues_url":"https://api.github.com/repos/maxeler/maxpower/issues{/number}","pulls_url":"https://api.github.com/repos/maxeler/maxpower/pulls{/number}","milestones_url":"https://api.github.com/repos/maxeler/maxpower/milestones{/number}","notifications_url":"https://api.github.com/repos/maxeler/maxpower/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maxeler/maxpower/labels{/name}","releases_url":"https://api.github.com/repos/maxeler/maxpower/releases{/id}","created_at":"2014-12-12T13:40:35Z","updated_at":"2015-10-13T09:44:13Z","pushed_at":"2015-12-04T12:43:07Z","git_url":"git://github.com/maxeler/maxpower.git","ssh_url":"git@github.com:maxeler/maxpower.git","clone_url":"https://github.com/maxeler/maxpower.git","svn_url":"https://github.com/maxeler/maxpower","homepage":null,"size":2853,"stargazers_count":7,"watchers_count":7,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7,"mirror_url":null,"open_issues_count":15,"forks":7,"open_issues":15,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/maxeler/maxpower/pulls/39"},"html":{"href":"https://github.com/maxeler/maxpower/pull/39"},"issue":{"href":"https://api.github.com/repos/maxeler/maxpower/issues/39"},"comments":{"href":"https://api.github.com/repos/maxeler/maxpower/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/maxeler/maxpower/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/maxeler/maxpower/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/maxeler/maxpower/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/maxeler/maxpower/statuses/06748971abcc4dfc82567081e2a835d37d58a643"}}}}