Class: HDLRuby::Low::TimeBlock

Inherits:
Block show all
Defined in:
lib/HDLRuby/hruby_db.rb,
lib/HDLRuby/hruby_low.rb,
lib/HDLRuby/hruby_low2c.rb,
lib/HDLRuby/hruby_low2vhd.rb,
lib/HDLRuby/hruby_low2high.rb,
lib/HDLRuby/hruby_low_cleanup.rb,
lib/HDLRuby/hruby_low_mutable.rb,
lib/HDLRuby/hruby_low_skeleton.rb,
lib/HDLRuby/hruby_low_with_var.rb

Overview

Extends the TimeBlock class with separation between signals and variables.

Direct Known Subclasses

High::TimeBlock

Constant Summary

Constants included from Low2Symbol

Low2Symbol::Low2SymbolPrefix, Low2Symbol::Low2SymbolTable, Low2Symbol::Symbol2LowTable

Instance Attribute Summary

Attributes inherited from Block

#mode, #name

Attributes included from Hparent

#parent

Instance Method Summary collapse

Methods inherited from Block

#add_blocks_code, #add_inner, #add_variable, #att_sharp, #att_signal, #blocks2seq!, #boolean_in_assign2select!, #break_concat_assigns!, #change_branch, #clone, #delete_inner!, #delete_related!, #delete_statement!, #do_flat, #each_block, #each_block_deep, #each_inner, #each_node_deep, #each_signal_deep, #each_statement, #each_statement_deep, #explicit_types!, #extract_declares!, #extract_from_externals!, #flatten, #get_by_name, #get_inner, #get_variable, #initialize, #insert_statement!, #last_statement, #map_inners!, #map_statements!, #mix?, #num_statements, #reassign_expressions!, #refs_by_variables!, #repeat_to_verilog!, #replace_expressions!, #replace_names!, #replace_names_subs!, #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_upper_space!, #to_verilog, #to_vhdl, #var2ref, #var_name2sym, #variable_name?, #variables

Methods included from ForceName

#extend_name!, #force_name!

Methods inherited from Statement

#add_blocks_code, #behavior, #block, #blocks2seq!, #break_types!, #clone, #delete_related!, #explicit_types!, #extract_declares!, #mix?, #parent_system, #replace_expressions!, #replace_names!, #scope, #to_c, #to_upper_space!, #to_vhdl, #top_block, #top_scope, #use_name?, #with_boolean!

Methods included from Low2Symbol

#to_sym

Methods included from Hparent

#scope

Constructor Details

This class inherits a constructor from HDLRuby::Low::Block

Instance Method Details

#add_statement(statement) ⇒ Object

Adds a +statement+.

NOTE: TimeBlock is supported.



3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
# File 'lib/HDLRuby/hruby_low.rb', line 3702

def add_statement(statement)
    unless statement.is_a?(Statement) then
        raise AnyError, 
              "Invalid class for a statement: #{statement.class}"
    end
    @statements << statement
    # And set its parent.
    statement.parent = self
    statement
end

#delete_unless!(keep) ⇒ Object

Removes the signals and corresponding assignments whose name is not in +keep+.



198
199
200
# File 'lib/HDLRuby/hruby_low_cleanup.rb', line 198

def delete_unless!(keep)
    # Nothing to cleanup.
end

#eql?(obj) ⇒ Boolean

Comparison for hash: structural comparison.

Returns:

  • (Boolean)


3728
3729
3730
3731
# File 'lib/HDLRuby/hruby_low.rb', line 3728

def eql?(obj)
    return false unless obj.is_a?(TimeBlock)
    return super(obj)
end

#hashObject

Hash function.



3734
3735
3736
# File 'lib/HDLRuby/hruby_low.rb', line 3734

def hash
    return super
end

#to_high(level = 0, header = true) ⇒ Object

Generates the text of the equivalent HDLRuby::High code. +level+ is the hierachical level of the object.



515
516
517
# File 'lib/HDLRuby/hruby_low2high.rb', line 515

def to_high(level = 0, header = true)
    super(level,header,true)
end

#unshift_statement(statement) ⇒ Object

Adds a +statement+ and the begining of the block

NOTE: TimeWait is not supported unless for TimeBlock objects.



3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
# File 'lib/HDLRuby/hruby_low.rb', line 3716

def unshift_statement(statement)
    unless statement.is_a?(Statement) then
        raise AnyError,
              "Invalid class for a statement: #{statement.class}"
    end
    @statements.unshift(statement)
    # And set its parent.
    statement.parent = self
    statement
end

#with_var(upper = nil) ⇒ Object

Converts to a variable-compatible block where +upper+ is the upper block if any.

NOTE: the result is a new block.



257
258
259
260
261
# File 'lib/HDLRuby/hruby_low_with_var.rb', line 257

def with_var(upper = nil)
    # For the specific case of block, the conversion is not
    # done.
    return self
end