{"action":"created","comment":{"url":"https://api.github.com/repos/ucb-bar/uncore/pulls/comments/53819101","id":53819101,"diff_hunk":"@@ -40,22 +40,57 @@ class SCRIO(map: SCRFileMap)(implicit p: Parameters) extends HtifBundle()(p) {\n   val waddr = UInt(OUTPUT, log2Up(nSCR))\n   val wdata = Bits(OUTPUT, scrDataBits)\n \n-  def attach(reg: Data, name: String): Data = {\n+  def attach(regs: Seq[Data]): Seq[Data] = {\n+    regs.zipWithIndex.map{ case(reg, i) => attach(reg) }\n+  }\n+\n+  def attach(regs: Seq[Data], name_base: String): Seq[Data] = {\n+    regs.zipWithIndex.map{ case(reg, i) => attach(reg, name_base + \"__\" + i) }\n+  }\n+\n+  def attach(data: Data): Data = attach(data,data.name,false,false)\n+  def attach(data: Data, name: String): Data = attach(data,name,false,false)\n+  def attach(data: Data, addReg: Boolean): Data = attach(data,data.name,false,false)\n+  def attach(data: Data, addReg: Boolean, readOnly: Boolean): Data = attach(data,data.name,readOnly,false)\n+  def attach(data: Data, name: String, addReg: Boolean): Data = attach(data,name,addReg,false)\n+\n+  def attach(data: Data, name: String, addReg: Boolean, readOnly: Boolean): Data = {\n     val addr = map.allocate(name)\n-    when (wen && (waddr === UInt(addr))) {\n-      reg := wdata\n+    val reg = if(addReg) { Reg(init = Bits(0, width=data.getWidth)) } else { data }\n+    if (!readOnly) {\n+      when (wen && (waddr === UInt(addr))) {\n+        reg := wdata(data.getWidth-1,0)\n+      }\n+    }\n+    require(data.getWidth <= scrDataBits, \"SCR Width must be <= %d for %s\".format(scrDataBits,name))\n+    if (data.getWidth < scrDataBits) {\n+      rdata(addr) := Cat(UInt(0, width=(scrDataBits-data.getWidth)),reg)\n+    } else {\n+      rdata(addr) := reg\n     }\n-    rdata(addr) := reg\n     reg\n   }\n \n+\n+  def attach(bundle: Bundle): Array[Data] = attach(bundle,\"\")","path":"src/main/scala/scr.scala","position":67,"original_position":67,"commit_id":"f8b1f0b885c564ecaa3dbd3a0d1b73a8f63d22a4","original_commit_id":"f8b1f0b885c564ecaa3dbd3a0d1b73a8f63d22a4","user":{"login":"colinschmidt","id":5083958,"avatar_url":"https://avatars.githubusercontent.com/u/5083958?v=3","gravatar_id":"","url":"https://api.github.com/users/colinschmidt","html_url":"https://github.com/colinschmidt","followers_url":"https://api.github.com/users/colinschmidt/followers","following_url":"https://api.github.com/users/colinschmidt/following{/other_user}","gists_url":"https://api.github.com/users/colinschmidt/gists{/gist_id}","starred_url":"https://api.github.com/users/colinschmidt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colinschmidt/subscriptions","organizations_url":"https://api.github.com/users/colinschmidt/orgs","repos_url":"https://api.github.com/users/colinschmidt/repos","events_url":"https://api.github.com/users/colinschmidt/events{/privacy}","received_events_url":"https://api.github.com/users/colinschmidt/received_events","type":"User","site_admin":false},"body":"Do we want to let people have no string prefix?","created_at":"2016-02-23T17:48:56Z","updated_at":"2016-02-23T17:48:56Z","html_url":"https://github.com/ucb-bar/uncore/pull/12#discussion_r53819101","pull_request_url":"https://api.github.com/repos/ucb-bar/uncore/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/ucb-bar/uncore/pulls/comments/53819101"},"html":{"href":"https://github.com/ucb-bar/uncore/pull/12#discussion_r53819101"},"pull_request":{"href":"https://api.github.com/repos/ucb-bar/uncore/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/ucb-bar/uncore/pulls/12","id":60285896,"html_url":"https://github.com/ucb-bar/uncore/pull/12","diff_url":"https://github.com/ucb-bar/uncore/pull/12.diff","patch_url":"https://github.com/ucb-bar/uncore/pull/12.patch","issue_url":"https://api.github.com/repos/ucb-bar/uncore/issues/12","number":12,"state":"open","locked":false,"title":"add utility overloads of SCRIO.attach, pass base address so that gene…","user":{"login":"jwright6323","id":463543,"avatar_url":"https://avatars.githubusercontent.com/u/463543?v=3","gravatar_id":"","url":"https://api.github.com/users/jwright6323","html_url":"https://github.com/jwright6323","followers_url":"https://api.github.com/users/jwright6323/followers","following_url":"https://api.github.com/users/jwright6323/following{/other_user}","gists_url":"https://api.github.com/users/jwright6323/gists{/gist_id}","starred_url":"https://api.github.com/users/jwright6323/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwright6323/subscriptions","organizations_url":"https://api.github.com/users/jwright6323/orgs","repos_url":"https://api.github.com/users/jwright6323/repos","events_url":"https://api.github.com/users/jwright6323/events{/privacy}","received_events_url":"https://api.github.com/users/jwright6323/received_events","type":"User","site_admin":false},"body":"This adds a baseAddress parameter to SCRFileMap and SCRFile so that the generated header contains the correct memory-mapped addresses (this could be fixed with an offset if there's only one SCRFile but breaks multiple SCRFiles).\r\n\r\nThis also adds a few convenience overloads of attach and now prints in hex instead of decimal.","created_at":"2016-02-23T04:21:46Z","updated_at":"2016-02-23T17:48:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1427953ba3dc9ee7e481c264808a6d6023e085b7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ucb-bar/uncore/pulls/12/commits","review_comments_url":"https://api.github.com/repos/ucb-bar/uncore/pulls/12/comments","review_comment_url":"https://api.github.com/repos/ucb-bar/uncore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ucb-bar/uncore/issues/12/comments","statuses_url":"https://api.github.com/repos/ucb-bar/uncore/statuses/f8b1f0b885c564ecaa3dbd3a0d1b73a8f63d22a4","head":{"label":"jwright6323:fixscrfile","ref":"fixscrfile","sha":"f8b1f0b885c564ecaa3dbd3a0d1b73a8f63d22a4","user":{"login":"jwright6323","id":463543,"avatar_url":"https://avatars.githubusercontent.com/u/463543?v=3","gravatar_id":"","url":"https://api.github.com/users/jwright6323","html_url":"https://github.com/jwright6323","followers_url":"https://api.github.com/users/jwright6323/followers","following_url":"https://api.github.com/users/jwright6323/following{/other_user}","gists_url":"https://api.github.com/users/jwright6323/gists{/gist_id}","starred_url":"https://api.github.com/users/jwright6323/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwright6323/subscriptions","organizations_url":"https://api.github.com/users/jwright6323/orgs","repos_url":"https://api.github.com/users/jwright6323/repos","events_url":"https://api.github.com/users/jwright6323/events{/privacy}","received_events_url":"https://api.github.com/users/jwright6323/received_events","type":"User","site_admin":false},"repo":{"id":46083547,"name":"uncore","full_name":"jwright6323/uncore","owner":{"login":"jwright6323","id":463543,"avatar_url":"https://avatars.githubusercontent.com/u/463543?v=3","gravatar_id":"","url":"https://api.github.com/users/jwright6323","html_url":"https://github.com/jwright6323","followers_url":"https://api.github.com/users/jwright6323/followers","following_url":"https://api.github.com/users/jwright6323/following{/other_user}","gists_url":"https://api.github.com/users/jwright6323/gists{/gist_id}","starred_url":"https://api.github.com/users/jwright6323/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwright6323/subscriptions","organizations_url":"https://api.github.com/users/jwright6323/orgs","repos_url":"https://api.github.com/users/jwright6323/repos","events_url":"https://api.github.com/users/jwright6323/events{/privacy}","received_events_url":"https://api.github.com/users/jwright6323/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jwright6323/uncore","description":"","fork":true,"url":"https://api.github.com/repos/jwright6323/uncore","forks_url":"https://api.github.com/repos/jwright6323/uncore/forks","keys_url":"https://api.github.com/repos/jwright6323/uncore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jwright6323/uncore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jwright6323/uncore/teams","hooks_url":"https://api.github.com/repos/jwright6323/uncore/hooks","issue_events_url":"https://api.github.com/repos/jwright6323/uncore/issues/events{/number}","events_url":"https://api.github.com/repos/jwright6323/uncore/events","assignees_url":"https://api.github.com/repos/jwright6323/uncore/assignees{/user}","branches_url":"https://api.github.com/repos/jwright6323/uncore/branches{/branch}","tags_url":"https://api.github.com/repos/jwright6323/uncore/tags","blobs_url":"https://api.github.com/repos/jwright6323/uncore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jwright6323/uncore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jwright6323/uncore/git/refs{/sha}","trees_url":"https://api.github.com/repos/jwright6323/uncore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jwright6323/uncore/statuses/{sha}","languages_url":"https://api.github.com/repos/jwright6323/uncore/languages","stargazers_url":"https://api.github.com/repos/jwright6323/uncore/stargazers","contributors_url":"https://api.github.com/repos/jwright6323/uncore/contributors","subscribers_url":"https://api.github.com/repos/jwright6323/uncore/subscribers","subscription_url":"https://api.github.com/repos/jwright6323/uncore/subscription","commits_url":"https://api.github.com/repos/jwright6323/uncore/commits{/sha}","git_commits_url":"https://api.github.com/repos/jwright6323/uncore/git/commits{/sha}","comments_url":"https://api.github.com/repos/jwright6323/uncore/comments{/number}","issue_comment_url":"https://api.github.com/repos/jwright6323/uncore/issues/comments{/number}","contents_url":"https://api.github.com/repos/jwright6323/uncore/contents/{+path}","compare_url":"https://api.github.com/repos/jwright6323/uncore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jwright6323/uncore/merges","archive_url":"https://api.github.com/repos/jwright6323/uncore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jwright6323/uncore/downloads","issues_url":"https://api.github.com/repos/jwright6323/uncore/issues{/number}","pulls_url":"https://api.github.com/repos/jwright6323/uncore/pulls{/number}","milestones_url":"https://api.github.com/repos/jwright6323/uncore/milestones{/number}","notifications_url":"https://api.github.com/repos/jwright6323/uncore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jwright6323/uncore/labels{/name}","releases_url":"https://api.github.com/repos/jwright6323/uncore/releases{/id}","deployments_url":"https://api.github.com/repos/jwright6323/uncore/deployments","created_at":"2015-11-12T22:00:30Z","updated_at":"2016-02-13T04:49:25Z","pushed_at":"2016-02-23T04:16:25Z","git_url":"git://github.com/jwright6323/uncore.git","ssh_url":"git@github.com:jwright6323/uncore.git","clone_url":"https://github.com/jwright6323/uncore.git","svn_url":"https://github.com/jwright6323/uncore","homepage":"","size":1748,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ucb-bar:master","ref":"master","sha":"7ff3c3e1938c81f2d92ab1695e9646a4fff95f79","user":{"login":"ucb-bar","id":998197,"avatar_url":"https://avatars.githubusercontent.com/u/998197?v=3","gravatar_id":"","url":"https://api.github.com/users/ucb-bar","html_url":"https://github.com/ucb-bar","followers_url":"https://api.github.com/users/ucb-bar/followers","following_url":"https://api.github.com/users/ucb-bar/following{/other_user}","gists_url":"https://api.github.com/users/ucb-bar/gists{/gist_id}","starred_url":"https://api.github.com/users/ucb-bar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ucb-bar/subscriptions","organizations_url":"https://api.github.com/users/ucb-bar/orgs","repos_url":"https://api.github.com/users/ucb-bar/repos","events_url":"https://api.github.com/users/ucb-bar/events{/privacy}","received_events_url":"https://api.github.com/users/ucb-bar/received_events","type":"Organization","site_admin":false},"repo":{"id":5974590,"name":"uncore","full_name":"ucb-bar/uncore","owner":{"login":"ucb-bar","id":998197,"avatar_url":"https://avatars.githubusercontent.com/u/998197?v=3","gravatar_id":"","url":"https://api.github.com/users/ucb-bar","html_url":"https://github.com/ucb-bar","followers_url":"https://api.github.com/users/ucb-bar/followers","following_url":"https://api.github.com/users/ucb-bar/following{/other_user}","gists_url":"https://api.github.com/users/ucb-bar/gists{/gist_id}","starred_url":"https://api.github.com/users/ucb-bar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ucb-bar/subscriptions","organizations_url":"https://api.github.com/users/ucb-bar/orgs","repos_url":"https://api.github.com/users/ucb-bar/repos","events_url":"https://api.github.com/users/ucb-bar/events{/privacy}","received_events_url":"https://api.github.com/users/ucb-bar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ucb-bar/uncore","description":"","fork":false,"url":"https://api.github.com/repos/ucb-bar/uncore","forks_url":"https://api.github.com/repos/ucb-bar/uncore/forks","keys_url":"https://api.github.com/repos/ucb-bar/uncore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ucb-bar/uncore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ucb-bar/uncore/teams","hooks_url":"https://api.github.com/repos/ucb-bar/uncore/hooks","issue_events_url":"https://api.github.com/repos/ucb-bar/uncore/issues/events{/number}","events_url":"https://api.github.com/repos/ucb-bar/uncore/events","assignees_url":"https://api.github.com/repos/ucb-bar/uncore/assignees{/user}","branches_url":"https://api.github.com/repos/ucb-bar/uncore/branches{/branch}","tags_url":"https://api.github.com/repos/ucb-bar/uncore/tags","blobs_url":"https://api.github.com/repos/ucb-bar/uncore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ucb-bar/uncore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ucb-bar/uncore/git/refs{/sha}","trees_url":"https://api.github.com/repos/ucb-bar/uncore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ucb-bar/uncore/statuses/{sha}","languages_url":"https://api.github.com/repos/ucb-bar/uncore/languages","stargazers_url":"https://api.github.com/repos/ucb-bar/uncore/stargazers","contributors_url":"https://api.github.com/repos/ucb-bar/uncore/contributors","subscribers_url":"https://api.github.com/repos/ucb-bar/uncore/subscribers","subscription_url":"https://api.github.com/repos/ucb-bar/uncore/subscription","commits_url":"https://api.github.com/repos/ucb-bar/uncore/commits{/sha}","git_commits_url":"https://api.github.com/repos/ucb-bar/uncore/git/commits{/sha}","comments_url":"https://api.github.com/repos/ucb-bar/uncore/comments{/number}","issue_comment_url":"https://api.github.com/repos/ucb-bar/uncore/issues/comments{/number}","contents_url":"https://api.github.com/repos/ucb-bar/uncore/contents/{+path}","compare_url":"https://api.github.com/repos/ucb-bar/uncore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ucb-bar/uncore/merges","archive_url":"https://api.github.com/repos/ucb-bar/uncore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ucb-bar/uncore/downloads","issues_url":"https://api.github.com/repos/ucb-bar/uncore/issues{/number}","pulls_url":"https://api.github.com/repos/ucb-bar/uncore/pulls{/number}","milestones_url":"https://api.github.com/repos/ucb-bar/uncore/milestones{/number}","notifications_url":"https://api.github.com/repos/ucb-bar/uncore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ucb-bar/uncore/labels{/name}","releases_url":"https://api.github.com/repos/ucb-bar/uncore/releases{/id}","deployments_url":"https://api.github.com/repos/ucb-bar/uncore/deployments","created_at":"2012-09-27T00:12:26Z","updated_at":"2016-02-04T01:45:24Z","pushed_at":"2016-02-23T04:21:46Z","git_url":"git://github.com/ucb-bar/uncore.git","ssh_url":"git@github.com:ucb-bar/uncore.git","clone_url":"https://github.com/ucb-bar/uncore.git","svn_url":"https://github.com/ucb-bar/uncore","homepage":"","size":1769,"stargazers_count":9,"watchers_count":9,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":3,"forks":5,"open_issues":3,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ucb-bar/uncore/pulls/12"},"html":{"href":"https://github.com/ucb-bar/uncore/pull/12"},"issue":{"href":"https://api.github.com/repos/ucb-bar/uncore/issues/12"},"comments":{"href":"https://api.github.com/repos/ucb-bar/uncore/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/ucb-bar/uncore/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/ucb-bar/uncore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ucb-bar/uncore/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/ucb-bar/uncore/statuses/f8b1f0b885c564ecaa3dbd3a0d1b73a8f63d22a4"}}}}