Class: VhdlDoctest::Port

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, direction, type) ⇒ Port

Returns a new instance of Port.



5
6
7
# File 'lib/vhdl_doctest/port.rb', line 5

def initialize(name, direction, type)
  @name, @direction, @type = name, direction, type
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/vhdl_doctest/port.rb', line 3

def name
  @name
end

Instance Method Details

#assignment(value) ⇒ Object



21
22
23
# File 'lib/vhdl_doctest/port.rb', line 21

def assignment(value)
  "#@name <= #{@type.format(value)};"
end

#equation(value) ⇒ Object



25
26
27
# File 'lib/vhdl_doctest/port.rb', line 25

def equation(value)
  "#@name = #{@type.format(value)}"
end

#in?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/vhdl_doctest/port.rb', line 29

def in?
  @direction == :in
end

#mappingObject



17
18
19
# File 'lib/vhdl_doctest/port.rb', line 17

def mapping
  "#@name => #@name"
end

#port_definitionObject



9
10
11
# File 'lib/vhdl_doctest/port.rb', line 9

def port_definition
  "#@name : #@direction #{@type.to_vhdl}"
end

#signal_definitionObject



13
14
15
# File 'lib/vhdl_doctest/port.rb', line 13

def signal_definition
  "signal #@name : #{@type.to_vhdl};"
end