{"action":"created","issue":{"url":"https://api.github.com/repos/jandecaluwe/myhdl/issues/75","labels_url":"https://api.github.com/repos/jandecaluwe/myhdl/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/jandecaluwe/myhdl/issues/75/comments","events_url":"https://api.github.com/repos/jandecaluwe/myhdl/issues/75/events","html_url":"https://github.com/jandecaluwe/myhdl/issues/75","id":79103929,"number":75,"title":"Define a numeric default value for tristate signals","user":{"login":"jmgc","id":1560616,"avatar_url":"https://avatars.githubusercontent.com/u/1560616?v=3","gravatar_id":"","url":"https://api.github.com/users/jmgc","html_url":"https://github.com/jmgc","followers_url":"https://api.github.com/users/jmgc/followers","following_url":"https://api.github.com/users/jmgc/following{/other_user}","gists_url":"https://api.github.com/users/jmgc/gists{/gist_id}","starred_url":"https://api.github.com/users/jmgc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmgc/subscriptions","organizations_url":"https://api.github.com/users/jmgc/orgs","repos_url":"https://api.github.com/users/jmgc/repos","events_url":"https://api.github.com/users/jmgc/events{/privacy}","received_events_url":"https://api.github.com/users/jmgc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-21T18:07:44Z","updated_at":"2015-05-25T08:45:01Z","closed_at":null,"body":"When converting a tristate signal to an hdl, if it's numeric value is requested, for example using int, an error is generated as the default value is None. To avoid this problem, a metavalue warning could be generated, and a default value of 0 could be provided. This can be done in the _Signal class modifying the __int__(), __long__(), __float__() and __float__() functions to take care of this case."},"comment":{"url":"https://api.github.com/repos/jandecaluwe/myhdl/issues/comments/105170200","html_url":"https://github.com/jandecaluwe/myhdl/issues/75#issuecomment-105170200","issue_url":"https://api.github.com/repos/jandecaluwe/myhdl/issues/75","id":105170200,"user":{"login":"jmgc","id":1560616,"avatar_url":"https://avatars.githubusercontent.com/u/1560616?v=3","gravatar_id":"","url":"https://api.github.com/users/jmgc","html_url":"https://github.com/jmgc","followers_url":"https://api.github.com/users/jmgc/followers","following_url":"https://api.github.com/users/jmgc/following{/other_user}","gists_url":"https://api.github.com/users/jmgc/gists{/gist_id}","starred_url":"https://api.github.com/users/jmgc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmgc/subscriptions","organizations_url":"https://api.github.com/users/jmgc/orgs","repos_url":"https://api.github.com/users/jmgc/repos","events_url":"https://api.github.com/users/jmgc/events{/privacy}","received_events_url":"https://api.github.com/users/jmgc/received_events","type":"User","site_admin":false},"created_at":"2015-05-25T08:45:01Z","updated_at":"2015-05-25T08:45:01Z","body":"The reason is that if you try to use a conversion from an intbv tristate signal to int, as the default value is None, the result is that it cannot be converted, nor verified (at least with toVHDL) because it detects a conversion to int from a None value.\n\nOn the other hand, this solution gives a warning indicating that the value is unknown, but it defaults to 0, so the conversion can be done.\n\nAs a matter of fact, this behavior is equivalent to the one in vhdl numeric package.\n\n> El 25/5/2015, a las 10:34, jandecaluwe <notifications@github.com> escribió:\n> \n> Using an undefined value in a numeric operation is an error. I don't see what's the benefit of masking that.\n> \n> —\n> Reply to this email directly or view it on GitHub <https://github.com/jandecaluwe/myhdl/issues/75#issuecomment-105167835>.\n> \n\n"}}