{"action":"created","comment":{"url":"https://api.github.com/repos/martinisgroup/servers/pulls/comments/29394061","id":29394061,"diff_hunk":"@@ -4,182 +4,234 @@\n import numpy as np\n from util import littleEndian\n \n-JUMP_INDEX_MIN = 1\n+JUMP_INDEX_MIN = 0\n JUMP_INDEX_MAX = 15\n IDLE_MIN_CYCLES = 1\n-IDLE_MAX_CYCLES = (2**15)-1\n+IDLE_MAX_CYCLES = (2 ** 15) - 1\n DAISY_VALUE_MIN = 0\n DAISY_VALUE_MAX = 15\n \n NUM_COUNTERS = 4\n \n SRAM_ADDR_MIN = 0\n-SRAM_ADDR_MAX = 8192 - 1 #XXX HACK ALERT! This should be imported from other module or registry!!!\n+SRAM_ADDR_MAX = 8192 - 1  # XXX HACK ALERT! This should be imported from other module or registry!!!\n \n # A single entry in the jump table\n \n+\n class JumpEntry(object):\n-    \"\"\"A single entry in the jump table\"\"\"\n-    def __init__(self, fromAddr, toAddr, operation=None):\n-        self.fromAddr = fromAddr\n-        self.toAddr = toAddr\n+    \"\"\" A single entry in the jump table.\n+\n+    * Every from address has 2 subtracted to account for FPGA timing offsets.\n+    * The END entry has an additional 1 subtracted.\n+    * IDLE has one clock cycle subtracted from idle length as well.\n+\n+    A note about from addresses:\n+\n+    We subtract 2 from the from_addr passed into the JumpEntry. The reason for\n+    this is that by convention we set the end address of an algorithm to the\n+    length of the sequence. That is, if the SRAM is length 256 ns, then we set\n+    the end address to 256//4 == 64. However, if we want to idle over the last\n+    4 ns/jump after the last 4 ns/whatever, then we need to notice that those\n+    4ns are from 252 - 255, i.e. address 63. So we set the from_address to 62,\n+    because the actual fromAddress must be one less than the address you want,\n+    due to FPGA offsets, per John's documentation. (In the case of END, it's\n+    two less, and that's handled as well.)\n+    \"\"\"\n+\n+    def __init__(self, from_addr, to_addr, operation):\n+        \"\"\" Create a single jump table entry.\n+\n+        :param int from_addr: the from address\n+        :param int to_addr: the to address (should be 0 if not used)\n+        :param Operation operation: the operation\n+        \"\"\"\n+        if abs(from_addr - to_addr) - 1 == 0:\n+            raise ValueError(\n+                \"from_addr: {} and to_addr: {} are too close\".format(\n+                    from_addr, to_addr)\n+            )\n+        self._to_addr = 0\n+        self._from_addr = 0","path":"GHzDACs/jumpTable.py","position":59,"original_position":59,"commit_id":"006e98010e79d6696118f10a05bef9d6a7b2537a","original_commit_id":"006e98010e79d6696118f10a05bef9d6a7b2537a","user":{"login":"maffoo","id":129268,"avatar_url":"https://avatars.githubusercontent.com/u/129268?v=3","gravatar_id":"","url":"https://api.github.com/users/maffoo","html_url":"https://github.com/maffoo","followers_url":"https://api.github.com/users/maffoo/followers","following_url":"https://api.github.com/users/maffoo/following{/other_user}","gists_url":"https://api.github.com/users/maffoo/gists{/gist_id}","starred_url":"https://api.github.com/users/maffoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maffoo/subscriptions","organizations_url":"https://api.github.com/users/maffoo/orgs","repos_url":"https://api.github.com/users/maffoo/repos","events_url":"https://api.github.com/users/maffoo/events{/privacy}","received_events_url":"https://api.github.com/users/maffoo/received_events","type":"User","site_admin":false},"body":"Should probably remove these and just let the setter property calls below do the work. Or are these just here to keep pycharm happy?","created_at":"2015-04-30T00:03:10Z","updated_at":"2015-04-30T00:03:10Z","html_url":"https://github.com/martinisgroup/servers/pull/123#discussion_r29394061","pull_request_url":"https://api.github.com/repos/martinisgroup/servers/pulls/123","_links":{"self":{"href":"https://api.github.com/repos/martinisgroup/servers/pulls/comments/29394061"},"html":{"href":"https://github.com/martinisgroup/servers/pull/123#discussion_r29394061"},"pull_request":{"href":"https://api.github.com/repos/martinisgroup/servers/pulls/123"}}},"pull_request":{"url":"https://api.github.com/repos/martinisgroup/servers/pulls/123","id":34402434,"html_url":"https://github.com/martinisgroup/servers/pull/123","diff_url":"https://github.com/martinisgroup/servers/pull/123.diff","patch_url":"https://github.com/martinisgroup/servers/pull/123.patch","issue_url":"https://api.github.com/repos/martinisgroup/servers/issues/123","number":123,"state":"open","locked":false,"title":"FPGA server changes for jump table","user":{"login":"pomalley","id":1106276,"avatar_url":"https://avatars.githubusercontent.com/u/1106276?v=3","gravatar_id":"","url":"https://api.github.com/users/pomalley","html_url":"https://github.com/pomalley","followers_url":"https://api.github.com/users/pomalley/followers","following_url":"https://api.github.com/users/pomalley/following{/other_user}","gists_url":"https://api.github.com/users/pomalley/gists{/gist_id}","starred_url":"https://api.github.com/users/pomalley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pomalley/subscriptions","organizations_url":"https://api.github.com/users/pomalley/orgs","repos_url":"https://api.github.com/users/pomalley/repos","events_url":"https://api.github.com/users/pomalley/events{/privacy}","received_events_url":"https://api.github.com/users/pomalley/received_events","type":"User","site_admin":false},"body":"This PR includes all the changes not in #122 required to get the jump table working.\r\n\r\nMinor things that should be very quick to review:\r\n\r\n* dc_rack_server.py\r\n* adc.py\r\n* fpga.py\r\n* ghzdac/* and ghzdac_cal/*\r\n\r\nThen I'd start at the bottom and work your way up:\r\n\r\n* Read John's documentation, if you like (the .doc file)\r\n* Review JumpTableIntro.md and look at jump_table_diagram.svg\r\n* Review jumpTable.py to see the low-level JT code, and look at the tests in test_jump_table.py\r\n* Review dac.py to see how that is called.\r\n* Review the ghz_fpga_server.py to see how _that_ is called.\r\n* Check out the tests in test_fpga_server.py\r\n  * The tests aren't great but I think it's the best we can do without spending a week (or more!) to figure out how to properly test a LabRAD server (i.e. a twisted thingy). I think they do cover the base cases and will catch things like offsets being added in unexpected places, etc.\r\n\r\nI think that covers it. Have fun!","created_at":"2015-04-29T20:27:23Z","updated_at":"2015-04-30T00:03:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"acbc1202780462c34897694b0b1868e8439ab1bb","assignee":null,"milestone":{"url":"https://api.github.com/repos/martinisgroup/servers/milestones/1","html_url":"https://github.com/martinisgroup/servers/milestones/Jump%20Table","labels_url":"https://api.github.com/repos/martinisgroup/servers/milestones/1/labels","id":1045740,"number":1,"title":"Jump Table","description":"Get the jump table working!","creator":{"login":"pomalley","id":1106276,"avatar_url":"https://avatars.githubusercontent.com/u/1106276?v=3","gravatar_id":"","url":"https://api.github.com/users/pomalley","html_url":"https://github.com/pomalley","followers_url":"https://api.github.com/users/pomalley/followers","following_url":"https://api.github.com/users/pomalley/following{/other_user}","gists_url":"https://api.github.com/users/pomalley/gists{/gist_id}","starred_url":"https://api.github.com/users/pomalley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pomalley/subscriptions","organizations_url":"https://api.github.com/users/pomalley/orgs","repos_url":"https://api.github.com/users/pomalley/repos","events_url":"https://api.github.com/users/pomalley/events{/privacy}","received_events_url":"https://api.github.com/users/pomalley/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":2,"state":"open","created_at":"2015-03-30T22:36:41Z","updated_at":"2015-04-29T20:28:51Z","due_on":"2015-04-15T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/martinisgroup/servers/pulls/123/commits","review_comments_url":"https://api.github.com/repos/martinisgroup/servers/pulls/123/comments","review_comment_url":"https://api.github.com/repos/martinisgroup/servers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/martinisgroup/servers/issues/123/comments","statuses_url":"https://api.github.com/repos/martinisgroup/servers/statuses/006e98010e79d6696118f10a05bef9d6a7b2537a","head":{"label":"martinisgroup:jt-fpga-server","ref":"jt-fpga-server","sha":"006e98010e79d6696118f10a05bef9d6a7b2537a","user":{"login":"martinisgroup","id":5026004,"avatar_url":"https://avatars.githubusercontent.com/u/5026004?v=3","gravatar_id":"","url":"https://api.github.com/users/martinisgroup","html_url":"https://github.com/martinisgroup","followers_url":"https://api.github.com/users/martinisgroup/followers","following_url":"https://api.github.com/users/martinisgroup/following{/other_user}","gists_url":"https://api.github.com/users/martinisgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/martinisgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinisgroup/subscriptions","organizations_url":"https://api.github.com/users/martinisgroup/orgs","repos_url":"https://api.github.com/users/martinisgroup/repos","events_url":"https://api.github.com/users/martinisgroup/events{/privacy}","received_events_url":"https://api.github.com/users/martinisgroup/received_events","type":"Organization","site_admin":false},"repo":{"id":21184808,"name":"servers","full_name":"martinisgroup/servers","owner":{"login":"martinisgroup","id":5026004,"avatar_url":"https://avatars.githubusercontent.com/u/5026004?v=3","gravatar_id":"","url":"https://api.github.com/users/martinisgroup","html_url":"https://github.com/martinisgroup","followers_url":"https://api.github.com/users/martinisgroup/followers","following_url":"https://api.github.com/users/martinisgroup/following{/other_user}","gists_url":"https://api.github.com/users/martinisgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/martinisgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinisgroup/subscriptions","organizations_url":"https://api.github.com/users/martinisgroup/orgs","repos_url":"https://api.github.com/users/martinisgroup/repos","events_url":"https://api.github.com/users/martinisgroup/events{/privacy}","received_events_url":"https://api.github.com/users/martinisgroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/martinisgroup/servers","description":"","fork":false,"url":"https://api.github.com/repos/martinisgroup/servers","forks_url":"https://api.github.com/repos/martinisgroup/servers/forks","keys_url":"https://api.github.com/repos/martinisgroup/servers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/martinisgroup/servers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/martinisgroup/servers/teams","hooks_url":"https://api.github.com/repos/martinisgroup/servers/hooks","issue_events_url":"https://api.github.com/repos/martinisgroup/servers/issues/events{/number}","events_url":"https://api.github.com/repos/martinisgroup/servers/events","assignees_url":"https://api.github.com/repos/martinisgroup/servers/assignees{/user}","branches_url":"https://api.github.com/repos/martinisgroup/servers/branches{/branch}","tags_url":"https://api.github.com/repos/martinisgroup/servers/tags","blobs_url":"https://api.github.com/repos/martinisgroup/servers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/martinisgroup/servers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/martinisgroup/servers/git/refs{/sha}","trees_url":"https://api.github.com/repos/martinisgroup/servers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/martinisgroup/servers/statuses/{sha}","languages_url":"https://api.github.com/repos/martinisgroup/servers/languages","stargazers_url":"https://api.github.com/repos/martinisgroup/servers/stargazers","contributors_url":"https://api.github.com/repos/martinisgroup/servers/contributors","subscribers_url":"https://api.github.com/repos/martinisgroup/servers/subscribers","subscription_url":"https://api.github.com/repos/martinisgroup/servers/subscription","commits_url":"https://api.github.com/repos/martinisgroup/servers/commits{/sha}","git_commits_url":"https://api.github.com/repos/martinisgroup/servers/git/commits{/sha}","comments_url":"https://api.github.com/repos/martinisgroup/servers/comments{/number}","issue_comment_url":"https://api.github.com/repos/martinisgroup/servers/issues/comments{/number}","contents_url":"https://api.github.com/repos/martinisgroup/servers/contents/{+path}","compare_url":"https://api.github.com/repos/martinisgroup/servers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/martinisgroup/servers/merges","archive_url":"https://api.github.com/repos/martinisgroup/servers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/martinisgroup/servers/downloads","issues_url":"https://api.github.com/repos/martinisgroup/servers/issues{/number}","pulls_url":"https://api.github.com/repos/martinisgroup/servers/pulls{/number}","milestones_url":"https://api.github.com/repos/martinisgroup/servers/milestones{/number}","notifications_url":"https://api.github.com/repos/martinisgroup/servers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/martinisgroup/servers/labels{/name}","releases_url":"https://api.github.com/repos/martinisgroup/servers/releases{/id}","created_at":"2014-06-25T00:07:25Z","updated_at":"2015-04-29T23:09:55Z","pushed_at":"2015-04-29T23:09:59Z","git_url":"git://github.com/martinisgroup/servers.git","ssh_url":"git@github.com:martinisgroup/servers.git","clone_url":"https://github.com/martinisgroup/servers.git","svn_url":"https://github.com/martinisgroup/servers","homepage":null,"size":54210,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":57,"forks":1,"open_issues":57,"watchers":2,"default_branch":"master"}},"base":{"label":"martinisgroup:master","ref":"master","sha":"7c9dc319eeacd92536f28726f30aa61adce36e1a","user":{"login":"martinisgroup","id":5026004,"avatar_url":"https://avatars.githubusercontent.com/u/5026004?v=3","gravatar_id":"","url":"https://api.github.com/users/martinisgroup","html_url":"https://github.com/martinisgroup","followers_url":"https://api.github.com/users/martinisgroup/followers","following_url":"https://api.github.com/users/martinisgroup/following{/other_user}","gists_url":"https://api.github.com/users/martinisgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/martinisgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinisgroup/subscriptions","organizations_url":"https://api.github.com/users/martinisgroup/orgs","repos_url":"https://api.github.com/users/martinisgroup/repos","events_url":"https://api.github.com/users/martinisgroup/events{/privacy}","received_events_url":"https://api.github.com/users/martinisgroup/received_events","type":"Organization","site_admin":false},"repo":{"id":21184808,"name":"servers","full_name":"martinisgroup/servers","owner":{"login":"martinisgroup","id":5026004,"avatar_url":"https://avatars.githubusercontent.com/u/5026004?v=3","gravatar_id":"","url":"https://api.github.com/users/martinisgroup","html_url":"https://github.com/martinisgroup","followers_url":"https://api.github.com/users/martinisgroup/followers","following_url":"https://api.github.com/users/martinisgroup/following{/other_user}","gists_url":"https://api.github.com/users/martinisgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/martinisgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinisgroup/subscriptions","organizations_url":"https://api.github.com/users/martinisgroup/orgs","repos_url":"https://api.github.com/users/martinisgroup/repos","events_url":"https://api.github.com/users/martinisgroup/events{/privacy}","received_events_url":"https://api.github.com/users/martinisgroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/martinisgroup/servers","description":"","fork":false,"url":"https://api.github.com/repos/martinisgroup/servers","forks_url":"https://api.github.com/repos/martinisgroup/servers/forks","keys_url":"https://api.github.com/repos/martinisgroup/servers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/martinisgroup/servers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/martinisgroup/servers/teams","hooks_url":"https://api.github.com/repos/martinisgroup/servers/hooks","issue_events_url":"https://api.github.com/repos/martinisgroup/servers/issues/events{/number}","events_url":"https://api.github.com/repos/martinisgroup/servers/events","assignees_url":"https://api.github.com/repos/martinisgroup/servers/assignees{/user}","branches_url":"https://api.github.com/repos/martinisgroup/servers/branches{/branch}","tags_url":"https://api.github.com/repos/martinisgroup/servers/tags","blobs_url":"https://api.github.com/repos/martinisgroup/servers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/martinisgroup/servers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/martinisgroup/servers/git/refs{/sha}","trees_url":"https://api.github.com/repos/martinisgroup/servers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/martinisgroup/servers/statuses/{sha}","languages_url":"https://api.github.com/repos/martinisgroup/servers/languages","stargazers_url":"https://api.github.com/repos/martinisgroup/servers/stargazers","contributors_url":"https://api.github.com/repos/martinisgroup/servers/contributors","subscribers_url":"https://api.github.com/repos/martinisgroup/servers/subscribers","subscription_url":"https://api.github.com/repos/martinisgroup/servers/subscription","commits_url":"https://api.github.com/repos/martinisgroup/servers/commits{/sha}","git_commits_url":"https://api.github.com/repos/martinisgroup/servers/git/commits{/sha}","comments_url":"https://api.github.com/repos/martinisgroup/servers/comments{/number}","issue_comment_url":"https://api.github.com/repos/martinisgroup/servers/issues/comments{/number}","contents_url":"https://api.github.com/repos/martinisgroup/servers/contents/{+path}","compare_url":"https://api.github.com/repos/martinisgroup/servers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/martinisgroup/servers/merges","archive_url":"https://api.github.com/repos/martinisgroup/servers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/martinisgroup/servers/downloads","issues_url":"https://api.github.com/repos/martinisgroup/servers/issues{/number}","pulls_url":"https://api.github.com/repos/martinisgroup/servers/pulls{/number}","milestones_url":"https://api.github.com/repos/martinisgroup/servers/milestones{/number}","notifications_url":"https://api.github.com/repos/martinisgroup/servers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/martinisgroup/servers/labels{/name}","releases_url":"https://api.github.com/repos/martinisgroup/servers/releases{/id}","created_at":"2014-06-25T00:07:25Z","updated_at":"2015-04-29T23:09:55Z","pushed_at":"2015-04-29T23:09:59Z","git_url":"git://github.com/martinisgroup/servers.git","ssh_url":"git@github.com:martinisgroup/servers.git","clone_url":"https://github.com/martinisgroup/servers.git","svn_url":"https://github.com/martinisgroup/servers","homepage":null,"size":54210,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":57,"forks":1,"open_issues":57,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/martinisgroup/servers/pulls/123"},"html":{"href":"https://github.com/martinisgroup/servers/pull/123"},"issue":{"href":"https://api.github.com/repos/martinisgroup/servers/issues/123"},"comments":{"href":"https://api.github.com/repos/martinisgroup/servers/issues/123/comments"},"review_comments":{"href":"https://api.github.com/repos/martinisgroup/servers/pulls/123/comments"},"review_comment":{"href":"https://api.github.com/repos/martinisgroup/servers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/martinisgroup/servers/pulls/123/commits"},"statuses":{"href":"https://api.github.com/repos/martinisgroup/servers/statuses/006e98010e79d6696118f10a05bef9d6a7b2537a"}}}}