Class: RubyRTL::Visitor

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_rtl/visitor.rb

Instance Method Summary collapse

Instance Method Details

#visit(circuit) ⇒ Object



5
6
7
# File 'lib/ruby_rtl/visitor.rb', line 5

def visit circuit
  circuit.ast.each{|node| node.accept(self)}
end

#visitAssign(node, args = nil) ⇒ Object



51
52
53
54
# File 'lib/ruby_rtl/visitor.rb', line 51

def visitAssign node,args=nil
  node.lhs.accept(self)
  node.rhs.accept(self)
end

#visitBinary(node, args = nil) ⇒ Object

expr ===



95
96
97
98
# File 'lib/ruby_rtl/visitor.rb', line 95

def visitBinary node,args=nil
  node.lhs.accept(self)
  node.rhs.accept(self)
end

#visitBitLit(node, args = nil) ⇒ Object



113
114
115
# File 'lib/ruby_rtl/visitor.rb', line 113

def visitBitLit node,args=nil
  node
end

#visitBitType(node, args = nil) ⇒ Object



140
141
# File 'lib/ruby_rtl/visitor.rb', line 140

def visitBitType node,args=nil
end

#visitBitVectorType(node, args = nil) ⇒ Object



143
144
# File 'lib/ruby_rtl/visitor.rb', line 143

def visitBitVectorType node,args=nil
end

#visitBody(body, args = nil) ⇒ Object

statements



47
48
49
# File 'lib/ruby_rtl/visitor.rb', line 47

def visitBody body,args=nil
  body.each{|stmt| stmt.accept(self,args)}
end

#visitCase(case_, args = nil) ⇒ Object



72
73
74
75
# File 'lib/ruby_rtl/visitor.rb', line 72

def visitCase case_,args=nil
  case_.cond.accept(self)
  case_.body.accept(self)
end

#visitCircuitPart(node, args = nil) ⇒ Object



33
34
# File 'lib/ruby_rtl/visitor.rb', line 33

def visitCircuitPart node,args=nil
end

#visitCombinatorial(comb, args = nil) ⇒ Object



36
37
38
39
# File 'lib/ruby_rtl/visitor.rb', line 36

def visitCombinatorial comb,args=nil
  puts comb.body.class
  comb.body.accept(self)
end

#visitComment(node, args = nil) ⇒ Object



9
10
# File 'lib/ruby_rtl/visitor.rb', line 9

def visitComment node,args=nil
end

#visitCompDecl(node, args = nil) ⇒ Object



30
31
# File 'lib/ruby_rtl/visitor.rb', line 30

def visitCompDecl node,args=nil
end

#visitElse(else_, args = nil) ⇒ Object



63
64
65
# File 'lib/ruby_rtl/visitor.rb', line 63

def visitElse else_,args=nil
  else_.body.accept(self)
end

#visitElsif(elsif_, args = nil) ⇒ Object



67
68
69
70
# File 'lib/ruby_rtl/visitor.rb', line 67

def visitElsif elsif_,args=nil
  elsif_.cond.accept(self)
  elsif_.body.accept(self)
end

#visitFsm(fsm, args = nil) ⇒ Object

fsm



83
84
85
# File 'lib/ruby_rtl/visitor.rb', line 83

def visitFsm fsm,args=nil
  fsm.body.accept(self)
end

#visitIf(node, args = nil) ⇒ Object



56
57
58
59
60
61
# File 'lib/ruby_rtl/visitor.rb', line 56

def visitIf node,args=nil
  node.cond.accept(self)
  node.body.accept(self)
  node.elsifs.each{|elsif_| elsif_.accept(self)}
  node.else.accept(self) if node.else
end

#visitIndexed(indexed, args = nil) ⇒ Object



104
105
106
107
# File 'lib/ruby_rtl/visitor.rb', line 104

def visitIndexed indexed,args=nil
  lhs=indexed.lhs.accept(self)
  rhs=indexed.rhs.accept(self)
end

#visitInput(node, args = nil) ⇒ Object



18
19
# File 'lib/ruby_rtl/visitor.rb', line 18

def visitInput node,args=nil
end

