Class: HDLRuby::High::Block
- Inherits:
-
Low::Block
- Object
- Base::Statement
- Low::Statement
- Low::Block
- HDLRuby::High::Block
- Includes:
- BlockHierarchy, HBlock, Hinner, RCSimBlock, WithFullname
- Defined in:
- lib/HDLRuby/hruby_high.rb,
lib/HDLRuby/hruby_rsim.rb,
lib/HDLRuby/hruby_rcsim.rb,
lib/HDLRuby/hruby_rsim_vcd.rb,
lib/HDLRuby/hruby_high_fullname.rb
Overview
Enhance the block class with VCD support.
Constant Summary collapse
Constants included from Hmissing
Constants included from Low::Low2Symbol
Low::Low2Symbol::Low2SymbolPrefix, Low::Low2Symbol::Low2SymbolTable, Low::Low2Symbol::Symbol2LowTable
Instance Attribute Summary
Attributes included from RCSimBlock
Attributes included from HBlock
Attributes inherited from Low::Block
Attributes included from Low::Hparent
Instance Method Summary collapse
-
#execute(mode) ⇒ Object
Executes the statement.
-
#fullname ⇒ Object
Returns the name of the signal with its hierarchy.
-
#init_sim(systemT) ⇒ Object
Initialize the simulation for system +systemT+.
-
#initialize(mode, name = :"", &ruby_block) ⇒ Block
constructor
Creates a new +mode+ sort of block, with possible +name+ and build it by executing +ruby_block+.
-
#to_low ⇒ Object
Converts the block to HDLRuby::Low.
Methods included from BlockHierarchy
#get_vars_with_fullname, #get_vars_with_idstr, #show_hierarchy
Methods included from RCSimBlock
Methods included from Hinner
Methods included from HBlock
#add_block, #build, #cur_behavior, #cur_block, #cur_scope, #cur_system, #hcase, #helse, #helsif, #hif, #hprint, #hwhen, #par, #seq, #sub, #terminate, #to_ref, #top_block, #unshift
Methods included from Hmux
Methods included from HScope_missing
Methods included from Hmissing
Methods inherited from Low::Block
#add_blocks_code, #add_inner, #add_make_block, #add_statement, #add_variable, #att_sharp, #att_signal, #blocks2seq!, #boolean_in_assign2select!, #break_concat_assigns!, #casts_without_expression!, #change_branch, #clone, #delete_inner!, #delete_related!, #delete_statement!, #delete_unless!, #do_flat, #each_block, #each_block_deep, #each_deep, #each_inner, #each_node_deep, #each_signal_deep, #each_statement, #each_statement_deep, #eql?, #explicit_types!, #extract_declares!, #extract_from_externals!, #flatten, #get_by_name, #get_inner, #get_variable, #hash, #insert_statement!, #last_statement, #map_inners!, #map_statements!, #mix?, #num_statements, #par_in_seq2seq!, #reassign_expressions!, #refs_by_variables!, #replace_expressions!, #replace_names!, #replace_names_subs!, #replace_statement!, #res_name, #reverse_each_statement, #search_refname, #select2case!, #set_mode!, #set_name!, #set_statement!, #sym2var_name, #to_c, #to_c_code, #to_ch, #to_conversion, #to_hdr, #to_high, #to_seq!, #to_upper_space!, #to_verilog, #to_vhdl, #unshift_statement, #var2ref, #var_name2sym, #variable_name?, #variables, #with_var
Methods included from Low::ForceName
Methods inherited from Low::Statement
#add_blocks_code, #add_make_block, #behavior, #block, #blocks2seq!, #break_types!, #clone, #delete_related!, #delete_unless!, #each_deep, #each_statement, #eql?, #explicit_types!, #extract_declares!, #hash, #mix?, #par_in_seq2seq!, #parent_system, #replace_expressions!, #replace_names!, #scope, #to_c, #to_ch, #to_hdr, #to_high, #to_seq!, #to_upper_space!, #to_vhdl, #top_block, #top_scope, #use_name?, #with_boolean!
Methods included from Low::Low2Symbol
Methods included from Low::Hparent
#hierarchy, #no_parent!, #scope
Constructor Details
#initialize(mode, name = :"", &ruby_block) ⇒ Block
Creates a new +mode+ sort of block, with possible +name+ and build it by executing +ruby_block+.
4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 |
# File 'lib/HDLRuby/hruby_high.rb', line 4158 def initialize(mode, name=:"", &ruby_block) # Initialize the block. super(mode,name) unless name.empty? then # Named block, set the hdl-like access to the block. obj = self # For using the right self within the proc High.space_reg(name) { obj } end # Creates the namespace. @namespace = Namespace.new(self) # puts "methods = #{self.methods.sort}" build(&ruby_block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class HDLRuby::High::HScope_missing
Instance Method Details
#execute(mode) ⇒ Object
Executes the statement.
850 851 852 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 850 def execute(mode) self.each_statement { |stmnt| stmnt.execute(self.mode) } end |
#fullname ⇒ Object
Returns the name of the signal with its hierarchy.
855 856 857 858 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 855 def fullname @fullname ||= self.parent.fullname + ":" + self.name.to_s return @fullname end |
#init_sim(systemT) ⇒ Object
Initialize the simulation for system +systemT+.
842 843 844 845 846 847 |
# File 'lib/HDLRuby/hruby_rsim.rb', line 842 def init_sim(systemT) # Recurse on the inner signals. self.each_inner { |sig| sig.init_sim(systemT) } # Recurde on the statements. self.each_statement { |stmnt| stmnt.init_sim(systemT) } end |
#to_low ⇒ Object
Converts the block to HDLRuby::Low.
4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 |
# File 'lib/HDLRuby/hruby_high.rb', line 4176 def to_low # Create the resulting block blockL = HDLRuby::Low::Block.new(self.mode,self.name) # # For debugging: set the source high object # blockL.properties[:low2high] = self.hdr_id # self.properties[:high2low] = blockL # Push the namespace for the low generation. High.space_push(@namespace) # Pushes on the name stack for converting the internals of # the block. High.names_push # Add the inner signals self.each_inner { |inner| blockL.add_inner(inner.to_low) } # Add the statements self.each_statement do |statement| blockL.add_statement(statement.to_low) end # Restores the name stack. High.names_pop # Restores the namespace stack. High.space_pop # Return the resulting block return blockL end |