{"action":"created","issue":{"url":"https://api.github.com/repos/agra-uni-bremen/crave/issues/5","repository_url":"https://api.github.com/repos/agra-uni-bremen/crave","labels_url":"https://api.github.com/repos/agra-uni-bremen/crave/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/agra-uni-bremen/crave/issues/5/comments","events_url":"https://api.github.com/repos/agra-uni-bremen/crave/issues/5/events","html_url":"https://github.com/agra-uni-bremen/crave/issues/5","id":331698845,"node_id":"MDU6SXNzdWUzMzE2OTg4NDU=","number":5,"title":"(In)equality operators don't always behave symmetrical","user":{"login":"AnthonyVH","id":2694786,"node_id":"MDQ6VXNlcjI2OTQ3ODY=","avatar_url":"https://avatars3.githubusercontent.com/u/2694786?v=4","gravatar_id":"","url":"https://api.github.com/users/AnthonyVH","html_url":"https://github.com/AnthonyVH","followers_url":"https://api.github.com/users/AnthonyVH/followers","following_url":"https://api.github.com/users/AnthonyVH/following{/other_user}","gists_url":"https://api.github.com/users/AnthonyVH/gists{/gist_id}","starred_url":"https://api.github.com/users/AnthonyVH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AnthonyVH/subscriptions","organizations_url":"https://api.github.com/users/AnthonyVH/orgs","repos_url":"https://api.github.com/users/AnthonyVH/repos","events_url":"https://api.github.com/users/AnthonyVH/events{/privacy}","received_events_url":"https://api.github.com/users/AnthonyVH/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-06-12T18:17:52Z","updated_at":"2018-06-14T08:33:56Z","closed_at":null,"author_association":"NONE","body":"The (in)equality operators defined for `crave::randv<sc_dt::sc_bv<W>>` behave asymmetrical once W > 64. Try for example the following code:\r\n\r\n```cpp\r\n#include <crave/ConstrainedRandom.hpp>\r\n#include <crave/SystemC.hpp>\r\n\r\n#include <systemc>\r\n\r\n#include <iomanip>\r\n#include <iostream>\r\n\r\nint sc_main (int argc, char ** argv) {\r\n  std::uint64_t const c_IntOnes = ~(0ull);\r\n  sc_dt::sc_bv<128> const c_BvOnes = ~sc_dt::sc_bv<128>(0);\r\n\r\n  auto largeBv = crave::randv<sc_dt::sc_bv<128>>(nullptr);\r\n  largeBv = c_BvOnes;\r\n\r\n  std::cout << \"c_IntOnes = 0x\" << std::hex << c_IntOnes << std::dec << \"\\n\";\r\n  std::cout << \"largeBv   = 0b\" << largeBv << \"\\n\";\r\n  std::cout << \"\\n\";\r\n\r\n  std::cout << std::boolalpha;\r\n  std::cout << \"(largeBv   == c_IntOnes) = \" << static_cast<bool>(largeBv == c_IntOnes) << \"\\n\";\r\n  std::cout << \"(c_IntOnes == largeBv)   = \" << static_cast<bool>(c_IntOnes == largeBv) << \"\\n\";\r\n  std::cout << \"\\n\";\r\n\r\n  return 0;\r\n}\r\n```\r\nThe cause seems to be the promotion of `c_IntOnes` to `sc_dt::int64` when calling `operator== (sc_dt::int64 const, randv<Typename<N>> const &)`. I tried my hand at fixing the `RANDV_SCDT_BINARY_OPERATOR` macro, but so far haven't been able to come up with the proper SFINAE to make it work/compile in all cases.\r\n\r\nAlso note that these (in)equality operators all return `sc_dt::int64` instead of `bool`."},"comment":{"url":"https://api.github.com/repos/agra-uni-bremen/crave/issues/comments/397216201","html_url":"https://github.com/agra-uni-bremen/crave/issues/5#issuecomment-397216201","issue_url":"https://api.github.com/repos/agra-uni-bremen/crave/issues/5","id":397216201,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzIxNjIwMQ==","user":{"login":"AnthonyVH","id":2694786,"node_id":"MDQ6VXNlcjI2OTQ3ODY=","avatar_url":"https://avatars3.githubusercontent.com/u/2694786?v=4","gravatar_id":"","url":"https://api.github.com/users/AnthonyVH","html_url":"https://github.com/AnthonyVH","followers_url":"https://api.github.com/users/AnthonyVH/followers","following_url":"https://api.github.com/users/AnthonyVH/following{/other_user}","gists_url":"https://api.github.com/users/AnthonyVH/gists{/gist_id}","starred_url":"https://api.github.com/users/AnthonyVH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AnthonyVH/subscriptions","organizations_url":"https://api.github.com/users/AnthonyVH/orgs","repos_url":"https://api.github.com/users/AnthonyVH/repos","events_url":"https://api.github.com/users/AnthonyVH/events{/privacy}","received_events_url":"https://api.github.com/users/AnthonyVH/received_events","type":"User","site_admin":false},"created_at":"2018-06-14T08:33:56Z","updated_at":"2018-06-14T08:33:56Z","author_association":"NONE","body":"Honestly, I haven't tried yet. I'll try to give it a go soon. I've never been able to get any C++11 STL additions to compile in QuestaSim 10.5b/10.6 though."}}
{"actor":{"display_login":"AnthonyVH"}}