Class: RubyRTL::Compiler
- Inherits:
-
Object
- Object
- RubyRTL::Compiler
- Defined in:
- lib/ruby_rtl/compiler.rb
Instance Method Summary collapse
- #analyze(circuit) ⇒ Object
- #compile(circuit) ⇒ Object
- #generate(circuit) ⇒ Object
- #generate_sexp(circuit) ⇒ Object
- #header ⇒ Object
-
#initialize ⇒ Compiler
constructor
A new instance of Compiler.
- #print_ast(circuit, file_suffix = "") ⇒ Object
- #print_dsl(circuit) ⇒ Object
- #type_check(circuit) ⇒ Object
Constructor Details
#initialize ⇒ Compiler
Returns a new instance of Compiler.
12 13 14 15 16 17 18 19 20 |
# File 'lib/ruby_rtl/compiler.rb', line 12 def initialize header @printer=DSLPrinter.new @dot_printer=ASTPrinter.new @analyzer=ContextualAnalyzer.new @checker=TypeChecker.new @vgen=VhdlGenerator.new @sexp_gen=SexpGenerator.new end |
Instance Method Details
#analyze(circuit) ⇒ Object
44 45 46 |
# File 'lib/ruby_rtl/compiler.rb', line 44 def analyze circuit @analyzer.analyze(circuit) end |
#compile(circuit) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/ruby_rtl/compiler.rb', line 26 def compile circuit print_ast(circuit) analyze(circuit) print_dsl(circuit) type_check(circuit) print_dsl(circuit) generate(circuit) generate_sexp(circuit) end |
#generate(circuit) ⇒ Object
52 53 54 |
# File 'lib/ruby_rtl/compiler.rb', line 52 def generate circuit @vgen.generate(circuit) end |
#generate_sexp(circuit) ⇒ Object
56 57 58 |
# File 'lib/ruby_rtl/compiler.rb', line 56 def generate_sexp circuit @sexp_gen.generate(circuit) end |
#header ⇒ Object
22 23 24 |
# File 'lib/ruby_rtl/compiler.rb', line 22 def header puts "RubyRTL compiler " end |
#print_ast(circuit, file_suffix = "") ⇒ Object
40 41 42 |
# File 'lib/ruby_rtl/compiler.rb', line 40 def print_ast circuit,file_suffix="" @dot_printer.run(circuit,file_suffix) end |
#print_dsl(circuit) ⇒ Object
36 37 38 |
# File 'lib/ruby_rtl/compiler.rb', line 36 def print_dsl circuit @printer.print circuit end |
#type_check(circuit) ⇒ Object
48 49 50 |
# File 'lib/ruby_rtl/compiler.rb', line 48 def type_check circuit @checker.check circuit end |