Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read_verilog_module does not support instances with unconnected ports, will generate a TypeError. #58

Open
darcy-wu opened this issue Aug 12, 2023 · 0 comments

Comments

@darcy-wu
Copy link

from __future__ import absolute_import
from __future__ import print_function
import sys
import os
import collections

# the next line can be removed after installation
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))

from veriloggen import *

test_v = '''\
module test ();

  wire CLK, RST;
  adder u_adder (
    .clk (CLK),
    .rst (RST),
    .A   (   )    # Please pay attention to this line, as it will trigger a TypeError error, refer below.
  );
endmodule
'''


def mkLed():
    m = from_verilog.read_verilog_module_str(test_v)

    return m['test']


if __name__ == '__main__':
    test = mkLed()
    verilog = test.to_verilog()
    print(verilog)


Traceback (most recent call last):
File "projects/user/work/python3/veriloggen-develop/examples/read_verilog_code/read_verilog_code.py", line 33, in
verilog = test.to_verilog()
File "projects/user/work/python3/veriloggen-develop/veriloggen/core/module.py", line 1019, in to_verilog
return to_verilog.write_verilog(obj, filename, for_verilator)
File "projects/user/work/python3/veriloggen-develop/veriloggen/verilog/to_verilog.py", line 20, in write_verilog
module_ast_list = [visitor.visit(mod) for mod in modules
File "projects/user/work/python3/veriloggen-develop/veriloggen/verilog/to_verilog.py", line 20, in
module_ast_list = [visitor.visit(mod) for mod in modules
File "projects/user/work/python3/veriloggen-develop/veriloggen/verilog/to_verilog.py", line 588, in visit
return self.visit_Module(node)
File "projects/user/work/python3/veriloggen-develop/veriloggen/verilog/to_verilog.py", line 611, in visit_Module
items = [self.visit(i) for i in node.items
File "projects/user/work/python3/veriloggen-develop/veriloggen/verilog/to_verilog.py", line 611, in
items = [self.visit(i) for i in node.items
File "projects/user/work/python3/veriloggen-develop/veriloggen/verilog/to_verilog.py", line 593, in visit
return visitor(node)
File "projects/user/work/python3/veriloggen-develop/veriloggen/verilog/to_verilog.py", line 770, in visit_Instance
portlist = [vast.PortArg(p, self.bind_visitor.visit(a))
File "projects/user/work/python3/veriloggen-develop/veriloggen/verilog/to_verilog.py", line 770, in
portlist = [vast.PortArg(p, self.bind_visitor.visit(a))
File "projects/user/work/python3/veriloggen-develop/veriloggen/verilog/to_verilog.py", line 54, in visit
return visitor(node)
File "projects/user/work/python3/veriloggen-develop/veriloggen/verilog/to_verilog.py", line 47, in generic_visit
raise TypeError("Type %s is not supported." % str(type(node)))
TypeError: Type <class 'NoneType'> is not supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant