{"action":"created","issue":{"url":"https://api.github.com/repos/phanrahan/magma/issues/241","repository_url":"https://api.github.com/repos/phanrahan/magma","labels_url":"https://api.github.com/repos/phanrahan/magma/issues/241/labels{/name}","comments_url":"https://api.github.com/repos/phanrahan/magma/issues/241/comments","events_url":"https://api.github.com/repos/phanrahan/magma/issues/241/events","html_url":"https://github.com/phanrahan/magma/issues/241","id":348165540,"node_id":"MDU6SXNzdWUzNDgxNjU1NDA=","number":241,"title":"Add support for magma.Tuple to be a top level port","user":{"login":"rsetaluri","id":5567915,"node_id":"MDQ6VXNlcjU1Njc5MTU=","avatar_url":"https://avatars0.githubusercontent.com/u/5567915?v=4","gravatar_id":"","url":"https://api.github.com/users/rsetaluri","html_url":"https://github.com/rsetaluri","followers_url":"https://api.github.com/users/rsetaluri/followers","following_url":"https://api.github.com/users/rsetaluri/following{/other_user}","gists_url":"https://api.github.com/users/rsetaluri/gists{/gist_id}","starred_url":"https://api.github.com/users/rsetaluri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsetaluri/subscriptions","organizations_url":"https://api.github.com/users/rsetaluri/orgs","repos_url":"https://api.github.com/users/rsetaluri/repos","events_url":"https://api.github.com/users/rsetaluri/events{/privacy}","received_events_url":"https://api.github.com/users/rsetaluri/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-08-07T04:44:30Z","updated_at":"2018-08-28T05:40:40Z","closed_at":null,"author_association":"COLLABORATOR","body":"```python\r\nimport magma as m\r\n\r\n\r\nclass Foo(m.Circuit):\r\n    IO = [\"IFC\", m.Tuple(I=m.In(m.Bit), O=m.Out(m.Bit))]\r\n\r\n    @classmethod\r\n    def definition(io):\r\n        pass\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    m.compile(\"foo\", Foo, output=\"coreir\")\r\n    print (open(\"foo.json\").read())\r\n```\r\n\r\nThe above fails in the `compile()` call. The same holds for `output=verilog` but that's simply because `magma.Tuple` is simply not allowed in a verilog module declaration."},"comment":{"url":"https://api.github.com/repos/phanrahan/magma/issues/comments/416457827","html_url":"https://github.com/phanrahan/magma/issues/241#issuecomment-416457827","issue_url":"https://api.github.com/repos/phanrahan/magma/issues/241","id":416457827,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNjQ1NzgyNw==","user":{"login":"rsetaluri","id":5567915,"node_id":"MDQ6VXNlcjU1Njc5MTU=","avatar_url":"https://avatars0.githubusercontent.com/u/5567915?v=4","gravatar_id":"","url":"https://api.github.com/users/rsetaluri","html_url":"https://github.com/rsetaluri","followers_url":"https://api.github.com/users/rsetaluri/followers","following_url":"https://api.github.com/users/rsetaluri/following{/other_user}","gists_url":"https://api.github.com/users/rsetaluri/gists{/gist_id}","starred_url":"https://api.github.com/users/rsetaluri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsetaluri/subscriptions","organizations_url":"https://api.github.com/users/rsetaluri/orgs","repos_url":"https://api.github.com/users/rsetaluri/repos","events_url":"https://api.github.com/users/rsetaluri/events{/privacy}","received_events_url":"https://api.github.com/users/rsetaluri/received_events","type":"User","site_admin":false},"created_at":"2018-08-28T05:40:40Z","updated_at":"2018-08-28T05:40:40Z","author_association":"COLLABORATOR","body":"To provide some more context:\r\n\r\n```python\r\nimport magma as m\r\n\r\nfoo = m.DefineCircuit(\"Foo\", \"ifc\", m.Tuple(I=m.In(m.Bit), O=m.Out(m.Bit)))\r\nm.wire(foo.ifc.I, foo.ifc.O)\r\nm.EndCircuit()\r\n\r\nm.compile(\"foo\", foo, output=\"coreir\")\r\n```\r\n\r\nThis errors in compilation. I gave a shot at adding support for this but I noticed several things that needed to change (including that #260 was causing oddities in directionality in `interface` vs `IO`).\r\n\r\nThe expected CoreIR is:\r\n\r\n```json\r\n{\"top\":\"global.Foo\",\r\n\"namespaces\":{\r\n  \"global\":{\r\n    \"modules\":{\r\n      \"Foo\":{\r\n        \"type\":[\"Record\",[\r\n          [\"ifc\",[\"Record\",[[\"I\",\"BitIn\"],[\"O\",\"Bit\"]]]]\r\n        ]],\r\n        \"connections\":[\r\n          [\"self.ifc.I\", \"self.ifc.O\"]\r\n        ]\r\n      }\r\n    }\r\n  }\r\n}\r\n}\r\n```"}}
{"actor":{"display_login":"rsetaluri"}}