Class: ArtDecomp::Decomposition
- Inherits:
-
Object
- Object
- ArtDecomp::Decomposition
- Defined in:
- lib/art-decomp/decomposition.rb
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #disjoint? ⇒ Boolean
- #f_kiss ⇒ Object
- #final?(archs) ⇒ Boolean
- #g_cells(archs) ⇒ Object
- #g_kiss ⇒ Object
- #h_cells(archs) ⇒ Object
- #h_kiss ⇒ Object
- #hash ⇒ Object
-
#initialize(fsm, u, v, qu, qv, g, opts = {}) ⇒ Decomposition
constructor
A new instance of Decomposition.
- #q_kiss ⇒ Object
- #sensible?(archs) ⇒ Boolean
- #symbolic? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize(fsm, u, v, qu, qv, g, opts = {}) ⇒ Decomposition
Returns a new instance of Decomposition.
3 4 5 |
# File 'lib/art-decomp/decomposition.rb', line 3 def initialize fsm, u, v, qu, qv, g, opts = {} @fsm, @u, @v, @qu, @qv, @g = fsm, u, v, qu, qv, g end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
7 8 9 |
# File 'lib/art-decomp/decomposition.rb', line 7 def == other [@fsm, @u, @v, @qu, @qv, @g] == [other.fsm, other.u, other.v, other.qu, other.qv, other.g] end |
#disjoint? ⇒ Boolean
11 12 13 |
# File 'lib/art-decomp/decomposition.rb', line 11 def disjoint? (@u & @v).empty? end |
#f_kiss ⇒ Object
17 18 19 |
# File 'lib/art-decomp/decomposition.rb', line 17 def f_kiss @fsm.to_kiss end |
#final?(archs) ⇒ Boolean
21 22 23 24 |
# File 'lib/art-decomp/decomposition.rb', line 21 def final? archs pins = archs.map(&:pins).max @v.size + @qv.pins <= pins and @u.size + @qu.pins + @g.pins <= pins end |
#g_cells(archs) ⇒ Object
26 27 28 |
# File 'lib/art-decomp/decomposition.rb', line 26 def g_cells archs Arch[@v.size + @qv.pins, @g.pins].cells archs end |
#g_kiss ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/art-decomp/decomposition.rb', line 30 def g_kiss lines = (@fsm.beta_x(@v) * @qv).ints.map do |row| v = @fsm.x_encoding @v, row qv = @qv.encoding row g = @g.encoding row "#{v}#{qv} #{g}" end KISS.new(lines).formatted end |
#h_cells(archs) ⇒ Object
40 41 42 |
# File 'lib/art-decomp/decomposition.rb', line 40 def h_cells archs Arch[@u.size + @qu.pins + @g.pins, @fsm.output_count + @qu.pins + @qv.pins].cells archs end |
#h_kiss ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/art-decomp/decomposition.rb', line 44 def h_kiss lines = (@fsm.beta_x(@u) * @g * @qu).ints.map do |row| u = @fsm.x_encoding @u, row qu = @qu.encoding row qup = @qu.encoding @fsm.state_rows_of_next_state_of(row) qvp = @qv.encoding @fsm.state_rows_of_next_state_of(row) y = @fsm.y_encoding row qu = '*' if qu =~ /^-+$/ qup = '*' if qup =~ /^-+$/ # FIXME: use only the encoding(s) really mapped from this row @g.encodings(row).map do |g| "#{u}#{g} #{qu} #{qup} #{qvp}#{y}" end end.flatten KISS.new(lines).formatted end |
#hash ⇒ Object
61 62 63 |
# File 'lib/art-decomp/decomposition.rb', line 61 def hash @fsm.hash ^ @u.hash ^ @v.hash ^ @qu.hash ^ @qv.hash ^ @g.hash end |
#q_kiss ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'lib/art-decomp/decomposition.rb', line 65 def q_kiss lines = @fsm.beta_q.ints.map do |row| qu = @qu.encoding row qv = @qv.encoding row q = @fsm.q_encoding row "#{qu} #{qv} #{q}" end KISS.new(lines).formatted end |
#sensible?(archs) ⇒ Boolean
75 76 77 |
# File 'lib/art-decomp/decomposition.rb', line 75 def sensible? archs @v.size + @qv.pins <= archs.map(&:pins).max and @u.size + @qu.pins + @g.pins < @fsm.input_count + @fsm.beta_q.pins end |
#symbolic? ⇒ Boolean
79 80 81 |
# File 'lib/art-decomp/decomposition.rb', line 79 def symbolic? @qu.size > 2 end |
#valid? ⇒ Boolean
83 84 85 |
# File 'lib/art-decomp/decomposition.rb', line 83 def valid? @g.seps.subset?((@fsm.beta_x(@v) * @qv).seps) and @fsm.beta_f.seps.subset?((@fsm.beta_x(@u) * @qu * @g).seps) end |