{"action":"created","issue":{"url":"https://api.github.com/repos/cornell-brg/pymtl/issues/150","repository_url":"https://api.github.com/repos/cornell-brg/pymtl","labels_url":"https://api.github.com/repos/cornell-brg/pymtl/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/cornell-brg/pymtl/issues/150/comments","events_url":"https://api.github.com/repos/cornell-brg/pymtl/issues/150/events","html_url":"https://github.com/cornell-brg/pymtl/issues/150","id":157927281,"number":150,"title":"Cannot wrap a VerilogModel into a pymtl model for simulation","user":{"login":"jsn1993","id":2065153,"avatar_url":"https://avatars.githubusercontent.com/u/2065153?v=3","gravatar_id":"","url":"https://api.github.com/users/jsn1993","html_url":"https://github.com/jsn1993","followers_url":"https://api.github.com/users/jsn1993/followers","following_url":"https://api.github.com/users/jsn1993/following{/other_user}","gists_url":"https://api.github.com/users/jsn1993/gists{/gist_id}","starred_url":"https://api.github.com/users/jsn1993/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsn1993/subscriptions","organizations_url":"https://api.github.com/users/jsn1993/orgs","repos_url":"https://api.github.com/users/jsn1993/repos","events_url":"https://api.github.com/users/jsn1993/events{/privacy}","received_events_url":"https://api.github.com/users/jsn1993/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cornell-brg/pymtl/labels/verilog_integration","name":"verilog_integration","color":"207de5"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-01T14:52:07Z","updated_at":"2016-06-01T15:53:50Z","closed_at":"2016-06-01T15:34:24Z","body":"For example, I want to import module VvaddXcel from VvaddXcel.v, and then use a PyMTL model VvaddXcelHLS that instantiates s.vvadd = VvaddXcel(), for simulation.\r\n\r\nIt turns out that I cannot define a combinational block that communicates with s.vvadd. These are the things I put in the combinational block\r\n\r\n    @s.combinational\r\n\r\n    def comb_logic( s )\r\n\r\n      s.vvadd.xcelreq.msg.value = ~s.xcelreq.msg\r\n\r\n      s.vvadd.xcelreq.val.value = not s.xcelreq.val\r\n\r\n      s.vvadd.xcelreq.rdy.value = s.xcelreq.rdy\r\n\r\n\r\nThe error:\r\n\r\n    .../pymtl/pymtl/tools/ast_helpers.py:115: in get_closure_dict\r\n        closure_objects = [c.cell_contents for c in fn.func_closure]\r\n    E   TypeError: 'NoneType' object is not iterable\r\n\r\nI debugged for some time, and found that the closure dict somehow stores the modules/ports that one decorated combinational block/posedge_clk block communicates with. (Correct me if I'm wrong here).\r\n\r\nWhen I remove the combinational block in VvaddXcelHLS, pymtl doesn't throw error message. But obviously I need to do something in the combinational block for correctness.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/cornell-brg/pymtl/issues/comments/223038170","html_url":"https://github.com/cornell-brg/pymtl/issues/150#issuecomment-223038170","issue_url":"https://api.github.com/repos/cornell-brg/pymtl/issues/150","id":223038170,"user":{"login":"hawajkm","id":2364962,"avatar_url":"https://avatars.githubusercontent.com/u/2364962?v=3","gravatar_id":"","url":"https://api.github.com/users/hawajkm","html_url":"https://github.com/hawajkm","followers_url":"https://api.github.com/users/hawajkm/followers","following_url":"https://api.github.com/users/hawajkm/following{/other_user}","gists_url":"https://api.github.com/users/hawajkm/gists{/gist_id}","starred_url":"https://api.github.com/users/hawajkm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawajkm/subscriptions","organizations_url":"https://api.github.com/users/hawajkm/orgs","repos_url":"https://api.github.com/users/hawajkm/repos","events_url":"https://api.github.com/users/hawajkm/events{/privacy}","received_events_url":"https://api.github.com/users/hawajkm/received_events","type":"User","site_admin":false},"created_at":"2016-06-01T15:53:50Z","updated_at":"2016-06-01T15:53:50Z","body":"This what I can give, then:\r\n\r\nTry connecting some stuff directly:\r\n`s.connect( s.vvadd.xcelreq.msg, s.xcelreq.msg)\r\ns.connect( s.vvadd.xcelreq.rdy, s.xcelreq.rdy)`\r\n\r\nFor the rest, where you need some logic, try creating a wire:\r\n`s.xcelreq_notval = Wire(1)\r\ns.connect( s.xcelreq_notval, s.vvadd.xcelreq.val )\r\n\r\ndef comb_logic( s )\r\n  s.xcelreq_notval = ~s.xcelreq.val`\r\n\r\nP.S.\r\nI am not sure whether you actually wanted to invert the complete message or that was a typo."}}
{"actor":{"display_login":"hawajkm"}}