#visitInteger(int, args = nil) ⇒ Object

types ===



133
134
135
# File 'lib/ruby_rtl/visitor.rb', line 133

def visitInteger int,args=nil
  int
end

#visitIntLit(lit, args = nil) ⇒ Object



117
118
119
# File 'lib/ruby_rtl/visitor.rb', line 117

def visitIntLit lit,args=nil
  lit
end

#visitIntType(node, args = nil) ⇒ Object



146
147
# File 'lib/ruby_rtl/visitor.rb', line 146

def visitIntType node,args=nil
end

#visitLiteral(node, args = nil) ⇒ Object

literals ===



109
110
111
# File 'lib/ruby_rtl/visitor.rb', line 109

def visitLiteral node,args=nil
  node
end

#visitNext(node, args = nil) ⇒ Object



91
92
# File 'lib/ruby_rtl/visitor.rb', line 91

def visitNext node,args=nil
end

#visitOutput(node, args = nil) ⇒ Object



21
22
# File 'lib/ruby_rtl/visitor.rb', line 21

def visitOutput node,args=nil
end

#visitPort(node, args = nil) ⇒ Object



15
16
# File 'lib/ruby_rtl/visitor.rb', line 15

def visitPort node,args=nil
end

#visitRecordType(node, args = nil) ⇒ Object



159
160
# File 'lib/ruby_rtl/visitor.rb', line 159

def visitRecordType node,args=nil
end

#visitRIntLit(lit, args = nil) ⇒ Object



125
126
127
# File 'lib/ruby_rtl/visitor.rb', line 125

def visitRIntLit lit,args=nil
  lit
end

#visitRIntType(node, args = nil) ⇒ Object



153
154
# File 'lib/ruby_rtl/visitor.rb', line 153

def visitRIntType node,args=nil
end

#visitRUIntLit(lit, args = nil) ⇒ Object



129
130
131
# File 'lib/ruby_rtl/visitor.rb', line 129

def visitRUIntLit lit,args=nil
  lit
end

#visitRUintType(node, args = nil) ⇒ Object



156
157
# File 'lib/ruby_rtl/visitor.rb', line 156

def visitRUintType node,args=nil
end

#visitSequential(seq, args = nil) ⇒ Object



41
42
43
44
# File 'lib/ruby_rtl/visitor.rb', line 41

def visitSequential seq,args=nil
  puts seq.body.class
  seq.body.accept(self)
end

#visitSig(node, args = nil) ⇒ Object



12
13
# File 'lib/ruby_rtl/visitor.rb', line 12

def visitSig node,args=nil
end

#visitSigDecl(node, args = nil) ⇒ Object



27
28
# File 'lib/ruby_rtl/visitor.rb', line 27

def visitSigDecl node,args=nil
end

#visitState(state, args = nil) ⇒ Object



87
88
89
# File 'lib/ruby_rtl/visitor.rb', line 87

def visitState state,args=nil
  state.body.accept(self)
end

#visitType(node, args = nil) ⇒ Object



137
138
# File 'lib/ruby_rtl/visitor.rb', line 137

def visitType node,args=nil
end

#visitTypeDecl(node, args = nil) ⇒ Object



24
25
# File 'lib/ruby_rtl/visitor.rb', line 24

def visitTypeDecl node,args=nil
end

#visitUIntLit(lit, args = nil) ⇒ Object



121
122
123
# File 'lib/ruby_rtl/visitor.rb', line 121

def visitUIntLit lit,args=nil
  lit
end

#visitUIntType(node, args = nil) ⇒ Object



150
151
# File 'lib/ruby_rtl/visitor.rb', line 150

def visitUIntType node,args=nil
end

#visitUnary(node, args = nil) ⇒ Object



100
101
102
# File 'lib/ruby_rtl/visitor.rb', line 100

def visitUnary node,args=nil
  node.expr.accept(self)
end

#visitWhen(when_, args = nil) ⇒ Object



77
78
79
80
# File 'lib/ruby_rtl/visitor.rb', line 77

def visitWhen when_,args=nil
  when_.value.accept(self) unless when_.value.is_a?(Symbol)
  when_.body.accept(self)
end