{"action":"created","comment":{"url":"https://api.github.com/repos/maxeler/maxpower/pulls/comments/45780436","id":45780436,"diff_hunk":"@@ -0,0 +1,151 @@\n+package maxpower.kernel;\n+\n+import com.maxeler.maxcompiler.v2.errors.MaxCompilerAPIError;\n+import com.maxeler.maxcompiler.v2.kernelcompiler.Kernel;\n+import com.maxeler.maxcompiler.v2.kernelcompiler.KernelLib;\n+import com.maxeler.maxcompiler.v2.kernelcompiler.types.KernelObject;\n+import com.maxeler.maxcompiler.v2.kernelcompiler.types.KernelObjectVectorizable;\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+ * A way to, with one function call, mux a variable amount per tick of valid data from the start of a wide input to some hot positions, or the inverse (demux).\n+ *\n+ * @author dpackwood\n+ *\n+ */\n+public class NHotMux {\n+\t/**\n+\t *\n+\t * @param input A wide vector with some variable amount of valid data which is positioned at the beginning of the input.\n+\t * @param hotVector A vector of DFEBool some amount of which are hot (the positions where valid data end up), the mapping is monotonic.\n+\t * @param numValid The number of valid data in the input (should be equal to the sum of the number of hot elements in hotVector, this is not checked\n+\t * for internally)\n+\t * @return A vector of data with the valid data at the hot positions, the data at the unhot positions is undefined.\n+\t */\n+\tpublic static <T extends KernelObjectVectorizable<T, ?>> DFEVector<T> demux(DFEVector<T> input, DFEVector<DFEVar> hotVector, DFEVar numValid) {\n+\n+\t\tif (input.getSize() == 0) {\n+\t\t\tthrow new MaxCompilerAPIError(\"Cannot mux on a data vector of size zero.\");\n+\t\t}\n+\t\tif (input.getSize() != hotVector.getSize()) {\n+\t\t\tthrow new MaxCompilerAPIError(\"Width of data input and hot input must be the same.\");\n+\t\t}\n+\n+\t\tKernel owner = input.getKernel();\n+\t\tDFEVar myZero = owner.constant.var(0);\n+\t\tDFEVector<T> output = demuxRotateAndPlace(input, hotVector, myZero, numValid);\n+\t\treturn output;\n+\t}\n+\n+\t/**\n+\t * @param input A wide vector with some variable amount of valid data which is located at the hot positions.\n+\t * @param hotVector A vector of DFEBool, some amount of which are hot (the positions of the valid data in the input)\n+\t * @param numValid The number of valid data in the input (should be equal to the sum of the number of hot elements in hotVector, this is not checked","path":"src/maxpower/kernel/NHotMux.maxj","position":48,"original_position":48,"commit_id":"9cec03b86d8d3b57f8edfb31c1c3ce42773576a7","original_commit_id":"9cec03b86d8d3b57f8edfb31c1c3ce42773576a7","user":{"login":"stepeh","id":12087956,"avatar_url":"https://avatars.githubusercontent.com/u/12087956?v=3","gravatar_id":"","url":"https://api.github.com/users/stepeh","html_url":"https://github.com/stepeh","followers_url":"https://api.github.com/users/stepeh/followers","following_url":"https://api.github.com/users/stepeh/following{/other_user}","gists_url":"https://api.github.com/users/stepeh/gists{/gist_id}","starred_url":"https://api.github.com/users/stepeh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stepeh/subscriptions","organizations_url":"https://api.github.com/users/stepeh/orgs","repos_url":"https://api.github.com/users/stepeh/repos","events_url":"https://api.github.com/users/stepeh/events{/privacy}","received_events_url":"https://api.github.com/users/stepeh/received_events","type":"User","site_admin":false},"body":"Why do we need to specify this? Couldn't it just be counted instead?","created_at":"2015-11-24T19:15:28Z","updated_at":"2015-11-24T19:15:28Z","html_url":"https://github.com/maxeler/maxpower/pull/48#discussion_r45780436","pull_request_url":"https://api.github.com/repos/maxeler/maxpower/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/maxeler/maxpower/pulls/comments/45780436"},"html":{"href":"https://github.com/maxeler/maxpower/pull/48#discussion_r45780436"},"pull_request":{"href":"https://api.github.com/repos/maxeler/maxpower/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/maxeler/maxpower/pulls/48","id":51673172,"html_url":"https://github.com/maxeler/maxpower/pull/48","diff_url":"https://github.com/maxeler/maxpower/pull/48.diff","patch_url":"https://github.com/maxeler/maxpower/pull/48.patch","issue_url":"https://api.github.com/repos/maxeler/maxpower/issues/48","number":48,"state":"open","locked":false,"title":"Add NHotMux","user":{"login":"dpackwood","id":13117660,"avatar_url":"https://avatars.githubusercontent.com/u/13117660?v=3","gravatar_id":"","url":"https://api.github.com/users/dpackwood","html_url":"https://github.com/dpackwood","followers_url":"https://api.github.com/users/dpackwood/followers","following_url":"https://api.github.com/users/dpackwood/following{/other_user}","gists_url":"https://api.github.com/users/dpackwood/gists{/gist_id}","starred_url":"https://api.github.com/users/dpackwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpackwood/subscriptions","organizations_url":"https://api.github.com/users/dpackwood/orgs","repos_url":"https://api.github.com/users/dpackwood/repos","events_url":"https://api.github.com/users/dpackwood/events{/privacy}","received_events_url":"https://api.github.com/users/dpackwood/received_events","type":"User","site_admin":false},"body":"NHotMux is a class to mux a variable amount of data per tick between hot positions and the beginning of an input.","created_at":"2015-11-24T15:23:12Z","updated_at":"2015-11-24T19:15:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"172c096d1266acad4ee21df0d38fd22f90254b35","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/maxeler/maxpower/pulls/48/commits","review_comments_url":"https://api.github.com/repos/maxeler/maxpower/pulls/48/comments","review_comment_url":"https://api.github.com/repos/maxeler/maxpower/pulls/comments{/number}","comments_url":"https://api.github.com/repos/maxeler/maxpower/issues/48/comments","statuses_url":"https://api.github.com/repos/maxeler/maxpower/statuses/9cec03b86d8d3b57f8edfb31c1c3ce42773576a7","head":{"label":"dpackwood:NHotMuxDevel","ref":"NHotMuxDevel","sha":"9cec03b86d8d3b57f8edfb31c1c3ce42773576a7","user":{"login":"dpackwood","id":13117660,"avatar_url":"https://avatars.githubusercontent.com/u/13117660?v=3","gravatar_id":"","url":"https://api.github.com/users/dpackwood","html_url":"https://github.com/dpackwood","followers_url":"https://api.github.com/users/dpackwood/followers","following_url":"https://api.github.com/users/dpackwood/following{/other_user}","gists_url":"https://api.github.com/users/dpackwood/gists{/gist_id}","starred_url":"https://api.github.com/users/dpackwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpackwood/subscriptions","organizations_url":"https://api.github.com/users/dpackwood/orgs","repos_url":"https://api.github.com/users/dpackwood/repos","events_url":"https://api.github.com/users/dpackwood/events{/privacy}","received_events_url":"https://api.github.com/users/dpackwood/received_events","type":"User","site_admin":false},"repo":{"id":43893860,"name":"maxpower","full_name":"dpackwood/maxpower","owner":{"login":"dpackwood","id":13117660,"avatar_url":"https://avatars.githubusercontent.com/u/13117660?v=3","gravatar_id":"","url":"https://api.github.com/users/dpackwood","html_url":"https://github.com/dpackwood","followers_url":"https://api.github.com/users/dpackwood/followers","following_url":"https://api.github.com/users/dpackwood/following{/other_user}","gists_url":"https://api.github.com/users/dpackwood/gists{/gist_id}","starred_url":"https://api.github.com/users/dpackwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpackwood/subscriptions","organizations_url":"https://api.github.com/users/dpackwood/orgs","repos_url":"https://api.github.com/users/dpackwood/repos","events_url":"https://api.github.com/users/dpackwood/events{/privacy}","received_events_url":"https://api.github.com/users/dpackwood/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dpackwood/maxpower","description":"Maxeler standard library","fork":true,"url":"https://api.github.com/repos/dpackwood/maxpower","forks_url":"https://api.github.com/repos/dpackwood/maxpower/forks","keys_url":"https://api.github.com/repos/dpackwood/maxpower/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dpackwood/maxpower/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dpackwood/maxpower/teams","hooks_url":"https://api.github.com/repos/dpackwood/maxpower/hooks","issue_events_url":"https://api.github.com/repos/dpackwood/maxpower/issues/events{/number}","events_url":"https://api.github.com/repos/dpackwood/maxpower/events","assignees_url":"https://api.github.com/repos/dpackwood/maxpower/assignees{/user}","branches_url":"https://api.github.com/repos/dpackwood/maxpower/branches{/branch}","tags_url":"https://api.github.com/repos/dpackwood/maxpower/tags","blobs_url":"https://api.github.com/repos/dpackwood/maxpower/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dpackwood/maxpower/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dpackwood/maxpower/git/refs{/sha}","trees_url":"https://api.github.com/repos/dpackwood/maxpower/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dpackwood/maxpower/statuses/{sha}","languages_url":"https://api.github.com/repos/dpackwood/maxpower/languages","stargazers_url":"https://api.github.com/repos/dpackwood/maxpower/stargazers","contributors_url":"https://api.github.com/repos/dpackwood/maxpower/contributors","subscribers_url":"https://api.github.com/repos/dpackwood/maxpower/subscribers","subscription_url":"https://api.github.com/repos/dpackwood/maxpower/subscription","commits_url":"https://api.github.com/repos/dpackwood/maxpower/commits{/sha}","git_commits_url":"https://api.github.com/repos/dpackwood/maxpower/git/commits{/sha}","comments_url":"https://api.github.com/repos/dpackwood/maxpower/comments{/number}","issue_comment_url":"https://api.github.com/repos/dpackwood/maxpower/issues/comments{/number}","contents_url":"https://api.github.com/repos/dpackwood/maxpower/contents/{+path}","compare_url":"https://api.github.com/repos/dpackwood/maxpower/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dpackwood/maxpower/merges","archive_url":"https://api.github.com/repos/dpackwood/maxpower/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dpackwood/maxpower/downloads","issues_url":"https://api.github.com/repos/dpackwood/maxpower/issues{/number}","pulls_url":"https://api.github.com/repos/dpackwood/maxpower/pulls{/number}","milestones_url":"https://api.github.com/repos/dpackwood/maxpower/milestones{/number}","notifications_url":"https://api.github.com/repos/dpackwood/maxpower/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dpackwood/maxpower/labels{/name}","releases_url":"https://api.github.com/repos/dpackwood/maxpower/releases{/id}","created_at":"2015-10-08T14:24:44Z","updated_at":"2015-10-08T14:24:45Z","pushed_at":"2015-11-24T18:18:18Z","git_url":"git://github.com/dpackwood/maxpower.git","ssh_url":"git@github.com:dpackwood/maxpower.git","clone_url":"https://github.com/dpackwood/maxpower.git","svn_url":"https://github.com/dpackwood/maxpower","homepage":null,"size":862,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"maxeler:master","ref":"master","sha":"89dea69ba529178e87fd0eee23dd792f7f942436","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-11-24T18:18:19Z","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":2691,"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":12,"forks":7,"open_issues":12,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/maxeler/maxpower/pulls/48"},"html":{"href":"https://github.com/maxeler/maxpower/pull/48"},"issue":{"href":"https://api.github.com/repos/maxeler/maxpower/issues/48"},"comments":{"href":"https://api.github.com/repos/maxeler/maxpower/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/maxeler/maxpower/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/maxeler/maxpower/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/maxeler/maxpower/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/maxeler/maxpower/statuses/9cec03b86d8d3b57f8edfb31c1c3ce42773576a7"}}}}