Class: VerilogParser::Module::Port

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-vpi/verilog_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aDecl, aModule) ⇒ Port

Returns a new instance of Port.



47
48
49
50
51
52
53
54
# File 'lib/ruby-vpi/verilog_parser.rb', line 47

def initialize aDecl, aModule
  @decl = aDecl
  @name = aDecl.scan(/\S+/).last

  parser = /\b(input|output|inout)\b[^;]*\b#{@name}\b/m
  aDecl =~ parser || aModule.body =~ parser
  @type = $1
end

Instance Attribute Details

#declObject (readonly)

Returns the value of attribute decl.



45
46
47
# File 'lib/ruby-vpi/verilog_parser.rb', line 45

def decl
  @decl
end

#nameObject (readonly)

Returns the value of attribute name.



45
46
47
# File 'lib/ruby-vpi/verilog_parser.rb', line 45

def name
  @name
end

Instance Method Details

#input?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/ruby-vpi/verilog_parser.rb', line 56

def input?
  @type != 'output'
end

#output?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/ruby-vpi/verilog_parser.rb', line 60

def output?
  @type != 'input'
end