Class: Rhdl::NodeStatement
- Inherits:
-
Object
- Object
- Rhdl::NodeStatement
- Defined in:
- lib/rhdl/node_statement.rb
Instance Attribute Summary collapse
-
#bits ⇒ Object
readonly
Returns the value of attribute bits.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ptype ⇒ Object
readonly
Returns the value of attribute ptype.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #bitterm ⇒ Object
- #generate_terms ⇒ Object
-
#initialize(ptype, name, bits:, type:) ⇒ NodeStatement
constructor
A new instance of NodeStatement.
- #theptype ⇒ Object
Constructor Details
#initialize(ptype, name, bits:, type:) ⇒ NodeStatement
Returns a new instance of NodeStatement.
5 6 7 8 9 10 |
# File 'lib/rhdl/node_statement.rb', line 5 def initialize(ptype ,name, bits:, type:) @ptype = ptype @name = name @bits = bits @type = type end |
Instance Attribute Details
#bits ⇒ Object (readonly)
Returns the value of attribute bits.
3 4 5 |
# File 'lib/rhdl/node_statement.rb', line 3 def bits @bits end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/rhdl/node_statement.rb', line 3 def name @name end |
#ptype ⇒ Object (readonly)
Returns the value of attribute ptype.
3 4 5 |
# File 'lib/rhdl/node_statement.rb', line 3 def ptype @ptype end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/rhdl/node_statement.rb', line 3 def type @type end |
Instance Method Details
#bitterm ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/rhdl/node_statement.rb', line 29 def bitterm if bits == 1 nil else "[#{bits-1}:0]" end end |
#generate_terms ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/rhdl/node_statement.rb', line 20 def generate_terms { keyword: theptype, bitterm: bitterm, name: name } end |
#theptype ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/rhdl/node_statement.rb', line 12 def theptype if @ptype == 'input' "input wire" else "output reg" end end |