Class: VerilogParser::Module
- Inherits:
-
Object
- Object
- VerilogParser::Module
- Defined in:
- lib/ruby-vpi/verilog_parser.rb
Defined Under Namespace
Classes: Port
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#clock_port ⇒ Object
readonly
Returns the value of attribute clock_port.
-
#decl ⇒ Object
readonly
Returns the value of attribute decl.
-
#input_ports ⇒ Object
readonly
Returns the value of attribute input_ports.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#output_ports ⇒ Object
readonly
Returns the value of attribute output_ports.
-
#ports ⇒ Object
readonly
Returns the value of attribute ports.
-
#reset_port ⇒ Object
readonly
Returns the value of attribute reset_port.
Instance Method Summary collapse
-
#initialize(aDecl, aBody) ⇒ Module
constructor
A new instance of Module.
Constructor Details
#initialize(aDecl, aBody) ⇒ Module
Returns a new instance of Module.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ruby-vpi/verilog_parser.rb', line 29 def initialize aDecl, aBody @decl = aDecl.strip @body = aBody @decl =~ %r{module\s+(\w+)\s*(?:\#\(.*?\))?\s*(?:\((.*?)\))?\s*;}m @name, portDecls = $1, $2.to_s @ports = portDecls.split(',').map {|decl| Port.new decl, self} @input_ports = @ports.select {|p| p.input?} @output_ports = @ports.select {|p| p.output?} @clock_port = @ports.find {|p| p.name =~ /clock|clo?c?k/i} @reset_port = @ports.find {|p| p.name =~ /reset|re?se?t/i} end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
25 26 27 |
# File 'lib/ruby-vpi/verilog_parser.rb', line 25 def body @body end |
#clock_port ⇒ Object (readonly)
Returns the value of attribute clock_port.
25 26 27 |
# File 'lib/ruby-vpi/verilog_parser.rb', line 25 def clock_port @clock_port end |
#decl ⇒ Object (readonly)
Returns the value of attribute decl.
25 26 27 |
# File 'lib/ruby-vpi/verilog_parser.rb', line 25 def decl @decl end |
#input_ports ⇒ Object (readonly)
Returns the value of attribute input_ports.
25 26 27 |
# File 'lib/ruby-vpi/verilog_parser.rb', line 25 def input_ports @input_ports end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
25 26 27 |
# File 'lib/ruby-vpi/verilog_parser.rb', line 25 def name @name end |
#output_ports ⇒ Object (readonly)
Returns the value of attribute output_ports.
25 26 27 |
# File 'lib/ruby-vpi/verilog_parser.rb', line 25 def output_ports @output_ports end |
#ports ⇒ Object (readonly)
Returns the value of attribute ports.
25 26 27 |
# File 'lib/ruby-vpi/verilog_parser.rb', line 25 def ports @ports end |
#reset_port ⇒ Object (readonly)
Returns the value of attribute reset_port.
25 26 27 |
# File 'lib/ruby-vpi/verilog_parser.rb', line 25 def reset_port @reset_port end |