Class: Rhdl::ComponentDsl
- Inherits:
-
Object
- Object
- Rhdl::ComponentDsl
- Defined in:
- lib/rhdl/component_dsl.rb
Instance Attribute Summary collapse
-
#comb_block_dsl ⇒ Object
readonly
Returns the value of attribute comb_block_dsl.
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
-
#outputs ⇒ Object
readonly
Returns the value of attribute outputs.
-
#wires ⇒ Object
readonly
Returns the value of attribute wires.
Instance Method Summary collapse
- #comb(&block) ⇒ Object
-
#initialize(topdsl) ⇒ ComponentDsl
constructor
A new instance of ComponentDsl.
- #input(name, bits: 1, type: "uint") ⇒ Object
- #output(name, bits: 1, type: "uint") ⇒ Object
- #wire(name, bits: 1, type: "uint") ⇒ Object
Constructor Details
#initialize(topdsl) ⇒ ComponentDsl
Returns a new instance of ComponentDsl.
5 6 7 8 9 10 11 |
# File 'lib/rhdl/component_dsl.rb', line 5 def initialize(topdsl) @topdsl = topdsl @inputs = {} @outputs = {} @wires = {} @comb_block_dsl = nil end |
Instance Attribute Details
#comb_block_dsl ⇒ Object (readonly)
Returns the value of attribute comb_block_dsl.
3 4 5 |
# File 'lib/rhdl/component_dsl.rb', line 3 def comb_block_dsl @comb_block_dsl end |
#inputs ⇒ Object (readonly)
Returns the value of attribute inputs.
3 4 5 |
# File 'lib/rhdl/component_dsl.rb', line 3 def inputs @inputs end |
#outputs ⇒ Object (readonly)
Returns the value of attribute outputs.
3 4 5 |
# File 'lib/rhdl/component_dsl.rb', line 3 def outputs @outputs end |
#wires ⇒ Object (readonly)
Returns the value of attribute wires.
3 4 5 |
# File 'lib/rhdl/component_dsl.rb', line 3 def wires @wires end |
Instance Method Details
#comb(&block) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/rhdl/component_dsl.rb', line 25 def comb(&block) raise "Combinational block already defined" if !@comb_block_dsl.nil? @comb_block_dsl = BlockDsl.new @comb_block_dsl.instance_eval(&block) end |
#input(name, bits: 1, type: "uint") ⇒ Object
13 14 15 |
# File 'lib/rhdl/component_dsl.rb', line 13 def input(name, bits: 1, type: "uint") @inputs[name] = NodeStatement.new('input', name, bits: bits, type: type) end |
#output(name, bits: 1, type: "uint") ⇒ Object
17 18 19 |
# File 'lib/rhdl/component_dsl.rb', line 17 def output(name, bits: 1, type: "uint") @outputs[name] = NodeStatement.new('output', name, bits: bits, type: type) end |
#wire(name, bits: 1, type: "uint") ⇒ Object
21 22 23 |
# File 'lib/rhdl/component_dsl.rb', line 21 def wire(name, bits: 1, type: "uint") @wires[name] = NodeStatement.new('wire', name, bits: bits, type: type) end |