Class: Idl::GlobalWithInitializationAst
- Includes:
- Declaration, Executable
- Defined in:
- lib/idl/ast.rb
Overview
global variable declared with an initializer,
e.g.,
Bits<65> UNDEFINED_LEGAL = 65’h10000000000000000; Bits<FLEN> f = [0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0];
Instance Method Summary collapse
- #add_symbol(symtab) ⇒ Object
-
#execute(symtab) ⇒ void
included
from Executable
“execute” the statement by updating the variables in the symbol table.
-
#execute_unknown(symtab) ⇒ void
included
from Executable
“execute” the statement, forcing any variable assignments to an unknown state This is used down unknown conditional paths.
-
#initialize(input, interval, var_decl_with_init) ⇒ GlobalWithInitializationAst
constructor
A new instance of GlobalWithInitializationAst.
- #to_idl ⇒ Object
- #type(symtab) ⇒ Object
- #type_check(symtab) ⇒ Object
- #value(symtab) ⇒ Object
-
#var_decl_with_init ⇒ VariableDeclationWithInitializationAst
The initializer.
Constructor Details
#initialize(input, interval, var_decl_with_init) ⇒ GlobalWithInitializationAst
Returns a new instance of GlobalWithInitializationAst.
641 642 643 644 |
# File 'lib/idl/ast.rb', line 641 def initialize(input, interval, var_decl_with_init) super(input, interval, [var_decl_with_init]) var_decl_with_init.make_global end |
Instance Method Details
#add_symbol(symtab) ⇒ Object
661 662 663 664 665 666 |
# File 'lib/idl/ast.rb', line 661 def add_symbol(symtab) raise "Symtab should be at global scope" unless symtab.levels == 1 # globals never have a compile-time value var_decl_with_init.add_symbol(symtab) end |
#execute(symtab) ⇒ void Originally defined in module Executable
This method returns an undefined value.
“execute” the statement by updating the variables in the symbol table
#execute_unknown(symtab) ⇒ void Originally defined in module Executable
This method returns an undefined value.
“execute” the statement, forcing any variable assignments to an unknown state This is used down unknown conditional paths.
#to_idl ⇒ Object
669 670 671 |
# File 'lib/idl/ast.rb', line 669 def to_idl var_decl_with_init.to_idl end |
#type(symtab) ⇒ Object
652 653 654 |
# File 'lib/idl/ast.rb', line 652 def type(symtab) var_decl_with_init.type(symtab) end |
#type_check(symtab) ⇒ Object
647 648 649 |
# File 'lib/idl/ast.rb', line 647 def type_check(symtab) var_decl_with_init.type_check(symtab) end |
#value(symtab) ⇒ Object
657 658 659 |
# File 'lib/idl/ast.rb', line 657 def value(symtab) var_decl_with_init.value(symtab) end |
#var_decl_with_init ⇒ VariableDeclationWithInitializationAst
Returns The initializer.
637 638 639 |
# File 'lib/idl/ast.rb', line 637 def var_decl_with_init @children[0] end |