Class: Logicuit::Circuits::Td4::Rom
- Defined in:
- lib/logicuit/circuits/td4/rom.rb
Overview
Timer
Instance Attribute Summary
Attributes inherited from DSL
#clock, #components, #initialized, #input_targets, #output_targets
Instance Method Summary collapse
Methods inherited from DSL
#[], assembling, #assembling, diagram, #initialize, #inputs, inputs, outputs, #outputs, run, truth_table
Constructor Details
This class inherits a constructor from Logicuit::DSL
Instance Method Details
#evaluate ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/logicuit/circuits/td4/rom.rb', line 12 def evaluate return unless initialized output = case "#{a3}#{a2}#{a1}#{a0}" in "0000" then "10110111" in "0001" then "00000001" in "0010" then "11100001" in "0011" then "00000001" in "0100" then "11100011" in "0101" then "10110110" in "0110" then "00000001" in "0111" then "11100110" in "1000" then "00000001" in "1001" then "11101000" in "1010" then "10110000" in "1011" then "10110100" in "1100" then "00000001" in "1101" then "11101010" in "1110" then "10111000" in "1111" then "11111111" end output.split("").zip([d7, d6, d5, d4, d3, d2, d1, d0]).each do |v, o| v == "1" ? o.on : o.off end end |