{"action":"created","issue":{"url":"https://api.github.com/repos/cliffordwolf/yosys/issues/395","repository_url":"https://api.github.com/repos/cliffordwolf/yosys","labels_url":"https://api.github.com/repos/cliffordwolf/yosys/issues/395/labels{/name}","comments_url":"https://api.github.com/repos/cliffordwolf/yosys/issues/395/comments","events_url":"https://api.github.com/repos/cliffordwolf/yosys/issues/395/events","html_url":"https://github.com/cliffordwolf/yosys/issues/395","id":253400057,"number":395,"title":"Feature request: optimize counters with constant high order bits","user":{"login":"azonenberg","id":998036,"avatar_url":"https://avatars1.githubusercontent.com/u/998036?v=4","gravatar_id":"","url":"https://api.github.com/users/azonenberg","html_url":"https://github.com/azonenberg","followers_url":"https://api.github.com/users/azonenberg/followers","following_url":"https://api.github.com/users/azonenberg/following{/other_user}","gists_url":"https://api.github.com/users/azonenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/azonenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azonenberg/subscriptions","organizations_url":"https://api.github.com/users/azonenberg/orgs","repos_url":"https://api.github.com/users/azonenberg/repos","events_url":"https://api.github.com/users/azonenberg/events{/privacy}","received_events_url":"https://api.github.com/users/azonenberg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"cliffordwolf","id":619764,"avatar_url":"https://avatars3.githubusercontent.com/u/619764?v=4","gravatar_id":"","url":"https://api.github.com/users/cliffordwolf","html_url":"https://github.com/cliffordwolf","followers_url":"https://api.github.com/users/cliffordwolf/followers","following_url":"https://api.github.com/users/cliffordwolf/following{/other_user}","gists_url":"https://api.github.com/users/cliffordwolf/gists{/gist_id}","starred_url":"https://api.github.com/users/cliffordwolf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cliffordwolf/subscriptions","organizations_url":"https://api.github.com/users/cliffordwolf/orgs","repos_url":"https://api.github.com/users/cliffordwolf/repos","events_url":"https://api.github.com/users/cliffordwolf/events{/privacy}","received_events_url":"https://api.github.com/users/cliffordwolf/received_events","type":"User","site_admin":false},"assignees":[{"login":"cliffordwolf","id":619764,"avatar_url":"https://avatars3.githubusercontent.com/u/619764?v=4","gravatar_id":"","url":"https://api.github.com/users/cliffordwolf","html_url":"https://github.com/cliffordwolf","followers_url":"https://api.github.com/users/cliffordwolf/followers","following_url":"https://api.github.com/users/cliffordwolf/following{/other_user}","gists_url":"https://api.github.com/users/cliffordwolf/gists{/gist_id}","starred_url":"https://api.github.com/users/cliffordwolf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cliffordwolf/subscriptions","organizations_url":"https://api.github.com/users/cliffordwolf/orgs","repos_url":"https://api.github.com/users/cliffordwolf/repos","events_url":"https://api.github.com/users/cliffordwolf/events{/privacy}","received_events_url":"https://api.github.com/users/cliffordwolf/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2017-08-28T17:34:29Z","updated_at":"2017-09-01T12:40:53Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Consider the following code:\r\n\r\n    reg[7:0] dout = 0;\r\n    always @(posedge clk) begin\r\n        dout <= dout + 1'h1;\r\n        if(dout == 15)\r\n            dout <= 0;\r\n    end\r\n\r\nSince \"dout\" is initialized to zero, and goes back to zero when it hits 15, the high 4 bits can never be nonzero and should be optimized out.\r\n\r\nI'll be implementing a new optimization pass for this. It'll be called \"opt_counters\" and should run during the coarse phase of synthesis."},"comment":{"url":"https://api.github.com/repos/cliffordwolf/yosys/issues/comments/326569903","html_url":"https://github.com/cliffordwolf/yosys/issues/395#issuecomment-326569903","issue_url":"https://api.github.com/repos/cliffordwolf/yosys/issues/395","id":326569903,"user":{"login":"cliffordwolf","id":619764,"avatar_url":"https://avatars3.githubusercontent.com/u/619764?v=4","gravatar_id":"","url":"https://api.github.com/users/cliffordwolf","html_url":"https://github.com/cliffordwolf","followers_url":"https://api.github.com/users/cliffordwolf/followers","following_url":"https://api.github.com/users/cliffordwolf/following{/other_user}","gists_url":"https://api.github.com/users/cliffordwolf/gists{/gist_id}","starred_url":"https://api.github.com/users/cliffordwolf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cliffordwolf/subscriptions","organizations_url":"https://api.github.com/users/cliffordwolf/orgs","repos_url":"https://api.github.com/users/cliffordwolf/repos","events_url":"https://api.github.com/users/cliffordwolf/events{/privacy}","received_events_url":"https://api.github.com/users/cliffordwolf/received_events","type":"User","site_admin":false},"created_at":"2017-09-01T12:40:53Z","updated_at":"2017-09-01T12:40:53Z","author_association":"OWNER","body":"Okay. Thanks for the explanation @azonenberg."}}
{"actor":{"display_login":"cliffordwolf"}}