Class: HDL::SchemaChip
Defined Under Namespace
Classes: Evaluator
Instance Attribute Summary
Attributes inherited from Chip
#inputs, #name, #outputs, #path
Instance Method Summary collapse
- #components ⇒ Object
- #evaluate(pins = {}) ⇒ Object
-
#initialize(name, path, data) ⇒ SchemaChip
constructor
A new instance of SchemaChip.
- #internal ⇒ Object
- #primitive? ⇒ Boolean
Methods inherited from Chip
#dependees, #dependents, #inspect, #primitives
Constructor Details
#initialize(name, path, data) ⇒ SchemaChip
Returns a new instance of SchemaChip.
3 4 5 6 7 8 9 |
# File 'lib/hdl/chip/schema_chip.rb', line 3 def initialize(name, path, data) super @schema = data[:schema] create_dependencies load_dependencies(:dependents) evaluate_some_expression end |
Instance Method Details
#components ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/hdl/chip/schema_chip.rb', line 15 def components chips = component_names.map do |name| HDL::Loader.load(name) end freq = frequencies(chips) hashes = [freq] + chips.map(&:components) hashes.inject({}) do |acc, hash| acc.merge(hash) { |_, a, b| a + b } end end |
#evaluate(pins = {}) ⇒ Object
32 33 34 35 |
# File 'lib/hdl/chip/schema_chip.rb', line 32 def evaluate(pins = {}) check_pins!(pins) evaluator.evaluate(pins) end |
#internal ⇒ Object
11 12 13 |
# File 'lib/hdl/chip/schema_chip.rb', line 11 def internal wiring_values - inputs - outputs - [true, false] end |
#primitive? ⇒ Boolean
28 29 30 |
# File 'lib/hdl/chip/schema_chip.rb', line 28 def primitive? false end |