Class: VHDL_Parser::Port

Inherits:
Object
  • Object
show all
Defined in:
lib/vhdl_parser/port.rb

Overview

Defines an input or output on the Entity

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePort

Returns a new instance of Port.



38
39
40
41
42
# File 'lib/vhdl_parser/port.rb', line 38

def initialize
  @left = 0
  @right = 0
  @size_dir = "downto"
end

Instance Attribute Details

#commentString

Any inline comment on the Port

Returns:



15
16
17
# File 'lib/vhdl_parser/port.rb', line 15

def comment
  @comment
end

#directionString

The direction of the port. I.e. “in”, “out”, “inout”

Returns:



11
12
13
# File 'lib/vhdl_parser/port.rb', line 11

def direction
  @direction
end

#leftString

Left part of the size, e.g. “7”

Returns:



28
29
30
# File 'lib/vhdl_parser/port.rb', line 28

def left
  @left
end

#nameString

The name of the Port

Returns:



6
7
8
# File 'lib/vhdl_parser/port.rb', line 6

def name
  @name
end

#rightString

Right part of the size, e.g. “0”

Returns:



32
33
34
# File 'lib/vhdl_parser/port.rb', line 32

def right
  @right
end

#sizeString

Returns a string based on the left, right, and size_dir attributes.

Returns:

  • (String)

    The size formatted as a String.



24
25
26
# File 'lib/vhdl_parser/port.rb', line 24

def size
  @size
end

#size_dirString

Left part of the size, e.g. “downto”

Returns:



36
37
38
# File 'lib/vhdl_parser/port.rb', line 36

def size_dir
  @size_dir
end

#typeString

The type of the Port

Returns:



19
20
21
# File 'lib/vhdl_parser/port.rb', line 19

def type
  @type
end

Instance Method Details

#to_sString

Returns:



45
46
47
48
49
50
51
# File 'lib/vhdl_parser/port.rb', line 45

def to_s
  name.ljust(15) + "\t" +
  direction + "\t" + 
  type + " " + 
  size + "\t" + 
  comment + "\n"
end