Class: VhdlDoctest::Port
- Inherits:
-
Object
- Object
- VhdlDoctest::Port
- Defined in:
- lib/vhdl_doctest/port.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #assignment(value) ⇒ Object
- #equation(value) ⇒ Object
- #in? ⇒ Boolean
-
#initialize(name, direction, type) ⇒ Port
constructor
A new instance of Port.
- #mapping ⇒ Object
- #port_definition ⇒ Object
- #signal_definition ⇒ Object
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
#name ⇒ Object (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
29 30 31 |
# File 'lib/vhdl_doctest/port.rb', line 29 def in? @direction == :in end |
#mapping ⇒ Object
17 18 19 |
# File 'lib/vhdl_doctest/port.rb', line 17 def mapping "#@name => #@name" end |
#port_definition ⇒ Object
9 10 11 |
# File 'lib/vhdl_doctest/port.rb', line 9 def port_definition "#@name : #@direction #{@type.to_vhdl}" end |
#signal_definition ⇒ Object
13 14 15 |
# File 'lib/vhdl_doctest/port.rb', line 13 def signal_definition "signal #@name : #{@type.to_vhdl};" end |